Commit Graph

325232 Commits

Author SHA1 Message Date
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 8f15da4d30 Rollup merge of #155361 - Darksonn:abi-cfi, r=RalfJung
Document that CFI diverges from Rust wrt. ABI-compatibility rules

The CFI sanitizer is a sanitizer that checks that no ABI-incompatible function calls are made at runtime, but there is currently an unfortunate divergence between the Rust ABI-compatibility rules and what the CFI sanitizer checks. Thus, document that this divergence exists.

There are proposals for how we can align the ABI rules to eliminate this discrepancy, and I would like to follow through with those, but for now I think we can at least document that the discrepancy exists.

For further discussion please see [Re-evaluate ABI compatibility rules in light of CFI](https://github.com/rust-lang/unsafe-code-guidelines/issues/489) and [Can CFI be made compatible with type erasure schemes?](https://github.com/rust-lang/rust/issues/128728) and [`fn_cast!` macro](https://github.com/rust-lang/rust/issues/140803).

cc @rcvalle @samitolvanen @maurer @bjorn3 @RalfJung

Rendered:

<img width="956" height="391" alt="image" src="https://github.com/user-attachments/assets/410d3eaa-9476-4800-9ef8-bbb100a100c5" />
2026-04-28 20:24:32 +02:00
Jonathan Brouwer 22967dff41 Rollup merge of #155273 - zetanumbers:create_crate_num_lock, r=jdonszelmann
Lock stable_crate_ids once in create_crate_num

This is a small refactor PR removing redundant locks of `stable_crate_ids` from  `create_crate_num`.
2026-04-28 20:24:32 +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
Jonathan Brouwer 1857d2ee9f Rollup merge of #151994 - davidtwco:v0-mangling-on-stable, r=wesleywiser
switch to v0 mangling by default on stable

Following rust-lang/rust#89117, rustc has defaulted to the v0 mangling scheme by default (since Nov 20th 2025). This surfaced two bugs:

- rust-lang/rust#138261 was a small ICE (found via fuzzing) where an implementation-internal namespace was missing for global assembly - this occurs with names instantiated within global assembly (that can happen inside constants)

- rust-lang/rust#134479 only occurs with unstable `generic_const_exprs`

Since there have been three-to-four months for users to find bugs with this mangling scheme on nightly, that the scheme has been waiting many years to be stabilised, and has been used successfully internally at Microsoft, Meta and Google for many years, this patch proposes stabilising the v0 mangling scheme on stable.

This patch does not propose removing the legacy mangling, it will remain usable on nightly as an escape-hatch if there are remaining bugs (though admittedly it would require switching to nightly for those on stable) - it is anticipated that this would be unlikely given current testing undergone by v0. Legacy mangling can be removed in another follow-up.

r? @wesleywiser
2026-04-28 20:24:29 +02:00
Jonathan Brouwer 7f76b8bbb6 Rollup merge of #155850 - scottmcm:tweak_niche_assignment, r=mati865
Only exclude the #155473 change for 1-byte bool-likes

That's the thing we handle differently in codegen (see `to_immediate_scalar`) so if the other ones are fine, that helps narrow it down further.

cc https://github.com/rust-lang/rust/pull/155473
2026-04-28 20:24:29 +02:00
Jonathan Brouwer eac6db9677 Rollup merge of #155930 - folkertdev:sync-from-portable-simd-2026-04-28, r=folkertdev
Sync from portable simd 2026 04 28

r? calebzulawski (I'll self-approve if CI looks good)
2026-04-28 20:24:28 +02:00
Jonathan Brouwer 1321a67385 Rollup merge of #155923 - bjorn3:sync_cg_clif-2026-04-28, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlights this time are a Cranelift update and fixing backtraces for arm64 macOS (x86_64 macOS is still broken).

r? @ghost

@rustbot label +A-codegen +A-cranelift +T-compiler +subtree-sync
2026-04-28 20:24:27 +02:00
Folkert de Vries 631e935763 Merge commit 'cc032ad5ed5b69d606c4eabbc9c9ae1f412ef2fb' into sync-from-portable-simd-2026-04-28 2026-04-28 17:17:28 +02:00
Alice Ryhl aef93ca43a Document that CFI diverges from Rust wrt. ABI-compatibility rules 2026-04-28 15:16:49 +00:00
Caleb Zulawski cc032ad5ed Merge pull request #525 from folkertdev/sync-from-rust-2026-04-28
Sync from rust 2026 04 28
2026-04-28 11:08:12 -04:00
Folkert de Vries b104260475 bump toolchain to nightly-2026-04-28 2026-04-28 16:50:33 +02:00
Folkert de Vries 82ee1e04c6 use larger ulps for log because it uses 2 inexact operations 2026-04-28 16:49:48 +02:00
Folkert de Vries 98f08d2a7a Merge branch 'rust-upstream-2026-04-28' into sync-from-rust-2026-04-28 2026-04-28 16:44:18 +02:00
bjorn3 45593d8abc Merge commit '3b6080cb20924f0c4f94e47bbbbfcae8b07d82e5' into sync_cg_clif-2026-04-28 2026-04-28 14:59:46 +02: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 f4d64bdd15 Rollup merge of #155854 - cammeresi:20260426-receiver-diag, r=mejrs
Rename the diagnostic item for `std::sync::mpsc::Receiver`

`MpscReceiver` aligns with `MpscSender`.  The original name appears to not actually have been in use, for better or worse.

r? mejrs
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
Jacob Pratt 0611bfcf16 Rollup merge of #155247 - daltenty:daltenty/bcdtors, r=davidtwco
[AIX] update linker default to bcdtors

The bcdtor mode affects how the AIX linker choose to pull in static constructors and destructors (https://www.ibm.com/docs/en/aix/7.2.0?topic=l-ld-command) to the link.

The current setting of all makes static init in archive members live regardless of if the archive member would be otherwise referenced, causing that whole archive member to become part of the link.

This default was initially retained for compatibility purposes with historical compilers on the platform which defaulted to this setting. Unfortunately this greedy pulling in of static init can have unintended consequences for applications, for example for programs linked against parts of compiler-rt which contain optional instrumentation (containing static initializers) which may be unused as these now become live in all programs regardless of use.

For that reason and similar reasons, this PR switches the default to mbr, which only extracts static init from archive members which would otherwise be referenced. This gives a behaviour very consistent with linkers on other platforms (e.g. Linux).

Users requiring the old default behaviour can manually pass `-bcdtors:all` on the link step which will override any default we pass here.

(Note: this mirrors LLVM change: https://github.com/llvm/llvm-project/pull/191265)
2026-04-28 05:37:25 -04:00
Jacob Pratt ca98fe1281 Rollup merge of #155905 - dianqk:update-llvm, r=nikic
Update LLVM to 22.1.4 (again)

https://github.com/rust-lang/rust/pull/155756 undoes https://github.com/rust-lang/rust/pull/155645.

cc @weihanglo

r? @nikic
2026-04-28 05:37:24 -04:00
Jacob Pratt 1952c34a78 Rollup merge of #155879 - RalfJung:miri-pipes, r=jhpratt
enable pipe tests in Miri
2026-04-28 05:37:24 -04:00
Jacob Pratt 06fa54768c Rollup merge of #155858 - ChrisDenton:borrowed-len, r=jhpratt
`slice::join`: borrow only once during length calc

This ensures the length calculation will always be self-consistent even if the real length changes when we actually come to use them.

This is a follow up to rust-lang/rust#155708
2026-04-28 05:37:23 -04:00
Jacob Pratt 8985f1f97b Rollup merge of #155847 - DaniPopes:string-push-len, r=jhpratt
Don't reload length in String::push

Same as in `Vec::push_mut`, we get `.len()` once at the start since it won't change in the `reserve()` call.

Saves reloading the length after the allocation: https://godbolt.org/z/W3G165Gd7
2026-04-28 05:37:22 -04:00
Jacob Pratt 4c592137d2 Rollup merge of #155381 - nnethercote:fix-ChunkedBitSet-subtract, r=Zalathar
Fix a bug in `ChunkedBitSet::subtract`

An operator precedence bug means an incorrect mask is used in `ChunkedBitSet::subtract`. Details in individual commits.

r? @dingxiangfei2009
2026-04-28 05:37:21 -04:00
bjorn3 3b6080cb20 Rustup to rustc 1.97.0-nightly (52b6e2c20 2026-04-27) 2026-04-28 10:58: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
dianqk cf8a60c20d Update LLVM to 22.1.4 2026-04-28 15:17:56 +08:00
bors b806d39f03 Auto merge of #155901 - jhpratt:rollup-R3JaeoO, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#155894 (triagebot: add myself to libs rotation)
 - rust-lang/rust#155897 (Add regression test for LLVM bug with huge stack frames)
 - rust-lang/rust#155900 (Refer to `FnDef` as "function item", not "function pointer")
2026-04-28 04:12:51 +00: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
Jacob Pratt fe51696fc8 Rollup merge of #155894 - nia-e:nia-triage-rotation, r=nia-e
triagebot: add myself to libs rotation

No harm helping out a little :D

r? me
2026-04-28 00:12:11 -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
Sidney Cammeresi 04874be3a2 Adjust diagnostic items for mpmc/mpsc Receiver and Sender
`MpscReceiver` aligns with `MpscSender`.  The original name appears to
not actually have been in use, for better or worse.

Along the way, sprinkle the attribute onto `mpmc::Receiver` and
`mpmc::Sender` too.
2026-04-27 17:16:09 -07:00
Nia Espera d52100ed43 triagebot.toml: add Nia to review rotation 2026-04-28 00:06:58 +02: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
Chris Denton b7424bac39 slice::join: borrow only once during length calc
This ensures the length calculation will always be self-consistent even if the real length changes when we actually come to use them.
2026-04-27 20:32:51 +00:00
SynapLink d7184b76a7 tests: remove obsolete class attribute tests 2026-04-27 20:43:24 +02:00
Jonathan Brouwer 5a87e1cadf Rollup merge of #155876 - ojeda:rfl, r=lqd
CI: rfl: move job forward to Linux v7.1-rc1

Linux v7.1 will have our new MSRVs: Rust 1.85.0 and `bindgen` 0.71.1.

r? @lqd @Kobzol
try-job: x86_64-rust-for-linux
@rustbot label A-rust-for-linux
@bors try
2026-04-27 19:54:50 +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 e8ad7f25e4 Rollup merge of #155702 - mejrs:itemkind_trait-fields, r=petrochenkov
Change `ItemKind::Trait` to a field variant.

This changes `ItemKind::Trait` from an octuple(!!) to an enum variant with fields. Their names were chosen to match up with existing usage and minimize renaming.

I'm leaning towards renaming `ident` to `name` as well; let me know if that's desired.
2026-04-27 19:54:46 +02:00
Jonathan Brouwer 8a0ee88963 Rollup merge of #155513 - makai410:rpub-pat, r=celinval
rustc_public: implement `Pattern` type

Fixes: https://github.com/rust-lang/project-stable-mir/issues/120
2026-04-27 19:54:45 +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
Jonathan Brouwer e8243d2979 Rollup merge of #154510 - heiher:stabilize-loongarch-target-features, r=Amanieu
Partially stabilize LoongArch target features

This PR stabilizes the following target features:

- div32
- lam-bh
- lamcas
- ld-seq-sa
- scq

Docs PR: https://github.com/rust-lang/reference/pull/2217

r? @Amanieu
2026-04-27 19:54:43 +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