Skip to content

Rollup of 17 pull requests#157536

Open
JonathanBrouwer wants to merge 140 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-dcQwAU1
Open

Rollup of 17 pull requests#157536
JonathanBrouwer wants to merge 140 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-dcQwAU1

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

Failed merges:

r? @ghost

Create a similar rollup

GuillaumeGomez and others added 30 commits April 10, 2026 16:36
To allow emitting LC_BUILD_VERSION containing this version.
Covers all 8 LLVM intrinsics (llvm.aarch64.crc32{,c}{b,h,w,x}).
Reference values generated with the LLVM backend on aarch64-apple-darwin.
Currently fails: cg_clif emits a 'not yet supported' trap.
Lower the eight CRC32 LLVM intrinsics to crc32{,c}{b,h,w,x} inline
assembly via the existing codegen_inline_asm_inner helper, mirroring
the existing x86 sse42.crc32 lowering.

Unblocks crc32fast on aarch64-{apple-darwin,unknown-linux-*}, which is
pulled in transitively by png -> image and Bevy's PNG screenshot path.
* Implement core::arch::return_address and tests

Fix typo

Apply suggestions from code review

Wording/docs changes.

Co-authored-by: Ralf Jung <post@ralfj.de>

Change signature according to Ralf's comment

Fix call to `core::intrinsics::return_address()` according to the new signature

Add cranelift implementation for intrinsic

Change wording on `return_address!()` to be clear that returning a null pointer is best-effort.

Fix formatting of doc comment

Fix mistake in cranelift codegen
* Do not generate llvm.returnaddress on wasm
* Supress return_address test on miri
…/fix2

ci: test upcoming Cranelift release branch
…ang/madsmtm/versioned-target-triple

Use versioned target triple
…ostanich/aarch64-crc32-intrinsics

Implement aarch64 CRC32 LLVM intrinsics
`std::hash::Hash` looks like this:
```
pub trait Hash {
    fn hash<H>(&self, state: &mut H)
       where H: Hasher;

    ...
}
```
The method is generic.

In contrast, `HashStable` looks like this:
```
pub trait HashStable<Hcx> {
    fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}
```
and impls look like this (in crates upstream of `rustc_middle`):
```
impl<Hcx: HashStableContext> HashStable<Hcx> for Path {
    fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
        ...
    }
}
```
or this (in `rustc_middle` and crates downstream of `rustc_middle`):
```
impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::Features {
    fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
	...
    }
}
```
Differences to `std::hash::Hash`:
- The trait is generic, rather than the method.
- The way impls are written depends their position in the crate graph.
- This explains why we have both `derive(HashStable)` and
  `derive(HashStable_Generic)`. The former is for the
  downstream-of-`rustc_middle` case, the latter is for the upstream of
  `rustc_middle` case.

Why the differences? It all boils down to `HashStable` and
`HashStableContext` being in different crates. But the previous commit
fixed that, which means `HashStable` can be simplified to this, with a
generic method:
```
pub trait HashStable {
    fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}
```
and all impls look like this:
```
impl HashStable for Path {
    fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
        ...
    }
}
```

Other consequences:
- `derive(HashStable_Generic)` is no longer needed; `derive(HashStable)`
  can be used instead.
  - In this commit, `derive(HashStable_Generic` is made a synonym of
    `derive(HashStable)`. The next commit will remove this synonym,
    because it's a change that touches many lines.
- `#[stable_hash_generic]` is no longer needed (for `newtype_index`);
  `#[stable_hash]` can be used instead.
  - `#[stable_hash_no_context]` was already a synonym of
    `#[stable_hash_generic]`, so it's also removed in favour of just
    `#[stable_hash]`.
- The difference between `derive(HashStable)` and
  `derive(HashStable_NoContext)` now comes down to the difference
  between `synstructure::AddBounds::Generics` and
  `synstructure::AddBounds::Fields`, which is basically "vanilla derive"
  vs "(near) perfect derive".
  - I have improved the comments on `HashStableMode` to better
    explaining this subtle difference.
- `rustc_middle/src/ich/impls_syntax.rs` is no longer needed; the
  relevant impls can be defined in the crate that defines the relevant
  type.
- Occurrences of `for<'a> HashStable<StableHashingContext<'a>>` are
  replaced with with `HashStable`, hooray.
- The commit adds a `HashStableContext::hashing_controls` method, which
  is no big deal. (It's necessary for `AdtDefData::hash_stable`, which
  calls `hashing_controls` and used to have an `hcx` that was a
  concrete `StableHashingContext` but now has an `hcx` that is just
  `Hcx: HashStableContext`.)

Overall this is a big simplification, removing a lot of confusing
complexity in stable hashing traits.
This allows embedding source code even when it's only available via
previously emitted metadata files.

Without this, embedded source availability is inconsistent, especially
in release builds.
…ust-lang/rustc_codegen_cranelift#1641)

Copy the underaligned byval (indirect) arguments into a local stackslot
when the incoming pointer alignment is less than the Rust ABI alignment.
This avoids miscompiles from assuming stronger alignment than the ABI
guarantees.

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
…l-source, r=oli-obk

-Zembed-source: also embed external source

Hi,

I've been using `-Zembed-source` for a while and noticed that some sources are not embedded when compiling in release mode. See the minimal reproducer below for missing embedded source code.

The current implementation only emits source from the `src` field in `SourceFile`, but for multi-codegen-unit scenarios the source might only be available via the `external_src` field.

I've updated the LLVM and Cranelift backends to fall back to `external_src` if `src` is not available.

Minimal reproducer:
```console
$ cat Cargo.toml
[package]
name = "repro"
version = "0.0.1"
edition = "2021"
[profile.release]
strip = "none"
debug = true
$ cat src/lib.rs
// marker comment
pub fn foo() -> u64 { 42 }
$ cat src/main.rs
fn main() {
    println!("{}", repro::foo());
}
$ RUSTFLAGS="-g -Zembed-source=yes -Zdwarf-version=5" cargo build -r
   Compiling repro v0.0.1 (/tmp/repro)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.08s
$ # Note: Source for lib.rs is missing here:
$ llvm-dwarfdump --debug-line target/release/repro | grep "marker comment"
$ RUSTFLAGS="-g -Zembed-source=yes -Zdwarf-version=5" cargo +stage1 build -r
    Finished `release` profile [optimized + debuginfo] target(s) in 0.04s
$ llvm-dwarfdump --debug-line target/release/repro | grep "marker comment"
         source: "// marker comment\npub fn foo() -> u64 { 42 }\n"
```

Thanks!
Specifically:
- `HashStable` -> `StableHash` (trait)
- `HashStable` -> `StableHash` (derive)
- `HashStable_NoContext` -> `StableHash_NoContext` (derive)

Note: there are some names in `compiler/rustc_macros/src/hash_stable.rs`
that are still to be renamed, e.g. `HashStableMode`.

Part of MCP 983.
CrateInfo is only necessary during linking and non-local LTO.
While it was previously defined in Session, it is only ever used with
OutputFilenames methods.
…hrisDenton

fix windows-gnu TLS leak

Running the std tests on windows-gnu [has a memory leak](https://rust-lang.zulipchat.com/#narrow/channel/269128-miri/topic/Miri.20test-libstd.20Failure.20.282026-06.29/near/599991435). After lots of false leads, here's what I found:
- The `guard::enable` function needs to be called on each thread; it the ensures that when the thread finishes, cleanup is performed.
- The windows `LazyKey` calls `guard::enable` in its `init` function. That means it only gets called on the first thread that accesses this key!
- We have a `guard::enable` call in the `thread::spawn` path. However, when running tests, there are two copies of std, so there are two guards. `crate::thread::spawn` sets up the guard for the current crate (the one built with `cfg(test)`), but does not set up the guard for `realstd` (the std crate in the sysroot).

This is a regression introduced by rust-lang#148799. Previously, `guard::enable`  was pretty much a NOP on Windows so not calling it didn't cause problems.

rust-lang/miri-test-libstd#123 has confirmed that this indeed fixes the leak.

The first commit is a drive-by fix where I found a function name kind of confusing.

r? @ChrisDenton
Cc @joboet
…ystem-hack, r=Kobzol

compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows

So that we don't get a bunch of console windows spawned by the debuggees.

r? @Kobzol (or bootstrap/compiler)
…8472

remove solaris implementation for File::lock, it has the wrong semantics

Fixes rust-lang#157390
r? @the8472
…BurntSushi

Rename `SyncView::{as_pin => as_pin_ref}`

This addresses the resolution of a naming concern from rust-lang#98407.

r? BurntSushi
…Kivooeo

Move tests box

Hi, I have moved some tests into the box folder. Fixes [133895](rust-lang#133895)
Revert "LLVM 23: Run AssignGUIDPass in some places"

This reverts commit cdb73bb.

The LLVM side change was reverted.
…ion, r=mejrs

Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`

There are currently two sources of truth for which attributes are builtin, the `BUILTIN_ATTRIBUTE_MAP` and the list of parsers. The long term goal is to get rid of the `BUILTIN_ATTRIBUTE_MAP` , but because of the way that crates depend on eachother this is not trivial. This PR makes sure the sources don't diverge.

r? @mejrs
… r=JonathanBrouwer

Rename `errors.rs` file to `diagnostics.rs`

`errors.rs` (and sometimes `error.rs`, depends on the crate) are not coherent with their content which can be both errors and lints. However, they're both diagnostics so it would make more sense to rename all of them into `diagnostics.rs`.

I only did 3 crates for a start to confirm it's ok to go forward with this.

I think it was discussed with @JonathanBrouwer so setting them as reviewer. :3

r? @JonathanBrouwer
…s-as-struct, r=ShoyuVanilla

Convert `QueryRegionConstraint` into a struct

as per in fixme
std tests: skip a slow test on Miri

This is just a big loop to compare exit status handling, and the loop is a bit too big for Miri.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jun 6, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 6, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1,i686-msvc-2

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 6, 2026

📌 Commit bcff501 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 6, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 6, 2026

⌛ Trying commit bcff501 with merge d10cb12

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/27067224577

rust-bors Bot pushed a commit that referenced this pull request Jun 6, 2026
Rollup of 17 pull requests


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
try-job: i686-msvc-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.