Rollup of 9 pull requests#156041
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
This comment has been minimized.
This comment has been minimized.
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.
|
📌 Perf builds for each rolled up PR:
previous master: 0469a92a76 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 0469a92 (parent) -> 0164cc1 (this PR) Test differencesShow 62 test diffsStage 1
Stage 2
Additionally, 34 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 0164cc139285d5452053bcc5a83da046a501ed61 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (0164cc1): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 3.7%, secondary 1.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 481.713s -> 482.686s (0.20%) |
Successful merges:
lex_token_trees. #156031 (Return a single diagnostic fromlex_token_trees.)r? @ghost
Create a similar rollup