Skip to content

Rollup of 9 pull requests#156041

Merged
rust-bors[bot] merged 24 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-yc0vOVk
May 1, 2026
Merged

Rollup of 9 pull requests#156041
rust-bors[bot] merged 24 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-yc0vOVk

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

Flakebi and others added 24 commits March 24, 2026 11:00
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
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label May 1, 2026
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2026
@rustbot rustbot added 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. labels May 1, 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 May 1, 2026

📌 Commit 47e6437 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 May 1, 2026
@rust-bors

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
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 1, 2026

☀️ Try build successful (CI)
Build commit: e4f15be (e4f15bef3074b418d2c1aa9abe105433af2e5510, parent: 0469a92a76c327df972cb6c1356934b7a0c6b86d)

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 1, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 1, 2026

☀️ Test successful - CI
Approved by: JonathanBrouwer
Duration: 3h 16m 11s
Pushing 0164cc1 to main...

@rust-bors rust-bors Bot merged commit 0164cc1 into rust-lang:main May 1, 2026
13 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 1, 2026
@rust-timer
Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#149637 Do not run jump-threading for GPUs d903e0bae0ed774920bb1ebdf69977fa2dbaccee (link)
#154971 Verify that penultimate segment of enum variant path refers… 980c9dfda7e1286297d1f0c284e6737bb5ce0b33 (link)
#155186 Avoid loop_match self-assignment in MIR lowering ff4bd79100ae556aabbd8b77eed5b9e18bffb805 (link)
#155600 Adds a couple UI tests for polonius 07155fb84dc96d6498198f45f374cc84db586479 (link)
#155948 Fix order-dependent visibility diagnostics 54e0a229339a62ef2a3fc50367e6af39350be545 (link)
#155995 -Zembed-source: also embed external source 90c6082987fded2c5d078984d12516c448e90d92 (link)
#156001 ssa-range-prop: fix ICE when encountering self-domiating bb e64604b98b5e73af1cc2b4894825c2c53aeb883f (link)
#156019 Feed cleanups 1f0d596b8b0b3fc5b7aa9cfabc74d0eac0c72132 (link)
#156031 Return a single diagnostic from lex_token_trees. e6264e170080e75c11f8017a80dabbe16a5f9d9b (link)

previous master: 0469a92a76

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

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 differences

Show 62 test diffs

Stage 1

  • [mir-opt] tests/mir-opt/building/loop_match_no_self_assign.rs: [missing] -> pass (J1)
  • [mir-opt] tests/mir-opt/issues/issue_137086.rs#cpu: [missing] -> pass (J1)
  • [mir-opt] tests/mir-opt/issues/issue_137086.rs#gpu: [missing] -> pass (J1)
  • [ui] tests/ui/enum/enum-variant-generic-args-in-module-segment.rs: [missing] -> pass (J1)
  • [ui] tests/ui/loop-match/no-self-assign-ice.rs: [missing] -> pass (J1)
  • [ui] tests/ui/mir/ssa-range-prop-bb-self-domination.rs: [missing] -> pass (J1)
  • [ui] tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs#legacy: [missing] -> pass (J1)
  • [ui] tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs#nll: [missing] -> pass (J1)
  • [ui] tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs#polonius: [missing] -> pass (J1)
  • [ui] tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs#legacy: [missing] -> pass (J1)
  • [ui] tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs#nll: [missing] -> pass (J1)
  • [ui] tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs#polonius: [missing] -> pass (J1)
  • [ui] tests/ui/resolve/visibility-order-dependent.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/enum/enum-variant-generic-args-in-module-segment.rs: [missing] -> pass (J0)
  • [ui] tests/ui/loop-match/no-self-assign-ice.rs: [missing] -> pass (J0)
  • [ui] tests/ui/mir/ssa-range-prop-bb-self-domination.rs: [missing] -> pass (J0)
  • [ui] tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs#legacy: [missing] -> pass (J0)
  • [ui] tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs#nll: [missing] -> pass (J0)
  • [ui] tests/ui/nll/polonius/location-insensitive-constraints-issue-70044.rs#polonius: [missing] -> pass (J0)
  • [ui] tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs#legacy: [missing] -> pass (J0)
  • [ui] tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs#nll: [missing] -> pass (J0)
  • [ui] tests/ui/nll/polonius/nll-problem-case-2-issue-92038.rs#polonius: [missing] -> pass (J0)
  • [ui] tests/ui/resolve/visibility-order-dependent.rs: [missing] -> pass (J0)
  • [mir-opt] tests/mir-opt/building/loop_match_no_self_assign.rs: [missing] -> pass (J2)
  • [mir-opt] tests/mir-opt/issues/issue_137086.rs#cpu: [missing] -> pass (J3)
  • [mir-opt] tests/mir-opt/issues/issue_137086.rs#gpu: [missing] -> pass (J3)
  • [mir-opt] tests/mir-opt/issues/issue_137086.rs#cpu: [missing] -> ignore (gcc backend is marked as ignore) (J4)
  • [mir-opt] tests/mir-opt/issues/issue_137086.rs#gpu: [missing] -> ignore (gcc backend is marked as ignore) (J4)

Additionally, 34 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 0164cc139285d5452053bcc5a83da046a501ed61 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-aux: 1h 45m -> 2h 20m (+33.1%)
  2. i686-msvc-1: 2h 19m -> 3h 3m (+31.2%)
  3. dist-x86_64-netbsd: 1h 11m -> 1h 31m (+29.1%)
  4. dist-various-1: 56m 43s -> 1h 12m (+27.9%)
  5. dist-arm-linux-musl: 1h 19m -> 1h 39m (+26.3%)
  6. dist-aarch64-apple: 1h 31m -> 1h 53m (+24.3%)
  7. dist-x86_64-msvc-alt: 2h 48m -> 2h 9m (-22.9%)
  8. dist-x86_64-freebsd: 1h 29m -> 1h 12m (-19.3%)
  9. x86_64-gnu-stable: 2h 18m -> 1h 55m (-16.3%)
  10. dist-arm-linux-gnueabi: 1h 25m -> 1h 12m (-16.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (0164cc1): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-0.9%, -0.9%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.9% [-0.9%, -0.9%] 1

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.

mean range count
Regressions ❌
(primary)
3.7% [2.3%, 5.1%] 2
Regressions ❌
(secondary)
1.0% [1.0%, 1.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.7% [2.3%, 5.1%] 2

Cycles

Results (secondary 0.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.4% [4.4%, 4.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.1%, secondary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.6%] 12
Regressions ❌
(secondary)
0.2% [0.1%, 0.6%] 4
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-0.3%, 0.6%] 13

Bootstrap: 481.713s -> 482.686s (0.20%)
Artifact size: 390.96 MiB -> 390.94 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.