Commit Graph

21219 Commits

Author SHA1 Message Date
aklaiber
92646739fe Add regression test for issue 91831 2025-09-18 13:56:52 +02:00
lcnr
9913c47da2 add tests, silence type annotations needed errors for opaques 2025-09-18 12:58:39 +02:00
lcnr
f4e19c6878 support calls on opaque types :< 2025-09-18 12:58:38 +02:00
bors
97a987f14c Auto merge of #142544 - Sa4dUs:prevent-abi-changes, r=ZuseZ4
Prevent ABI changes affect EnzymeAD

This PR handles ABI changes for autodiff input arguments to improve Enzyme compatibility. Fundamentally this adjusts activities when a function argument is lowered as an `ScalarPair`, so there's no mismatch between diff activities and args. Also removes activities corresponding to ZSTs.

fixes: https://github.com/rust-lang/rust/issues/144025

r? `@ZuseZ4`
2025-09-18 07:32:49 +00:00
Stuart Cook
d5aa8d5e5e Rollup merge of #146566 - cjgillot:mir-overlap-lint, r=saethlin
Lint more overlapping assignments in MIR.

In an effort to make bugs like https://github.com/rust-lang/rust/issues/146383 more easily discovered, this PR extends the "overlapping assignment" MIR lint.

I had to whitelist some rvalues, as they are actually allowed to alias, like `a = a + 1`.
2025-09-18 11:48:50 +10:00
Camille Gillot
912785d966 Lint overlapping assignments in MIR. 2025-09-17 21:12:17 +00:00
Jana Dönszelmann
1c1d5c71e0 Rollup merge of #146536 - omskscream:#133895/clean-ui-tests, r=davidtwco
clean up several trait related UI tests

Part of rust-lang/rust#133895
Cleaned up several `issue-xxxx` trait related tests from `/tests/ui/issues`, one commit per issue for review. Will squash them once approved.

Related issues:
rust-lang/rust#19479
rust-lang/rust#2284
rust-lang/rust#18088
rust-lang/rust#21950
2025-09-17 20:29:35 +02:00
Marcelo Domínguez
0bf85d35ec Support ZST args 2025-09-17 12:11:27 +00:00
Marcelo Domínguez
11107679ee Add test for autodiff abi handling 2025-09-17 12:01:22 +00:00
bors
ce6daf3d5a Auto merge of #142915 - cjgillot:dest-prop-default, r=saethlin
Enable DestinationPropagation by default

This PR proposes to perform destination propagation on MIR. Most of the pass was fully rewritten by `@JakobDegen` in rust-lang/rust#96451.

This pass is quite heavy, as it needs to perform and save the results of a full liveness dataflow analysis. This accounts for ~50% of the pass' runtime.

Perf sees a few decent savings in later llvm passes, but also sizeable régressions when there are no savings to balance this pass' runtime.
2025-09-17 10:44:22 +00:00
Stuart Cook
76f115942d Rollup merge of #146588 - Gelbpunkt:musl-default-linking-test, r=jieyouxu
tests/run-make: Update list of statically linked musl targets

All of the tier 3 targets in the list now link dynamically by default (except `mips64el-unknown-linux-muslabi64`, I apparently overlooked that one in my PR that changed this).

Adjust the list of targets expected to link statically accordingly.

See also https://github.com/rust-lang/rust/pull/144410, which changed these targets.

Target by target:
- `mips64-unknown-linux-musl`: this target does not exist AFAICT
- `mips64-unknown-linux-muslabi64`: updated in the linked PR
- `powerpc-unknown-linux-musl`: updated in the linked PR
- `powerpc-unknown-linux-muslspe`: updated in the linked PR
- `powerpc64-unknown-linux-musl`: updated in the linked PR
- `riscv32gc-unknown-linux-musl`: updated in the linked PR
- `s390x-unknown-linux-musl`: updated in the linked PR
- `thumbv7neon-unknown-linux-musleabihf`: updated in the linked PR
2025-09-17 14:56:49 +10:00
Stuart Cook
61f53585aa Rollup merge of #146581 - estebank:issue-146489, r=lcnr
Detect attempt to use var-args in closure

```
error: unexpected `...`
  --> $DIR/no-closure.rs:11:14
   |
LL |     let f = |...| {};
   |              ^^^ not a valid pattern
   |
   = note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list

error: unexpected `...`
  --> $DIR/no-closure.rs:16:17
   |
LL |     let f = |_: ...| {};
   |                 ^^^
   |
   = note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
```

Fix rust-lang/rust#146489, when trying to use c-style var-args in a closure. We emit a more targeted message. We also silence inference errors when the pattern is `PatKind::Err`.
2025-09-17 14:56:48 +10:00
Stuart Cook
6473a0f02d Rollup merge of #146564 - cjgillot:mir-nolen, r=scottmcm
Remove Rvalue::Len again.

Now that we have `RawPtrKind::FakeForPtrMetadata`, we can reimplement `Rvalue::Len` using `PtrMetadata(&raw const (fake) place)`.

r? ``@scottmcm``
2025-09-17 14:56:48 +10:00
Stuart Cook
577f18ffe2 Rollup merge of #146552 - cjgillot:resume-noremap, r=jackh726
StateTransform: Do not renumber resume local.

MIR parameters are not explicitly assigned-to when entering the MIR body. If we want to save their values inside the coroutine state, we need to do so explicitly.

This was done by renaming the `_2` local, and introducing an explicit assignment pre-transform. This particular trick confuses me.

This version makes explicit that we are assigning parameters to saved locals.

r? ``@dingxiangfei2009``
2025-09-17 14:56:47 +10:00
Stuart Cook
79f8acb45b Rollup merge of #146259 - camsteffen:remove-the-box, r=jackh726
Suggest removing Box::new instead of unboxing it
2025-09-17 14:56:45 +10:00
Stuart Cook
c2e8264b34 Rollup merge of #145838 - dianne:non-extending-super-let, r=jackh726,traviscross
don't apply temporary lifetime extension rules to non-extended `super let`

Reference PR: rust-lang/reference#1980

This changes the semantics for `super let` (and macros implemented in terms of it, such as `pin!`, `format_args!`, `write!`, and `println!`) as suggested by ````@theemathas```` in https://github.com/rust-lang/rust/issues/145784#issuecomment-3218658335, making `super let` initializers only count as [extending expressions](https://doc.rust-lang.org/nightly/reference/destructors.html#extending-based-on-expressions) when the `super let` itself is within an extending block. Since `super let` initializers aren't temporary drop scopes, their temporaries outside of inner temporary scopes are effectively always extended, even when not in extending positions; this only affects two cases as far as I can tell:
- Block tail expressions in Rust 2024. This PR makes `f(pin!({ &temp() }))` drop `temp()` at the end of the block in Rust 2024, whereas previously it would live until after the call to `f` because syntactically the `temp()` was in an extending position as a result of `super let` in `pin!`'s expansion.
- `super let` nested within a non-extended `super let` is no longer extended. i.e. a normal `let` is required to treat `super let`s as extending (in which case nested `super let`s will also be extending).

Closes rust-lang/rust#145784

This is a breaking change. Both static and dynamic semantics are affected. The most likely breakage is for programs to stop compiling, but it's technically possible for drop order to silently change as well (as in rust-lang/rust#145784). Since this affects stable macros, it probably would need a crater run.

Nominating for discussion alongside rust-lang/rust#145784: ````@rustbot```` label +I-lang-nominated +I-libs-api-nominated

Tracking issue for `super let`: rust-lang/rust#139076
2025-09-17 14:56:45 +10:00
Stuart Cook
6ad98750e0 Rollup merge of #145660 - jbatez:darwin_objc, r=jdonszelmann,madsmtm,tmandry
initial implementation of the darwin_objc unstable feature

Tracking issue: https://github.com/rust-lang/rust/issues/145496

This feature makes it possible to reference Objective-C classes and selectors using the same ABI used by native Objective-C on Apple/Darwin platforms. Without it, Rust code interacting with Objective-C must resort to loading classes and selectors using costly string-based lookups at runtime. With it, these references can be loaded efficiently at dynamic load time.

r? ```@tmandry```

try-job: `*apple*`
try-job: `x86_64-gnu-nopt`
2025-09-17 14:56:44 +10:00
Stuart Cook
f21a9c94cf Rollup merge of #145181 - Borgerr:remove-fixme-from-has-sigdrop, r=lcnr
remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

321a89bec5/compiler/rustc_middle/src/ty/util.rs (L1378-L1389)

Closes rust-lang/rust#86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
2025-09-17 14:56:43 +10:00
Stuart Cook
f104ecfba6 Rollup merge of #145071 - cuviper:min-llvm-20, r=nikic
Update the minimum external LLVM to 20

With this change, we'll have stable support for LLVM 20 and 21.
For reference, the previous increase to LLVM 19 was rust-lang/rust#139275.

cc ```@rust-lang/wg-llvm```
r? nikic
2025-09-17 14:56:43 +10:00
Camille Gillot
eddd755f28 Bless ui. 2025-09-16 22:58:54 +00:00
Camille Gillot
fe3a784ef2 Do not renumber resume local. 2025-09-16 22:50:32 +00:00
Camille Gillot
40d879a47f Add test. 2025-09-16 22:50:32 +00:00
Camille Gillot
de73af9ec4 Add test. 2025-09-16 22:44:35 +00:00
Camille Gillot
53b91ea87f Remove Rvalue::Len. 2025-09-16 22:23:19 +00:00
Camille GILLOT
44c1a00a2f Enable DestinationPropagation by default. 2025-09-16 22:08:02 +00:00
bors
3f1552a273 Auto merge of #146650 - matthiaskrgr:rollup-rjrklz9, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146442 (Display ?Sized, const, and lifetime parameters in trait item suggestions across a crate boundary)
 - rust-lang/rust#146474 (Improve `core::ascii` coverage)
 - rust-lang/rust#146605 (Bump rustfix 0.8.1 -> 0.8.7)
 - rust-lang/rust#146611 (bootstrap: emit hint if a config key is used in the wrong section)
 - rust-lang/rust#146618 (Do not run ui test if options specific to LLVM are used when another codegen backend is used)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-16 21:53:05 +00:00
Josh Stone
e54602c5bb Merge similar output checks in assembly-llvm/x86_64-cmp 2025-09-16 11:49:21 -07:00
Josh Stone
580b4891aa Update the minimum external LLVM to 20 2025-09-16 11:49:20 -07:00
bors
a9d0a6f155 Auto merge of #138271 - mu001999-contrib:fix-138234, r=jackh726
Keep space if arg does not follow punctuation when lint unused parens

Fixes rust-lang/rust#138234

If the arg follows punctuation, still pass `left_pos` with `None` and no space will be added, else then pass `left_pos` with `Some(arg.span.lo())`, so that we can add the space as expected.

And `emit_unused_delims` can make sure no more space will be added if the expr follows space.

---

Edited:

Directly use the `value_span` to check whether the expr removed parens will follow identifier or be followed by identifier.
2025-09-16 18:43:49 +00:00
Matthias Krüger
b1a724626b Rollup merge of #146605 - jyn514:update-rustfix, r=nnethercote
Bump rustfix 0.8.1 -> 0.8.7

This commit can be replicated by running `cargo update -p rustfix --precise 0.8.7 && x test ui --bless`.

---

The reasons this affects UI tests is as follows:
- The UI test suite runs rustc with `-Z deduplicate-diagnostics=no --error-format=json`, which means that rustc emits multiple errors containing identical suggestions. That caused the weird-looking code that had multiple `X: Copy` suggestions.
- Those suggestions are interpreted not by rustc itself, but by the `rustfix` library, maintained by cargo but published as a separate crates.io library and used by compiletest.
- Sometime between rustfix 0.8.1 and 0.8.7 (probably in rust-lang/cargo#14747, but it's hard to tell because rustfix's versioning doesn't match cargo's), rustfix got smarter and stopped applying duplicate suggestions.

Update rustfix to match cargo's behavior. Ideally, we would always share a version of rustfix between cargo and rustc (perhaps with a path dependency?), to make sure we are testing the behavior we ship. But for now, just manually update it to match.

Note that the latest version of rustfix published to crates.io is 0.9.1, not 0.8.7. But 0.9.1 is not the version used in cargo, which is 0.9.3. Rather than trying to match versions exactly, I just updated rustfix to the latest in the 0.8 branch.
2025-09-16 20:42:23 +02:00
Matthias Krüger
a811bb631a Rollup merge of #146442 - Qelxiros:trait-suggestion-generics, r=BoxyUwU
Display ?Sized, const, and lifetime parameters in trait item suggestions across a crate boundary

context: rust-lang/rust#145929

This fixes the MetaSized issue and adds const generics and early bound lifetimes. Late bound lifetimes are harder because they aren't returned by `generics_of`. I'm going to look into it, but there's no guarantee I'll be successful.

Fixes https://github.com/rust-lang/rust/issues/146404.

r? `@BoxyUwu`
2025-09-16 20:42:22 +02:00
Esteban Küber
e9270e3cba Detect top-level ... in argument type
When writing something like the expression `|_: ...| {}`, we now detect the `...` during parsing explicitly instead of relying on the detection in `parse_ty_common` so that we don't talk about "nested `...` are not supported".

```
error: unexpected `...`
  --> $DIR/no-closure.rs:6:35
   |
LL | const F: extern "C" fn(...) = |_: ...| {};
   |                                   ^^^
   |
   = note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
```
2025-09-16 11:38:08 -07:00
Folkert de Vries
401857aaa1 cmse: fix 'region variables should not be hashed' 2025-09-16 20:30:37 +02:00
Esteban Küber
8306a2f02e Reword note 2025-09-16 11:24:51 -07:00
Esteban Küber
ed85f9846d remove redundant test 2025-09-16 11:21:29 -07:00
Tawan Muadmuenwai
6912631d3e Add span for struct tail recursion limit error 2025-09-16 23:04:59 +07:00
Jeremy Smart
1a1510816a handle const generics, ?Sized, early bound lifetimes 2025-09-16 10:17:25 -04:00
Mu001999
9991ec282f Keep space if expr follows identifier when lint unused parens 2025-09-16 11:31:59 +00:00
Joe Birr-Pixton
325ceef018 Fix other uses of "adaptor" 2025-09-16 11:58:12 +01:00
bors
eec6bd9d69 Auto merge of #146516 - cjgillot:dest-prop-aggregate, r=Amanieu
DestinationPropagation: avoid creating overlapping assignments.

r? `@Amanieu`

Fixes https://github.com/rust-lang/rust/issues/146383
2025-09-16 09:18:32 +00:00
Folkert de Vries
8b752cb37d fix issue with cmse-nonsecure-entry ABI being both async and c-variadic 2025-09-16 10:23:07 +02:00
Cameron Steffen
d66fb4910f Suggest removing Box::new 2025-09-16 04:22:50 -04:00
bors
8a1b39995e Auto merge of #146614 - Zalathar:rollup-hcxvdi1, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#145095 (Migrate `UnsizedConstParamTy`  to unstable impl of `ConstParamTy_`)
 - rust-lang/rust#145960 (Split `FnCtxt::report_args_error` into subfunctions)
 - rust-lang/rust#146402 (interpret: fix overlapping aggregate initialization)
 - rust-lang/rust#146466 (llvm-wrapper: other cleanup)
 - rust-lang/rust#146574 (compiletest: Enable new-output-capture by default)
 - rust-lang/rust#146599 (replace some `#[const_trait]` with `const trait`)
 - rust-lang/rust#146601 (compiletest: Make `./x test --test-args ...` work again)
 - rust-lang/rust#146608 (improve internal bootstrap docs)
 - rust-lang/rust#146609 (bootstrap: lower verbosity of cargo to one less than bootstrap's)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-16 04:26:18 +00:00
Jules Bertholet
9e2f9edd7f Don’t suggest foreign doc(hidden) types in E0277 diagnostics 2025-09-15 21:52:56 -04:00
Stuart Cook
edd6721583 Rollup merge of #145095 - tiif:unstable_const_param, r=BoxyUwU
Migrate `UnsizedConstParamTy`  to unstable impl of `ConstParamTy_`

Now that we have ``#[unstable_feature_bound]``, we can remove ``UnsizedConstParamTy`` that was meant to be an unstable impl of stable type and ``ConstParamTy_`` trait.

r? `@BoxyUwU`
2025-09-16 10:25:38 +10:00
Matthias Krüger
070456bccf Rollup merge of #146559 - Jules-Bertholet:fix-typo, r=nnethercote
Fix typo in error message
2025-09-15 22:09:50 +02:00
Matthias Krüger
f34e30affa Rollup merge of #146530 - a4lg:riscv-inline-asm-default-clobber-float-flags, r=Amanieu
rustc_codegen_llvm: Adjust RISC-V inline assembly's clobber list

Despite that the `fflags` register (representing floating point exception flags) is stated as a flag register [in the reference](https://doc.rust-lang.org/reference/inline-assembly.html#r-asm.rules.preserved-registers), it's not
in the default clobber list of the RISC-V inline assembly and it would be better to fix it.
2025-09-15 22:09:47 +02:00
Matthias Krüger
bcdb3eeeff Rollup merge of #146344 - Gelbpunkt:loongarch-codegen-llvm-test, r=Mark-Simulacrum
tests/codegen-llvm: Make rust-abi-arch-specific-adjustment portable

This test currently only runs on RISC-V and loongarch hosts, but assumes that the host target is the -gnu target. By using minicore, we can run this test on all host targets, regardless of architecture, as long as the LLVM components are built.
This also fixes this test on musl hosts of these architectures (though I've only tested on loongarch64-unknown-linux-musl).
2025-09-15 22:09:47 +02:00
ash
fa7e474f9c remove FIXME from has_significant_drop, replaced with checking non_region_infer 2025-09-15 13:55:20 -06:00
Aapo Alasuutari
c4a87eb62c fix: Move CoerceShared into ops 2025-09-15 20:50:00 +03:00