17598 Commits

Author SHA1 Message Date
bors c935696dd0 Auto merge of #155487 - ShoyuVanilla:canon-ph, r=lcnr
Canonicalize free regions from inputs as placeholders in root univ



Context: The box named *coroutine witness Send lifetime requirements now considered by leakcheck* [this roadmap](https://raw.githubusercontent.com/hexcatnl/roadmap/e380fef94b47c02a056b4c8f05124a9db475b990/next-solver.svg)

Fixes (only for the next-solver) rust-lang/rust#106569 
Prerequisite of https://github.com/rust-lang/rust/pull/155749
2026-04-29 13:17:37 +00:00
Shoyu Vanilla f2ae894662 Canonicalize free regions from inputs as placeholders in root univ 2026-04-29 13:13:04 +09:00
Shoyu Vanilla (Flint) 7ffff36037 Rollup merge of #155947 - SynapLink:cleanup/check-pass-variance-tests, r=nnethercote
tests: mark simple UI tests as check-pass

This changes 14 simple UI tests from build-pass to check-pass.

These tests cover type checking, trait bounds, closure inference, deprecation diagnostics, dyn compatibility, and variance. They do not need codegen or linking, so check-pass keeps the intended coverage while removing old FIXME(62277) markers.
2026-04-29 10:40:49 +09:00
Shoyu Vanilla (Flint) 037b1e1746 Rollup merge of #155922 - cyrgani:no-dead-aux-files, r=jieyouxu
delete unused auxiliary test files

Related issue for detecting these properly: https://github.com/rust-lang/rust/issues/133914.
2026-04-29 10:40:48 +09:00
Shoyu Vanilla (Flint) dce5b97c52 Rollup merge of #155648 - ShoyuVanilla:maybe-stalled-on-couroutines, r=lcnr
`-Znext-solver` Propagate `stalled_on_coroutines` as a field in `Certainty::Maybe`

..instead of collecting them with a `ProofTreeVisitor`

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/270
2026-04-29 10:40:46 +09:00
Shoyu Vanilla (Flint) 5d26634476 Rollup merge of #152443 - kjetilkjeka:nvptx_drop_support_old_hw_and_isa, r=ZuseZ4
NVPTX: Drop support for old architectures and old ISAs

This is the implementation of [this MCP](https://github.com/rust-lang/compiler-team/issues/965#issuecomment-3837320262)

I believe it was said that no FCP was needed, but if that is incorrect then the FCP is anyway scheduled to finish in 2 days so it can in any case be merged then.
2026-04-29 10:40:46 +09:00
SynapLink b19b0e5629 tests: mark simple UI tests as check-pass 2026-04-28 23:10:46 +02:00
Jonathan Brouwer f7f266b2b1 Rollup merge of #155907 - oli-obk:push-nypowoyskzxp, r=Kivooeo
Handle hkl const closures

I severely overthought this in rust-lang/rust#153818 😆

The const closure trait solver impl is now in sync with the non-const closure trait solver impl.
2026-04-28 20:24:36 +02:00
Jonathan Brouwer c6912bf401 Rollup merge of #155692 - fneddy:fix_naked-dead-code-elimination, r=folkertdev
disable naked-dead-code-elimination test if no RET mnemonic is available

this test emit x86_64 specific ret asm instruction and should not be compiled on any other arch.
2026-04-28 20:24:33 +02:00
Jonathan Brouwer 8ee783610d Rollup merge of #154325 - WeiTheShinobi:tweak-let-else-output, r=davidtwco
Tweak irrefutable let else warning output

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

Greeting!
This PR tweak diagnostic output for `irrefutable-let-else` patterns and adds a check for `let a = Some(b) else {...}`
Thanks for the review!

```
help: consider using `let Some(name) = case` to match on a specific variant
   |
LL -     let name = Some(case) else {
LL +     let Some(name) = case else {
   |
```
2026-04-28 20:24:30 +02:00
Shoyu Vanilla 25c241c1b0 Propagate stalled_on_coroutines as a field in Certainty::Maybe 2026-04-29 02:28:38 +09:00
cyrgani 5f066e9467 delete unused auxillary test files 2026-04-28 12:22:02 +00:00
bors 03c609abb6 Auto merge of #155911 - jhpratt:rollup-DOR0YN1, r=jhpratt
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#155381 (Fix a bug in `ChunkedBitSet::subtract`)
 - rust-lang/rust#155847 (Don't reload length in String::push)
 - rust-lang/rust#155858 (`slice::join`: borrow only once during length calc)
 - rust-lang/rust#155879 (enable pipe tests in Miri)
 - rust-lang/rust#155905 (Update LLVM to 22.1.4 (again))
 - rust-lang/rust#155247 ([AIX] update linker default to bcdtors)
 - rust-lang/rust#155812 ([codex] tests: mark migrated UI tests as check-pass)
 - rust-lang/rust#155854 (Rename the diagnostic item for `std::sync::mpsc::Receiver`)
 - rust-lang/rust#155882 (Add regression test for rust-lang/rust#101363)
2026-04-28 10:50:47 +00:00
Jacob Pratt 8759017b1f Rollup merge of #155882 - pluiee:pluiee/101363-test, r=mu001999
Add regression test for #101363

Adds test for rust-lang/rust#101363

Since it's my first time adding tests, I'm not sure if the test itself, its location, or its name are appropriate.
2026-04-28 05:37:27 -04:00
Jacob Pratt 5216be311d Rollup merge of #155812 - SynapLink:codex/check-pass-fixme-62277, r=petrochenkov
[codex] tests: mark migrated UI tests as check-pass

## Summary

Migrate a small set of UI tests left behind by the `compile-pass` migration from `build-pass` to `check-pass`.

These tests exercise attributes, cfg_attr, range trait type checking, and reachable-code diagnostics. None of the changed tests need codegen or linking, so `check-pass` matches the intended coverage and removes the stale `FIXME(#62277)` notes.

## Validation

- `python x.py test tests/ui/attributes/attr-before-view-item.rs tests/ui/attributes/attr-before-view-item2.rs tests/ui/attributes/attr-mix-new.rs tests/ui/attributes/class-attributes-1.rs tests/ui/attributes/class-attributes-2.rs tests/ui/attributes/method-attributes.rs tests/ui/attributes/unrestricted-attribute-tokens.rs tests/ui/attributes/variant-attributes.rs tests/ui/conditional-compilation/cfg-attr-multi-false.rs tests/ui/conditional-compilation/cfg-attr-multi-true.rs tests/ui/range/range_traits-4.rs tests/ui/range/range_traits-5.rs tests/ui/range/range_traits-7.rs tests/ui/reachable/expr_andand.rs tests/ui/reachable/expr_oror.rs`
- `python x.py test tidy`
2026-04-28 05:37:26 -04:00
Oli Scherer b465c5642b Handle hkl const closures 2026-04-28 10:36:32 +02:00
Oli Scherer 4d4058bfb4 Add regression test for hkl const closures 2026-04-28 10:27:20 +02:00
Eddy (Eduard) Stefes 2a8e588c90 Add --print=backend-has-mnemonic and needs-asm-mnemonic directive
Add infrastructure to query LLVM backend for specific assembly mnemonics
and use it in compiletest to conditionally run tests based on instruction
availability.

This fixes test failures with naked-dead-code-elimination which requires
the `RET` mnemonic.

Co-authored-by: Folkert de Vries <flokkievids@gmail.com>
2026-04-28 10:21:15 +02:00
bors 4ddb0b7f8e Auto merge of #155329 - nnethercote:rm-WithCachedTypeInfo-stable_hash, r=oli-obk
Remove `WithCachedTypeInfo::stable_hash`.



We store a stable hash value in the most common interned values (e.g. types, predicates, regions). This is 16 bytes of data.
- In non-incremental builds it's a straightforward performance loss: the stable hash isn't computed or used, and the 16 bytes of space goes to waste (but it still gets hashed when interning).
- In incremental builds it avoids some hashing but doesn't seem to actually be a genuine performance win, and the complexity doesn't seem worth it.

r? @oli-obk
2026-04-28 07:33:06 +00:00
Kjetil Kjeka a2d23cec5f NVPTX: Drop support for old hw and old ISAs 2026-04-28 08:48:22 +02:00
Jacob Pratt 6960391407 Rollup merge of #155900 - theemathas:fndef-is-function-item, r=Kivooeo
Refer to `FnDef` as "function item", not "function pointer"
2026-04-28 00:12:12 -04:00
Jacob Pratt a288e8c9d6 Rollup merge of #155897 - wesleywiser:test_83060, r=jieyouxu
Add regression test for LLVM bug with huge stack frames

Regression test for https://github.com/rust-lang/rust/issues/83060

Closes rust-lang/rust#83060
2026-04-28 00:12:12 -04:00
Tim (Theemathas) Chirananthavat 6f2e501526 Refer to FnDef as "function item", not "function pointer" 2026-04-28 10:50:42 +07:00
Wesley Wiser 88922e3d11 Add regression test for LLVM bug with huge stack frames
Regression test for https://github.com/rust-lang/rust/issues/83060
2026-04-27 20:14:10 -05:00
bors b20956b0f4 Auto merge of #155890 - JonathanBrouwer:rollup-XcHVBe9, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#154510 (Partially stabilize LoongArch target features)
 - rust-lang/rust#155137 (Allow trailing `self` in more contexts)
 - rust-lang/rust#155513 (rustc_public: implement `Pattern` type)
 - rust-lang/rust#155702 (Change `ItemKind::Trait` to a field variant.)
 - rust-lang/rust#154896 (Fix ICE: Scalar layout for non-primitive non-enum type unsafe binder)
 - rust-lang/rust#155675 (Disallow non_exhaustive structs and enums with non_exhaustive variants from implementing `ConstParamTy`)
 - rust-lang/rust#155874 (Avoid misleading closure return type note)
 - rust-lang/rust#155876 (CI: rfl: move job forward to Linux v7.1-rc1)
2026-04-27 21:47:07 +00:00
SynapLink d7184b76a7 tests: remove obsolete class attribute tests 2026-04-27 20:43:24 +02:00
Jonathan Brouwer 3a532d6445 Rollup merge of #155874 - chenyukang:yukang-fix-155770-return-note-inner-block, r=wesleywiser
Avoid misleading closure return type note

A follow up fix for rust-lang/rust#155670, fix a missed case https://github.com/rust-lang/rust/pull/155770#discussion_r3145506170

r? @wesleywiser

cc @A4-Tacks
2026-04-27 19:54:49 +02:00
Jonathan Brouwer 76a502d358 Rollup merge of #155675 - zedddie:disallow-non_exhaustive-adt-const-params, r=BoxyUwU
Disallow non_exhaustive structs and enums with non_exhaustive variants from implementing `ConstParamTy`

tracking issue rust-lang/rust#154042

r? BoxyUwU
2026-04-27 19:54:48 +02:00
Jonathan Brouwer e683a17f80 Rollup merge of #154896 - cijiugechu:fix-unsafe-binder-layout-ice, r=TaKO8Ki
Fix ICE: Scalar layout for non-primitive non-enum type unsafe binder

`UnsafeBinder` uses the inner layout, but the debug layout check still looked at the outer type. Check the inner type first so this does not ICE.

Tracking issue: rust-lang/rust#130516
Closes: rust-lang/rust#154426
2026-04-27 19:54:47 +02:00
Jonathan Brouwer 56c2ab64e9 Rollup merge of #155137 - mu001999-contrib:self-at-end, r=petrochenkov
Allow trailing `self` in more contexts

Reference PR:

- https://github.com/rust-lang/reference/pull/2237

As a follow-up PR to https://github.com/rust-lang/rust/pull/152996, after this PR:
1. Trailing `self` can appear in paths
2. [E0429](https://doc.rust-lang.org/stable/error_codes/E0429.html#error-code-e0429) will be no longer emitted, `use ...::self [as target];` will be equivalent to `use ...::{self [as target]};`

r? petrochenkov
2026-04-27 19:54:44 +02:00
bors 52b6e2c208 Auto merge of #155760 - GuillaumeGomez:rm-attributelintkind, r=JonathanBrouwer,petrochenkov
Remove `AttributeLintKind`



Part of https://github.com/rust-lang/rust/issues/153099.

The `AttributeLintKind` type is finally gone! \o/

Diff is this big because I moved a file and a lot of `Diagnostic` types. :')

r? @JonathanBrouwer
2026-04-27 17:49:21 +00:00
Guillaume Gomez faecc47eab Update triagebot.toml file to take into account the moved file
Create a new `SharedContext::emit_dyn_lint_with_sess` method to simplify code when `Session` is not needed
Remove crate name from `UnexpectedCfgCargoMacroHelp`
2026-04-27 17:57:55 +02:00
SangHun Kim 612afd1b49 Add regression test 2026-04-28 00:53:31 +09:00
Jonathan Brouwer f13610a4b5 Rollup merge of #155865 - lcnr:add-test, r=lqd
add test for accidentally fixed `binius_field` issue

cc https://github.com/rust-lang/rust/pull/153614#issuecomment-4281857186

r? @lqd
2026-04-27 14:44:20 +02:00
Jonathan Brouwer 30f08d3ab2 Rollup merge of #155864 - JonathanBrouwer:doc-attr-span, r=GuillaumeGomez
Fix panic for doc attributes on where predicates

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

r? @GuillaumeGomez
2026-04-27 14:44:19 +02:00
Jonathan Brouwer 2cd70607e7 Rollup merge of #155355 - erickt:trait-solver-hang, r=lcnr
Fix pathological performance in trait solver cycles with errors

Fuchsia's Starnix system has had a multi-year long bug where occasionally a typo could cause the rust compiler to take 10+ hours to report an error (see rust-lang/rust#136516 and rust-lang/rust#150907). This was particularly hard to trace down since Starnix's codebase is massive, over 384 thousand lines as of writing.

With the help of treereduce, cargo-minimize, and rustmerge, after about a month of running we reduced it down to a couple [lines of code], which only takes about 35 seconds to report an error on my machine. The bug also appears to happen with `-Z next-solver=no` and `-Z next-solver=coherence`, but does not occur with `-Z next-solver` or `-Z next-solver=globally`.

I used Gemini to help diagnose the problem and proposed solution (which is the one proposed in this patch):

1. The trait solver gets stuck in an exponential loop evaluating auto-trait bounds (like Send and Sync) on cyclic types that contain compilation errors (TyKind::Error).

2. Normally, if the solver detects a cycle, it prevents the result from being stored in the Global Cache because the result depends on the current evaluation stack. However, when an error is involved, the depth tracking gets pinned to a low value, forcing the solver to rely on the short-lived Provisional Cache. Since the provisional cache is cleared between high-level iterations of the fulfillment loop, the solver ends up re-discovering and re-evaluating the same large cycle thousands of times.

3. Allow global caching of results even if they appear stack-dependent, provided that the inference context is already "tainted by errors" (`self.infcx.tainted_by_errors().is_some()`). This violates the strict invariant that global cache entries shouldn't depend on the stack, but it is safe because the compilation is already guaranteed to fail due to the presence of errors. Prioritizing compiler responsiveness and termination over perfect correctness in error states is the correct trade-off here.

I added the reduction as the test case for this. However, I don't see an easy way to catch if this bug comes back. Should we add some way to timeout the test if it takes longer than 10 seconds to compile? That could be a source of flakes though.

I don't have any experience with the trait solver code, but I did try to review the code to the best of my ability. This approach seems a bit of a bandaid to the solution, but I don't see a better solution. We could try to teach the solver to not clear the provisional cache in this circumstance, but I suspect that'd be a pretty invasive change.

I'm guessing if this does cause problems, it might report an incorrect error, but I (and Gemini) were unable to come up with an example that reported a different error with and without this fix.

Resolves rust-lang/rust#150907

[lines of code]: https://gist.github.com/erickt/255bc4006292cac88de906bd6bd9220a
2026-04-27 14:44:18 +02:00
yukang 7616881793 Avoid misleading closure return type note 2026-04-27 18:57:50 +08:00
lcnr 23abf90ff8 add test 2026-04-27 10:05:57 +02:00
Jonathan Brouwer 75fa098069 Add test for existing bug 2026-04-27 09:53:10 +02:00
Jonathan Brouwer 71ef1fafe0 Rewrite check_invalid_where_predicate_attrs 2026-04-27 09:53:10 +02:00
Jacob Pratt 6897624a46 Rollup merge of #155772 - oli-obk:const-closures-everywhere, r=fee1-dead
Check closure's constness validity in the constness query

fixes rust-lang/rust#155584

instead of checking during ast lowering, where it's not easily possible to obtain all the right information in time. While lowering an assoc item we don't know if the parent was a const trait or a const impl. Tracing this information is quite annoying, and complicates a lot of code, which checking here after the fact is trivial.
2026-04-27 03:48:43 -04:00
mu001999 d93395c3ff Remove the special case of ::self after edition 2018 2026-04-27 14:02:25 +08:00
mu001999 ddb2721075 Add test for middle self 2026-04-27 14:02:25 +08:00
mu001999 8b584ebcf6 Remove type_ns_only 2026-04-27 14:02:25 +08:00
mu001999 4467940555 Support trailing self in normal paths 2026-04-27 14:02:22 +08:00
Oli Scherer 8e1c34f5cc Check closure's constness validity in the constness query
instead of during ast lowering, where it's not easily possible to obtain all the right information in time
2026-04-27 07:44:19 +02:00
Oli Scherer 2b2f28d0ea Add regression test 2026-04-27 07:43:46 +02:00
mu001999 d5a26d811b Support trailing self in import paths 2026-04-27 10:58:30 +08:00
Jacob Pratt 78569d8d6a Rollup merge of #155770 - chenyukang:yukang-fix-155670-closure-return-note, r=wesleywiser
Avoid misleading closure return type note

Fixes rust-lang/rust#155670
2026-04-26 21:56:44 -04:00
Jacob Pratt 9562f3da2d Rollup merge of #155682 - Unique-Usman:ua/box-impl, r=mejrs
Add boxing suggestions for `impl Trait` return type mismatches

A sort of a follow up pr to this -> https://github.com/rust-lang/rust/pull/155546
2026-04-26 21:56:43 -04:00