Commit Graph

173154 Commits

Author SHA1 Message Date
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
Jonathan Brouwer ebbddb36f2 Rollup merge of #155768 - Zalathar:incremental, r=jieyouxu
compiletest: Overhaul the code for running an incremental test revision

The main goals of this overhaul are:
- Introduce a dedicated `IncrRevKind` enum for exhaustive matching.
- Eliminate any dependency on `PassMode` and `FailMode`.
- Use a single code path for all incremental revision kinds.

Separating incremental tests from the existing pass/fail enums should make it easier to overhaul the implementation of pass/fail expectations in UI tests.

---

Later on we might want to reintroduce more shared code paths for the different test modes, but for now the extra isolation makes it easier to clean up the individual modes.

r? jieyouxu
2026-04-28 20:24:35 +02:00
Jonathan Brouwer 57f2b15a53 Rollup merge of #155747 - arjunr2:main, r=davidtwco
Update documentation for `wasm32-wali-linux-musl` after integrating n…

Additional documentation updates, along with rust-lang/rust#155654
2026-04-28 20:24:34 +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 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 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
Alice Ryhl aef93ca43a Document that CFI diverges from Rust wrt. ABI-compatibility rules 2026-04-28 15:16:49 +00: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
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
dianqk cf8a60c20d Update LLVM to 22.1.4 2026-04-28 15:17:56 +08:00
Kjetil Kjeka a2d23cec5f NVPTX: Drop support for old hw and old ISAs 2026-04-28 08:48:22 +02: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
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 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 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
Miguel Ojeda 57008e9e3b 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.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-04-27 14:21:07 +02:00
Jacob Pratt d03a7c9bf6 Rollup merge of #155833 - ojeda:rfl, r=lqd
CI: rfl: move job forward to Linux v7.0

This version contains both of the workarounds we had, thus remove them as well.

r? @lqd @Kobzol
try-job: x86_64-rust-for-linux
@rustbot label A-rust-for-linux
@bors try
2026-04-27 03:48:44 -04:00
Jonathan Brouwer cafe02e1e3 Add first_span to doc attribute 2026-04-27 09:47:23 +02:00
Jacob Pratt f8e3af446e Rollup merge of #149624 - Flakebi:fix-lto, r=bjorn3
Fix requires_lto targets needing lto set in cargo

Targets that set `requires_lto = true` were not actually using lto when compiling with cargo by default. They needed an extra `lto = true` in `Cargo.toml` to work.

Fix this by letting lto take precedence over the `embed_bitcode` flag when lto is required by a target.

If both these flags would be supplied by the user, an error is generated. However, this did not happen when lto was requested by the target instead of the user.

Fixes rust-lang/rust#148514
Tracking issue: rust-lang/rust#135024
2026-04-26 21:56:39 -04:00
Jonathan Brouwer 37b53a9461 Rollup merge of #155789 - JonathanBrouwer:attribute-ext, r=mejrs
Cleanups to `AttributeExt`

r? @mejrs

- Makes some functions take `ast::Attribute` instead of `impl AttributeExt`
- Remove `deprecation_note` from `AttributeExt`, since the two implementations are basically seperate
2026-04-26 19:06:29 +02:00
Jonathan Brouwer a722bc89a0 Rollup merge of #155823 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/f3f6dca488fbfe482af4e5b6976677b6a68bda85.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-04-26 19:06:26 +02:00
Miguel Ojeda 1e6ba4f385 CI: rfl: move job forward to Linux v7.0
This version contains both of the workarounds we had, thus remove them
as well.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-04-26 17:49:24 +02:00
Ralf Jung 9ae47c9b53 Merge pull request #4812 from enthropy7/master
Support fstat on non-file-backed FDs
2026-04-26 11:23:07 +00:00
Ralf Jung c91a363db1 merge fstat and metadata functions 2026-04-26 12:59:02 +02:00
Miikka Salminen 33c1e869d7 Expand the initialism UCRT in rustc book
This commit expands the initialism UCRT on first use in the rusct book
chapter on the *-windows-gnullvm platform support, making the chapter
easier to understand. Microsoft, the originator of this technology in
Windows, expands it to Universal C Runtime[1]. The same expansion is
added to the chapter.

[1] https://learn.microsoft.com/en-us/cpp/porting/upgrade-your-code-to-the-universal-crt
2026-04-26 09:05:37 +03:00
Jonathan Brouwer dde4886801 Rollup merge of #146181 - Flakebi:dynamic-shared-memory, r=ZuseZ4,Sa4dus,workingjubilee,RalfJung,nikic,kjetilkjeka,kulst
Add intrinsic for launch-sized workgroup memory on GPUs

Workgroup memory is a memory region that is shared between all
threads in a workgroup on GPUs. Workgroup memory can be allocated
statically or after compilation, when launching a gpu-kernel.
The intrinsic added here returns the pointer to the memory that is
allocated at launch-time.

# Interface

With this change, workgroup memory can be accessed in Rust by
calling the new `gpu_launch_sized_workgroup_mem<T>() -> *mut T`
intrinsic.

It returns the pointer to workgroup memory guaranteeing that it is
aligned to at least the alignment of `T`.
The pointer is dereferencable for the size specified when launching the
current gpu-kernel (which may be the size of `T` but can also be larger
or smaller or zero).

All calls to this intrinsic return a pointer to the same address.

See the intrinsic documentation for more details.

## Alternative Interfaces

It was also considered to expose dynamic workgroup memory as extern
static variables in Rust, like they are represented in LLVM IR.
However, due to the pointer not being guaranteed to be dereferencable
(that depends on the allocated size at runtime), such a global must be
zero-sized, which makes global variables a bad fit.

# Implementation Details

Workgroup memory in amdgpu and nvptx lives in address space 3.
Workgroup memory from a launch is implemented by creating an
external global variable in address space 3. The global is declared with
size 0, as the actual size is only known at runtime. It is defined
behavior in LLVM to access an external global outside the defined size.

There is no similar way to get the allocated size of launch-sized
workgroup memory on amdgpu an nvptx, so users have to pass this
out-of-band or rely on target specific ways for now.

Tracking issue: rust-lang/rust#135516
2026-04-25 23:07:48 +02:00
Jonathan Brouwer e3b0e9db08 Remove deprecation_note from AttributeExt 2026-04-25 21:26:00 +02:00
Zalathar da0fe8db67 Overhaul the code for running an incremental test revision
The main goals of this overhaul are:
- Introduce a dedicated `IncrRevKind` enum for exhaustive matching.
- Eliminate any dependency on `PassMode` and `FailMode`.
- Use a single code path for all incremental revision kinds.

Separating incremental tests from the existing pass/fail enums should make it
easier to overhaul the implementation of pass/fail expectations in UI tests.
2026-04-25 17:28:27 +10:00
bors 7e0430fafc Auto merge of #155766 - jhpratt:rollup-EcXAaqS, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155643 (Improve suggestion for $-prefixed fragment specifiers)
 - rust-lang/rust#154197 (Avoid redundant clone suggestions in borrowck diagnostics)
 - rust-lang/rust#154372 (Exposing Float Masks)
 - rust-lang/rust#155680 (Handle index projections in call destinations in DSE)
 - rust-lang/rust#155732 (bootstrap: Don't clone submodules unconditionally in dry-run)
 - rust-lang/rust#155737 (Account for `GetSyntheticValue` failures)
 - rust-lang/rust#155738 (Pass fields to `is_tuple_fields` instead of `SBValue` object)
2026-04-25 06:41:56 +00:00
Jacob Pratt 84fd561f22 Rollup merge of #155738 - Walnut356:tuple_fields, r=jieyouxu
Pass fields to `is_tuple_fields` instead of `SBValue` object

straightforward fix for a logic error. `is_tuple_fields` expects a `list`, so we pass that in instead of the value object.

Coincidentally, this also fixes one of the 3 DI tests that fails on `x86_64-pc-windows-gnu` (`tests/debuginfo/union-smoke.rs`)
2026-04-25 01:21:54 -04:00
Jacob Pratt 0c27f91e04 Rollup merge of #155737 - Walnut356:getsyntheticvalue, r=jieyouxu
Account for `GetSyntheticValue` failures

`GetSyntheticValue` returns an invalid `SBValue` if no synthetic is present. That wasn't a problem before when we  were attaching synthetics to every type, but it won't be the case once github.com/rust-lang/rust/pull/155336 or similar lands. Additionally, codelldb subverts `lldb_commands` to apply similar behavior that doesn't attach synthetics to every type, so this fixes a regression there too.

Additionally, I removed 1 useless instance of `GetSyntheticValue`, since pointers should always be `IndirectionSyntheticProvider`, not `DefaultSyntheticProvider`.
2026-04-25 01:21:54 -04:00
Jacob Pratt 780e699707 Rollup merge of #155732 - ferrocene:jyn/dry-run, r=jieyouxu
bootstrap: Don't clone submodules unconditionally in dry-run

This made it very annoying to debug bootstrap itself, because every `--dry-run` invocation would start out by cloning LLVM, which is almost never necessary. Instead change a few Steps to properly support dry_run when no submodule is checked out.

I tested this by running all of `check`, `build`, `doc`, `dist`, `install`, `vendor`, `clippy`, `fix`, and `miri` with `--dry-run`.
2026-04-25 01:21:53 -04:00
Weihang Lo d439d07af2 Update cargo submodule 2026-04-24 17:43:12 -04:00
Arjun Ramesh c20757fd30 Add specific target diffs 2026-04-24 16:25:47 -04:00
bors 7c61a357e3 Auto merge of #155745 - JonathanBrouwer:rollup-D6OSAOt, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#149452 (Refactor out common code into a `IndexItem::new` constructor)
 - rust-lang/rust#155621 (Document #[diagnostic::on_move] in the unstable book.)
 - rust-lang/rust#155635 (delegation: rename `Self` generic param to `This` in recursive delegations)
 - rust-lang/rust#155730 (Some cleanups around per parent disambiguators)
 - rust-lang/rust#153537 (rustc_codegen_ssa: Define ELF flag value for sparc-unknown-linux-gnu)
 - rust-lang/rust#155219 (Do not suggest borrowing enclosing calls for nested where-clause obligations)
 - rust-lang/rust#155408 (rustdoc: Fix Managarm C Library name in cfg pretty printer)
 - rust-lang/rust#155571 (Enable AddressSanitizer on arm-unknown-linux-gnueabihf and armv7-unknown-linux-gnueabihf)
 - rust-lang/rust#155713 (test: Add a regression test for Apple platforms aborting on `free`)
 - rust-lang/rust#155723 (Fix tier level for 5 thumb bare-metal ARM targets)
 - rust-lang/rust#155735 (Fix typo by removing extra 'to')
 - rust-lang/rust#155736 (Remove `AllVariants` workaround for rust-analyzer)
2026-04-24 17:30:32 +00:00
mejrs 9515f52d61 Change ItemKind::Trait to have named fields. 2026-04-24 19:03:16 +02:00
enthropy7 058a8b9fa1 Support fstat on non-file-backed FDs 2026-04-24 20:02:41 +03:00
Arjun Ramesh 3c362ecfa6 Update documentation for wasm32-wali-linux-musl after integrating new LLVM 22 wasm32-linux-muslwali target changes 2026-04-24 12:20:54 -04:00
Jonathan Brouwer 39d5d45b9a Rollup merge of #155408 - teor2345:rustdoc-env-names, r=lolbinarycat
rustdoc: Fix Managarm C Library name in cfg pretty printer

Like rust-lang/rust#155293, this was introduced in https://github.com/rust-lang/rust/pull/154328.

Unlike that PR, I don't think there's any need to backport, because this cfg is not used anywhere in the standard library.
(I searched for `"mlibc"`, the only place it's used in rust-lang/rust is the HTML doc test.)

#### Other Minor Fixes

Remove a FIXME comment in the pretty printer, `os = "none"` is always bare metal:
https://github.com/rust-lang/rust/blob/d227e48c560e915fe7c0b8b3e821680a3a0ba739/compiler/rustc_target/src/spec/mod.rs#L3179

Fix a comment typo, ignore another typo in vendored sources.
2026-04-24 18:19:18 +02:00
Jonathan Brouwer e873839964 Rollup merge of #155621 - mejrs:document_diagnostic_on_move, r=chenyukang
Document #[diagnostic::on_move] in the unstable book.

Also adds the attribute on `std::fs::File` to stay consistent with the prose in the unstable book entry.

cc @estebank @rperier

Rendered:
<img width="791" height="903" alt="image" src="https://github.com/user-attachments/assets/a27a5211-7717-4f7f-a514-8316dccc78d5" />
<img width="779" height="390" alt="image" src="https://github.com/user-attachments/assets/a983108d-575e-4551-ab14-28611344e9b0" />
2026-04-24 18:19:14 +02:00
Jonathan Brouwer d4a700a52b Rollup merge of #149452 - yotamofek:pr/rustdoc/IndexItem-new, r=notriddle,lolbinarycat
Refactor out common code into a `IndexItem::new` constructor

rust-lang/rust#149404
2026-04-24 18:19:13 +02:00
Ralf Jung d4ca795f50 Merge pull request #4962 from elichai/elichai/_mm512_permutexvar_epi64
Implement `_mm512_permutexvar_epi64` shim
2026-04-24 15:47:58 +00:00
Walnut 180bfeffdb Pass fields to is_tuple_fields instead of SBValue object 2026-04-24 09:08:05 -05:00
Walnut 84ebb2269e account for GetSyntheticValue failures 2026-04-24 08:56:09 -05:00
bors acb65f36a0 Auto merge of #155645 - dianqk:update-llvm, r=nikic
Update LLVM to 22.1.4

Unlocks https://github.com/rust-lang/rust/pull/155249.

I made a new branch that removes CI checks for macOS and reverts https://github.com/rust-lang/llvm-project/commit/24b53fbc67d989ff0216c9b36369426828ac3b91.
2026-04-24 13:55:36 +00:00
Jynn Nelson bbdc7c4cc5 bootstrap: Don't clone submodules unconditionally in dry-run
This made it very annoying to debug bootstrap itself, because every
`--dry-run` invocation would start out by cloning LLVM, which is almost
never necessary. Instead change a few Steps to properly support dry_run
when no submodule is checked out.
2026-04-24 14:02:22 +02:00
Flakebi 13ec3de673 Add intrinsic for launch-sized workgroup memory on GPUs
Workgroup memory is a memory region that is shared between all
threads in a workgroup on GPUs. Workgroup memory can be allocated
statically or after compilation, when launching a gpu-kernel.
The intrinsic added here returns the pointer to the memory that is
allocated at launch-time.

# Interface

With this change, workgroup memory can be accessed in Rust by
calling the new `gpu_launch_sized_workgroup_mem<T>() -> *mut T`
intrinsic.

It returns the pointer to workgroup memory guaranteeing that it is
aligned to at least the alignment of `T`.
The pointer is dereferencable for the size specified when launching the
current gpu-kernel (which may be the size of `T` but can also be larger
or smaller or zero).

All calls to this intrinsic return a pointer to the same address.

See the intrinsic documentation for more details.

## Alternative Interfaces

It was also considered to expose dynamic workgroup memory as extern
static variables in Rust, like they are represented in LLVM IR.
However, due to the pointer not being guaranteed to be dereferencable
(that depends on the allocated size at runtime), such a global must be
zero-sized, which makes global variables a bad fit.

# Implementation Details

Workgroup memory in amdgpu and nvptx lives in address space 3.
Workgroup memory from a launch is implemented by creating an
external global variable in address space 3. The global is declared with
size 0, as the actual size is only known at runtime. It is defined
behavior in LLVM to access an external global outside the defined size.

There is no similar way to get the allocated size of launch-sized
workgroup memory on amdgpu an nvptx, so users have to pass this
out-of-band or rely on target specific ways for now.
2026-04-24 10:03:45 +02:00
Jacob Pratt a2622ef238 Rollup merge of #155712 - Zalathar:crashes, r=jieyouxu
Forbid `*-pass` and `*-fail` directives in tests/crashes

Crash tests are always expected to crash during compilation, so there is no sensible meaning for specifying a pass expectation or a run-fail expectation in a crash test.

It could conceivably be useful to use failure expectations to specify whether a crash test requires codegen in order to crash, but currently none of the crash tests try to do that. If that functionality is desired in the future, we can always look into re-adding it after the internals of pass/fail expectations have been cleaned up a bit.

---

After this change, pass/fail directives are only allowed in UI tests, which should make it easier to overhaul and simplify their implementation.

r? jieyouxu
2026-04-24 02:42:54 -04:00
Jacob Pratt 71275054ed Rollup merge of #155703 - alexcrichton:remove-myself-from-wasm32-wasip1-threads, r=jieyouxu
Remove myself as a maintainer of `wasm32-wasip1-threads`

Over time the landscape for myself has changed, and I no longer would like to be officially listed as a maintainer of this target in Rust, so I'm going to step down. There are still a number of others listed on this target, however, so I'm sure they can address issues should they come up.
2026-04-24 02:42:53 -04:00
Jacob Pratt b9cf909390 Rollup merge of #155081 - reddevilmidzy:ui-fixme, r=Kivooeo
Move and clean up some ui test

`ui/reserved` -> `ui/keyword`
`ui/deref-patterns` -> `ui/pattern/deref-patterns`
`ui/unknown-unstable-lints` -> `ui/lint/unknown-lints`

Tests related to unknown_lints that were located above lint have also been moved to a subdirectory, and duplicate tests have been deleted.

And delete unnecessary `//@ check-fail`

r? Kivooeo
2026-04-24 02:42:49 -04:00