Commit graph

229039 commits

Author SHA1 Message Date
bors
5680fa18fe Auto merge of #115140 - wesleywiser:turn_off_mir_sroa, r=cuviper
Disable MIR SROA optimization by default

Turn off the MIR SROA optimization by default to prevent incorrect debuginfo generation and rustc ICEs caused by invalid LLVM IR being created.

Related to #115113

r? `@cuviper`
cc `@saethlin`
2023-08-23 19:48:39 +00:00
Wesley Wiser
298ec5258f Disable MIR SROA optimization by default
Turn off the MIR SROA optimization by default to prevent incorrect
debuginfo generation and rustc ICEs caused by invalid LLVM IR being
created.

Related to #115113
2023-08-23 14:08:43 -04:00
bors
f155f8c3d9 Auto merge of #115083 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] backport lint-docs fix

r? `@Mark-Simulacrum`
2023-08-22 03:32:56 +00:00
Mark Rousskov
44013319fb Include 1.17.1 release notes too 2023-08-21 22:47:43 -04:00
jyn
7cc7c5fbd5 Revert "Fix x test lint-docs when download-rustc is enabled"
This was not the correct fix. The problem was two-fold:
- `download-rustc` didn't respect `llvm.assertions`
- `rust-dev` was missing a bump to `download-ci-llvm-stamp`

The first is fixed in this PR and the latter was fixed a while ago. Revert this change to avoid breaking `rpath = false`.
2023-08-21 22:23:48 -04:00
bors
6301e8cdd5 Auto merge of #115057 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.72.0 release

r? `@Mark-Simulacrum`
2023-08-21 14:55:36 +00:00
Mark Rousskov
dabccdcb9b 1.72.0 release 2023-08-21 09:14:53 -04:00
bors
7a3a43a3b9 Auto merge of #114955 - cuviper:beta-next, r=cuviper
[beta] backports

* Upgrade std to gimli 0.28.0 #114825
* Partially revert #107200 #114897
* Permit pre-evaluated constants in simd_shuffle #113529

r? cuviper
2023-08-18 03:54:23 +00:00
Oli Scherer
402cc350c1 Monomorphize constants before inspecting them
(cherry picked from commit c7428d5052)
2023-08-17 19:38:42 -07:00
Oli Scherer
5905d9cdba Permit pre-evaluated constants in simd_shuffle
(cherry picked from commit 9e5a67e57f)
2023-08-17 19:38:42 -07:00
Josh Triplett
155a8fb983 Partially revert #107200
`Ok(0)` is indeed something the caller may interpret as an error, but
that's the *correct* thing to return if the writer can't accept any more
bytes.

(cherry picked from commit 5210f482d7)
2023-08-17 19:38:22 -07:00
Josh Stone
c102d110d9 Upgrade std to gimli 0.28.0 2023-08-17 19:36:50 -07:00
bors
8c6029574c Auto merge of #114937 - flip1995:clippy_beta_backport, r=Mark-Simulacrum
[beta] Clippy backports for ICE fixes

This backports PRs to beta, that fix ICEs, some lint grouping and FP fixes. Namely:

- https://github.com/rust-lang/rust-clippy/pull/11191
- https://github.com/rust-lang/rust-clippy/pull/11172
- https://github.com/rust-lang/rust-clippy/pull/11130
- https://github.com/rust-lang/rust-clippy/pull/11106
- https://github.com/rust-lang/rust-clippy/pull/11104
- https://github.com/rust-lang/rust-clippy/pull/11077
- https://github.com/rust-lang/rust-clippy/pull/11070 (This PR is not synced to the Rust repo yet, but I will open a separate PR to get it into `master`, before beta is branched: https://github.com/rust-lang/rust/pull/114938)
- https://github.com/rust-lang/rust-clippy/pull/11069

Kind of a big backport, but most of it is tests.

r? `@Mark-Simulacrum`

cc `@Manishearth`
2023-08-17 19:46:01 +00:00
bors
48fca125b8
Auto merge of #11069 - y21:issue11063, r=Alexendoo
[`missing_fields_in_debug`]: make sure self type is an adt

Fixes #11063, another ICE that can only happen in core.

This lint needs the `DefId` of the implementor to get its fields, but that ICEs if the implementor does not have a `DefId` (as is the case with primitive types, e.g. `impl Debug for bool`), which is where this ICE comes from.

This PR changes the check I added in #10897 to be more... robust against `Debug` implementations we don't want to lint.
Instead of just checking if the self type is a type parameter and "special casing" one specific case we don't want to lint, we should probably rather just check that the self type is either a struct, an enum or a union and only then continue.
That prevents weird edge cases like this one that can only happen in core.

Again, I don't know if it's even possible to add a test case for this since one cannot implement `Debug` for primitive types outside of the crate that defined `Debug` (core).
I did make sure that this PR no longer ICEs on `impl<T> Debug for T` and `impl Debug for bool`.
Maybe writing such a test is possible with `#![no_core]` and then re-defining the `Debug` trait or something like that...?

changelog: [`missing_fields_in_debug`]: make sure self type is an adt (fixes an ICE in core)

r? `@Alexendoo` (reviewed the last PRs for this lint)
2023-08-17 17:50:37 +02:00
bors
2562f8466c
Auto merge of #11070 - y21:issue11065, r=flip1995
[`useless_conversion`]: only lint on paths to fn items and fix FP in macro

Fixes #11065 (which is actually two issues: an ICE and a false positive)

It now makes sure that the function call path points to a function-like item (and not e.g. a `const` like in the linked issue), so that calling `TyCtxt::fn_sig` later in the lint does not ICE (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616836099).
It *also* makes sure that the expression is not part of a macro call (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616919639). ~~I'm not sure if there's a better way to check this other than to walk the parent expr chain and see if any of them are expansions.~~ (edit: it doesn't do this anymore)

changelog: [`useless_conversion`]: fix ICE when call receiver is a non-fn item
changelog: [`useless_conversion`]: don't lint if argument is a macro argument (fixes a FP)

r? `@llogiq` (reviewed #10814, which introduced these issues)
2023-08-17 17:50:37 +02:00
bors
3a86898bc5
Auto merge of #11106 - syvb:literal_unwrap_ice, r=dswij
[`unnecessary_literal_unwrap`]: Fix ICE on None.unwrap_or_default()

Fixes #11099
Fixes #11064

I'm running into #11099 (cc `@y21)` on my Rust codebase. Clippy ICEs on this code when evaluating the `unnecessary_literal_unwrap` lint:
```rust
fn main() {
    let val1: u8 = None.unwrap_or_default();
}
```

This fixes that ICE and adds an message specifically for that case:

```
error: used `unwrap_or_default()` on `None` value
  --> $DIR/unnecessary_literal_unwrap.rs:26:5
   |
LL |     None::<String>.unwrap_or_default();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap_or_default()`: `String::default()`
```

This PR also fixes the same ICE with `None.unwrap_or_else` (by giving the generic error message for the lint in that case).

changelog: Fix ICE in `unnecessary_literal_unwrap` on `None.unwrap_or_default()`
2023-08-17 17:50:36 +02:00
bors
e8d5b1e66e
Auto merge of #11130 - smoelius:fix-10535, r=Jarcho
Fix ICE in #10535

Fixes #10535

r? `@Jarcho`

changelog: Eliminate ICE described in #10535
2023-08-17 17:15:49 +02:00
bors
c879eb5928
Auto merge of #11191 - Alexendoo:redundant-type-annotations-ice, r=llogiq
redundant_type_annotations: only pass certain def kinds to type_of

Fixes #11190
Fixes rust-lang/rust#113516

Also adds an `is_lint_allowed` check to skip the lint when it's not needed

changelog: none
2023-08-17 16:57:55 +02:00
bors
ced5a58fa0
Auto merge of #11104 - Alexendoo:arc-with-non-send-sync, r=Centri3
`arc_with_non_send_sync`: reword and move to `suspicious`

Fixes #11079

changelog: [`arc_with_non_send_sync`]: move to complexity
2023-08-17 16:52:50 +02:00
bors
1888037438
Auto merge of #11077 - y21:issue11076, r=Manishearth
[`arc_with_non_send_sync`]: don't lint if type has nested type parameters

Fixes #11076

changelog: [`arc_with_non_send_sync`]: don't lint if type has nested type parameters

r? `@Manishearth`
2023-08-17 16:52:14 +02:00
bors
214ab1197f
Auto merge of #11172 - Alexendoo:tuple-array-conversions-nursery, r=xFrednet
Move tuple_array_conversions to nursery

changelog: Move [`tuple_array_conversions`] to `nursery` (Now allow-by-default)
<!-- FIY: Ignore this change, if the commit gets backported and also https://github.com/rust-lang/rust-clippy/pull/11146 -->
[#11172](https://github.com/rust-lang/rust-clippy/pull/11172)

The nursery change got lost in #11146 and it ended up in pedantic, this puts it in nursery and gives something to backport

r? `@xFrednet`
2023-08-17 16:47:30 +02:00
bors
ab197f48b4 Auto merge of #114906 - weihanglo:update-beta-cargo, r=weihanglo
[beta-1.72.0] backport cargo

1 commits in 44b6be4bdf2cd7d3f4d4cb266bfe428dfc2a7952..103a7ff2ee7678d34f34d778614c5eb2525ae9de
2023-08-03 13:43:58 +0000 to 2023-08-15 23:32:44 +0000
- [beta-1.72.0] bump cargo-util to 0.2.5 (rust-lang/cargo#12505)

r? ghost
2023-08-17 02:55:10 +00:00
Weihang Lo
7acad66119
[beta] Update cargo 2023-08-16 19:19:40 +01:00
bors
598a0a3cb3 Auto merge of #114726 - DianQK:beta, r=cuviper
[beta] Update LLVM to resolve a miscompilation found in 114312.

Related issue: #114312 .

After the master updates the LLVM, we will add the same test cases. In the meantime, close the issue.
2023-08-12 05:38:25 +00:00
DianQK
e241551f8b
[beta-1.72] Update LLVM to resolve a miscompilation found in 114312. 2023-08-12 12:19:45 +08:00
DianQK
81e1247e8b
[beta-1.72] Pre-commit test for issue 114312.
We show this miscompilation in this commit.
2023-08-12 12:19:20 +08:00
bors
d1fa3e4de3 Auto merge of #114748 - cuviper:beta-next, r=cuviper
[beta] backport

* Restrict linker version script of proc-macro crates to just its two symbols #114470
* bootstrap: config: fix version comparison bug #114440
* lint/ctypes: only try normalize #113921
* Avoid tls access while iterating through mpsc thread entries #113861
* Substitute types before checking inlining compatibility. #113802
* Revert "fix: bug etc/bash_complettion -> src/etc/... to avoid copy error" #113579
* lint/ctypes: fix () return type checks #113457
* Rename and allow cast_ref_to_mut lint #113422
* Ignore flaky clippy tests. #113621

r? cuviper
2023-08-12 03:05:01 +00:00
Eric Huss
4d0501412a Ignore flaky clippy tests.
(cherry picked from commit fb5efd7008)
2023-08-11 19:17:23 -07:00
Felix S. Klock II
bc3491f99e fix proc-macro test added here to solely be exercised as a build product for the host.
thus we should no longer see test failures for e.g. wasm32 target.

(cherry picked from commit a2a7f27fd2)
2023-08-11 18:52:37 -07:00
Felix S. Klock II
a94c607997 Review feedback: return empty iff !should_codegen, and use simpler unconditional logic otherwise.
(cherry picked from commit a2058ddbed)
2023-08-11 18:52:37 -07:00
Felix S Klock II
fecb6b277c Update tests/ui/proc-macro/no-mangle-in-proc-macro-issue-111888.rs
fix to test as proposed by wesleywiser

Co-authored-by: Wesley Wiser <wwiser@gmail.com>
(cherry picked from commit 5881e5f88d)
2023-08-11 18:52:37 -07:00
Felix S. Klock II
6afdab5c68 regression test for issue 111888.
(cherry picked from commit 7a0e2ee133)
2023-08-11 18:52:37 -07:00
Felix S. Klock II
8f4613ea77 special-case proc-macro crates in rustc_codegen_ssa:🔙:linker::exported_symbols to only export the two symbols that proc-macros need.
(cherry picked from commit 3000c24afc)
2023-08-11 18:52:37 -07:00
Ariadne Conill
a3d2871102 bootstrap: config: fix version comparison bug
Rust requires a previous version of Rust to build, such as the current version, or the
previous version.  However, the version comparison logic did not take patch releases
into consideration when doing the version comparison for the current branch, e.g.
Rust 1.71.1 could not be built by Rust 1.71.0 because it is neither an exact version
match, or the previous version.

Adjust the version comparison logic to tolerate mismatches in the patch version.

Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
(cherry picked from commit 31a81a0878)
2023-08-11 18:52:16 -07:00
David Wood
0426c1f1d5 lint/ctypes: only try normalize
Now that this lint runs on any external-ABI fn-ptr, normalization won't
always succeed, so use `try_normalize_erasing_regions` instead.

Signed-off-by: David Wood <david@davidtw.co>
(cherry picked from commit 09434a2575)
2023-08-11 18:51:55 -07:00
Ibraheem Ahmed
fc3ed7c298 avoid tls access while iterating through mpsc thread entries
(cherry picked from commit fb31a1ac21)
2023-08-11 18:49:41 -07:00
Camille GILLOT
33322e06da Substitute types before checking compatibility.
(cherry picked from commit 45ffe41d14)
2023-08-11 18:48:56 -07:00
ekusiadadus
64b4a54227 Revert "fix: 🐛 etc/bash_complettion -> src/etc/... to avoid copy error"
This reverts commit 08ce68b6a6.

(cherry picked from commit 05bc71cfaf)
2023-08-11 18:48:09 -07:00
David Wood
91e377c286 lint/ctypes: allow () within types
Consider `()` within types to be FFI-safe, and `()` to be FFI-safe as a
return type (incl. when in a transparent newtype).

Signed-off-by: David Wood <david@davidtw.co>
(cherry picked from commit 24f90fdd26)
2023-08-11 18:47:47 -07:00
David Wood
e9cd650331 lint: refactor check_variant_for_ffi
Simplify this function a bit, it was quite hard to reason about.

Signed-off-by: David Wood <david@davidtw.co>
(cherry picked from commit 99b1897cf6)
2023-08-11 18:46:58 -07:00
David Wood
7744a86963 lint/ctypes: stricter () return type checks
`()` is normally FFI-unsafe, but is FFI-safe when used as a return type.
It is also desirable that a transparent newtype for `()` is FFI-safe when
used as a return type.

In order to support this, when an type was deemed FFI-unsafe, because of
a `()` type, and was used in return type - then the type was considered
FFI-safe. However, this was the wrong approach - it didn't check that the
`()` was part of a transparent newtype! The consequence of this is that
the presence of a `()` type in a more complex return type would make it
the entire type be considered safe (as long as the `()` type was the
first that the lint found) - which is obviously incorrect.

Instead, this logic is removed, and a unit return type or a transparent
wrapper around a unit is checked for directly for functions and fn-ptrs.

Signed-off-by: David Wood <david@davidtw.co>
(cherry picked from commit f53cef31f5)
2023-08-11 18:41:21 -07:00
Urgau
e20288d2af Temporarily switch invalid_reference_casting lint to allow-by-default
(cherry picked from commit f25ad54a4d)
2023-08-11 18:40:46 -07:00
Urgau
b3458da65b Rename cast_ref_to_mut to invalid_reference_casting (clippy side)
(cherry picked from commit fa15df6f5a)
2023-08-11 18:40:43 -07:00
Urgau
f39eb7e658 Rename cast_ref_to_mut lint to invalid_reference_casting
(cherry picked from commit 3dbbf23e29)
2023-08-11 18:37:37 -07:00
bors
d8fd588afa Auto merge of #114422 - weihanglo:update-beta-cargo, r=weihanglo
[beta-1.72] Update cargo (CVE-2023-38497 fix included)

1 commits in 11ffe0e500346b26e3de1ba115482b4da586dfac..44b6be4bdf2cd7d3f4d4cb266bfe428dfc2a7952
2023-07-30 20:44:11 +0000 to 2023-08-03 13:43:58 +0000
- Fix CVE-2023-38497 for beta 1.72.0 (rust-lang/cargo#12442)

r? `@ghost`
2023-08-03 18:39:49 +00:00
Weihang Lo
bbdc4d065f
[beta-1.72] Update cargo 2023-08-03 15:45:13 +01:00
bors
1537df02f8 Auto merge of #114279 - weihanglo:update-beta-cargo, r=weihanglo
[beta-1.72] Update cargo

1 commits in dd6536b8ed28f73c0e82089c72ef39a03bc634be..11ffe0e500346b26e3de1ba115482b4da586dfac
2023-07-18 14:02:13 +0000 to 2023-07-30 20:44:11 +0000
- [beta-1.72] backport rust-lang/cargo#12411 (rust-lang/cargo#12417)

r? `@ghost`
2023-08-01 11:28:57 +00:00
bors
efb1be3a08 Auto merge of #113786 - Kobzol:ci-disable-dist-tests, r=Mark-Simulacrum
Disable dist tests on beta/stable

Should resolve the beta/stable part of https://github.com/rust-lang/rust/issues/113784. To be extra safe, I also made the read of `RUST_RELEASE_CHANNEL` optional, just in case it was missing.

r? `@Mark-Simulacrum`
2023-08-01 07:18:59 +00:00
Weihang Lo
391c7fb42a
[beta] Update cargo 2023-07-31 09:58:35 +01:00
bors
a47f796a36 Auto merge of #113938 - Mark-Simulacrum:beta-backport, r=Mark-Simulacrum
[beta] backport

This PR backports:

- #113690: allow opaques to be defined by trait queries, again
- #113631: make MCP510 behavior opt-in to avoid conflicts between the CLI and target flavors

It also includes a bump of bootstrap to the released stable.

r? `@Mark-Simulacrum`
2023-07-22 02:58:19 +00:00