Rollup of 9 pull requests#156041
Merged
rust-bors[bot] merged 24 commits intorust-lang:mainfrom May 1, 2026
Merged
Conversation
GPU targets have convergent operations that must not be duplicated or moved in or out of control-flow. An example convergent operation is a barrier/syncthreads. The only MIR pass affected by this is jump-threading, it can duplicate calls. Disable jump-hreading for GPU targets to prevent generating incorrect code. This affects the amdgpu and nvptx targets.
Fails on NLL, passes on polonius alpha & legacy.
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.
RFC 430 says type parameters should be named "concise UpperCamelCase, usually single uppercase letter". So either `Key` or `K` is more appropriate than `KEY`, which looks like a constant. I chose `K` because it's a well-known abbreviation of "key" used in lots of places, e.g. `HashMap<K, V>`.
It currently returns a `Vec` but in practice it always has one diagnostic in it. LLM disclosure: Claude Code identified this when I asked it to review `tokentrees.rs`. I made the change by hand and tested it myself.
It used to ICE when hitting an `assert_ne!(location.block, successor.block` due to hitting a self-dominating bb Fixed by checking *strict* domination instead of normal one
…=nnethercote Do not run jump-threading for GPUs GPU targets have convergent operations that must not be duplicated or moved in or out of control-flow. An example convergent operation is a barrier/syncthreads. The only MIR pass affected by this is jump-threading, it can duplicate calls. Disable jump-hreading for GPU targets to prevent generating incorrect code. This affects the amdgpu and nvptx targets. Fixes rust-lang#137086, see this issue for details. Tracking issue: rust-lang#135024 cc @RDambrosio016 @kjetilkjeka for nvptx cc @ZuseZ4
…=BoxyUwU Verify that penultimate segment of enum variant path refers to enum if it has args Fixes rust-lang#154962.
…assign, r=folkertdev,WaffleLapkin
Avoid loop_match self-assignment in MIR lowering
Transform
```
bb2: {
PlaceMention(_1);
_1 = copy _1;
goto -> bb7;
}
```
to
```
bb2: {
PlaceMention(_1);
_4 = copy _1;
_1 = copy _4;
goto -> bb7;
}
```
Closes rust-lang#143806
<details>
<summary>Previous MIR</summary>
```
fn helper() -> u8 {
let mut _0: u8;
let mut _1: u8;
let mut _2: !;
let mut _3: !;
scope 1 {
debug state => _1;
}
bb0: {
StorageLive(_1);
_1 = const 0_u8;
FakeRead(ForLet(None), _1);
StorageLive(_2);
goto -> bb1;
}
bb1: {
falseUnwind -> [real: bb2, unwind: bb11];
}
bb2: {
PlaceMention(_1);
_1 = copy _1;
goto -> bb7;
}
bb3: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb4: {
unreachable;
}
bb5: {
goto -> bb6;
}
bb6: {
goto -> bb8;
}
bb7: {
goto -> bb8;
}
bb8: {
goto -> bb1;
}
bb9: {
unreachable;
}
bb10: {
StorageDead(_2);
StorageDead(_1);
return;
}
bb11 (cleanup): {
resume;
}
}
```
</details>
<details>
<summary>Current MIR</summary>
```
fn helper() -> u8 {
let mut _0: u8;
let mut _1: u8;
let mut _2: !;
let mut _3: !;
let mut _4: u8;
scope 1 {
debug state => _1;
}
bb0: {
StorageLive(_1);
_1 = const 0_u8;
FakeRead(ForLet(None), _1);
StorageLive(_2);
goto -> bb1;
}
bb1: {
falseUnwind -> [real: bb2, unwind: bb11];
}
bb2: {
PlaceMention(_1);
_4 = copy _1;
_1 = copy _4;
goto -> bb7;
}
bb3: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb4: {
unreachable;
}
bb5: {
goto -> bb6;
}
bb6: {
goto -> bb8;
}
bb7: {
goto -> bb8;
}
bb8: {
goto -> bb1;
}
bb9: {
unreachable;
}
bb10: {
StorageDead(_2);
StorageDead(_1);
return;
}
bb11 (cleanup): {
resume;
}
}
```
</details>
…, r=petrochenkov,mu001999 Fix order-dependent visibility diagnostics Fixes rust-lang#40066. Fixes rust-lang#109657. Delay visibility path diagnostics until module collection has finished, so paths to later non-ancestor modules report E0742 instead of an unresolved path error.
…6, r=dianqk ssa-range-prop: fix ICE when encountering self-domiating bb - **Add `strictly_dominates` method** - **fix ice in ssa-range-prop** Fixes rust-lang#155836 r? dianqk
…us-ui-tests, r=jackh726 Adds a couple UI tests for polonius I went through all the open issues labeled `fixed-by-polonius` and from that created two UI tests based on issues that seemed a little novel. One for rust-lang#92038 and another for rust-lang#70044. Both tests fail under NLL but pass with polonius (legacy and alpha).
…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!
Feed cleanups Two minor improvements. Details in the individual commits. r? @oli-obk
…nyukang Return a single diagnostic from `lex_token_trees`. It currently returns a `Vec` but in practice it always has one diagnostic in it. LLM disclosure: Claude Code identified this when I asked it to review `tokentrees.rs`. I made the change by hand and tested it myself. r? @chenyukang
Contributor
Author
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
May 1, 2026
Rollup of 9 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
This comment has been minimized.
This comment has been minimized.
Contributor
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
lex_token_trees. #156031 (Return a single diagnostic fromlex_token_trees.)r? @ghost
Create a similar rollup