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
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.

10 participants