Commit Graph

325813 Commits

Author SHA1 Message Date
Josh Triplett e6c358bf66 Typo fix: s/prefect/perfect/ 2026-05-01 16:19:50 -07:00
WhySoBad 3fe9b2ecd3 fix: update comment 2026-05-01 22:48:22 +02:00
Camille Gillot f4c3a71a9f Do not depend on typeck to borrow-check inline consts. 2026-05-01 20:39:17 +00:00
Ralf Jung fb4bf6e698 Merge pull request #4981 from gruenich/feature/update-github-actions
[ci] Update GitHub Actions to last major release
2026-05-01 20:38:12 +00:00
WhySoBad 52b3f048cd feat: map WSAESHUTDOWN to BrokenPipe 2026-05-01 22:29:07 +02:00
Ralf Jung 5b14c92547 Merge pull request #4987 from WhySoBad/network-socket-shutdown
Add network socket `shutdown` shim
2026-05-01 17:31:28 +00:00
bors 67bcaa9c4b Auto merge of #153968 - jyn514:jyn/linker-warn-by-default, r=mati865
linker-messages is warn-by-default again

cc rust-lang/rust#136096 

I ended up keeping it a lint and adding an option for lints to ignore `-Dwarnings` (there was already a lint that did that actually, it was just hard-coded in rustc_middle instead of in rustc_lint_defs like I'd expect). This allows people to actually see the warnings without them failing the build in CI.
2026-05-01 17:15:17 +00:00
Camille Gillot b14a811b4b Reuse CTFE MIR for constructors. 2026-05-01 15:41:27 +00:00
Shoyu Vanilla e43a1b5b44 -Znext-solver Ignore region constraints from the nested goals in leakcheck 2026-05-02 00:11:43 +09:00
Jonathan Brouwer c17d24e1f7 Make diverging_type_vars a Vec
It being a `Set` does not really make sense. You never really should do a `contains` on it, since you should normalize the tyvid to its root var first.
2026-05-01 16:52:20 +02:00
Jonathan Brouwer f14ce9dab4 Make diverging_type_vars a set of TyVid 2026-05-01 16:39:12 +02:00
joboet f8b83b23c3 std: don't implement clear via truncate 2026-05-01 16:22:40 +02:00
Guillaume Gomez f19e850f59 Improve source code for librustdoc/visit_ast.rs 2026-05-01 16:20:39 +02:00
bors 0164cc1392 Auto merge of #156041 - JonathanBrouwer:rollup-yc0vOVk, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#149637 (Do not run jump-threading for GPUs)
 - rust-lang/rust#154971 (Verify that penultimate segment of enum variant path refers to enum if it has args)
 - rust-lang/rust#155186 (Avoid loop_match self-assignment in MIR lowering)
 - rust-lang/rust#155948 (Fix order-dependent visibility diagnostics)
 - rust-lang/rust#156001 (ssa-range-prop: fix ICE when encountering self-domiating bb)
 - rust-lang/rust#155600 (Adds a couple UI tests for polonius)
 - rust-lang/rust#155995 (-Zembed-source: also embed external source)
 - rust-lang/rust#156019 (Feed cleanups)
 - rust-lang/rust#156031 (Return a single diagnostic from `lex_token_trees`.)
2026-05-01 13:57:47 +00:00
danieljofficial 30e0c8f548 add issue links and bless 2026-05-01 14:30:58 +01:00
danieljofficial 3c82a61486 move tests from issues into associated-consts 2026-05-01 14:20:12 +01:00
danieljofficial f3261786d8 add issue links and bless 2026-05-01 13:50:56 +01:00
danieljofficial 74c133bdba move tests from issues into array-slice-vec 2026-05-01 12:34:59 +01:00
WhySoBad 563f4af7ab Add shutdown shim for network sockets 2026-05-01 13:29:37 +02:00
Jonathan Brouwer 47e6437af4 Rollup merge of #156031 - nnethercote:lex_token_trees, r=chenyukang
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
2026-05-01 13:10:38 +02:00
Jonathan Brouwer 7c4d304d4b Rollup merge of #156019 - nnethercote:rm-Feed, r=oli-obk
Feed cleanups

Two minor improvements. Details in the individual commits.

r? @oli-obk
2026-05-01 13:10:37 +02:00
Jonathan Brouwer 6d8e1250ab Rollup merge of #155995 - Mrmaxmeier:debuginfo-embed-external-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!
2026-05-01 13:10:36 +02:00
Jonathan Brouwer 825291ad1e Rollup merge of #155600 - CrooseGit:dev/reucru01/adds-polonius-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/rust#92038 and another for rust-lang/rust#70044.
Both tests fail under NLL but pass with polonius (legacy and alpha).
2026-05-01 13:10:36 +02:00
Jonathan Brouwer 7bea50b3d9 Rollup merge of #156001 - Human9000-bit:ssa-range-prop-155836, 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/rust#155836

r? dianqk
2026-05-01 13:10:35 +02:00
Jonathan Brouwer 7be04ef0a6 Rollup merge of #155948 - SynapLink:fix/pub-visibility-order, r=petrochenkov,mu001999
Fix order-dependent visibility diagnostics

Fixes rust-lang/rust#40066.
Fixes https://github.com/rust-lang/rust/issues/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.
2026-05-01 13:10:34 +02:00
Jonathan Brouwer 9996d99761 Rollup merge of #155186 - cijiugechu:fix/loop-match-no-self-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/rust#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>
2026-05-01 13:10:33 +02:00
Jonathan Brouwer 30bec0608b Rollup merge of #154971 - fmease:enum-var-verify-enum-seg, r=BoxyUwU
Verify that penultimate segment of enum variant path refers to enum if it has args

Fixes rust-lang/rust#154962.
2026-05-01 13:10:33 +02:00
Jonathan Brouwer 0606270cda Rollup merge of #149637 - Flakebi:fix-convergent-mir-opts, r=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/rust#137086, see this issue for details.
Tracking issue: rust-lang/rust#135024

cc @RDambrosio016 @kjetilkjeka for nvptx
cc @ZuseZ4
2026-05-01 13:10:32 +02:00
Guillaume Gomez a9da612379 Add missing alias to mailmap 2026-05-01 12:49:37 +02:00
human9000 d3d6c126d3 fix ice in ssa-range-prop
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
2026-05-01 15:21:40 +05:00
Sasha Pourcelot f77fc05d25 Add AcceptContext::expect_no_args 2026-05-01 08:09:59 +00:00
Nicholas Nethercote c9d0bdccb2 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.
2026-05-01 15:10:46 +10:00
bors 0469a92a76 Auto merge of #156023 - jhpratt:rollup-sZeK85e, r=jhpratt
Rollup of 19 pull requests

Successful merges:

 - rust-lang/rust#155237 (Disentangle AST crates and error crates)
 - rust-lang/rust#155249 (Fix: On wasm targets, call `panic_in_cleanup` if panic occurs in cleanup)
 - rust-lang/rust#155853 (Use `_mcount` as the mcount symbol name on RISC-V Linux GNU targets)
 - rust-lang/rust#155919 (simplify `ast_fragments!`)
 - rust-lang/rust#155939 (Add feature gate for view_types experiment)
 - rust-lang/rust#155954 (rustdoc: preserve parent doc cfg for `macro_export` macros)
 - rust-lang/rust#155974 (add `c_variadic_experimental_arch` feature)
 - rust-lang/rust#155991 (Catch unwinds from the global ctxt callback to complete queries profiling data in more cases)
 - rust-lang/rust#156003 (Pass Session to optimize_and_codegen_fat_lto)
 - rust-lang/rust#153566 (Add suggestion for E0401 on inner const items)
 - rust-lang/rust#154610 (Suggest public re-exports when a private module makes an import path inaccessible)
 - rust-lang/rust#155523 (Reorganize `tests/ui/issues/` - 02)
 - rust-lang/rust#155821 (c-variadic: document `Clone` and `Drop` instances and require `VaArgSafe: Copy`)
 - rust-lang/rust#155980 (Move `feature*` methods from `parse` mod to `errors` mod.)
 - rust-lang/rust#155987 (Make lifting infallible)
 - rust-lang/rust#155988 (tests/run-make/print-cfg: add Android target_env case)
 - rust-lang/rust#156000 (Fix ICE when using -Zinstrument-mcount and -Clinker-flavor=lld)
 - rust-lang/rust#156002 (Allow to use `Diagnostic` directly in `SharedContext::emit_lint`)
 - rust-lang/rust#156015 (rustc-dev-guide subtree update)
2026-05-01 04:14:53 +00:00
Scott McMurray 548cdc1412 Add a Local::arg(i) helper constructor
While reading through stuff I was noticing just how many `+1` fixes there were in various places (and comments explaining that fixup), so this adds a new inherent helper on `Local` for making an argument to help make this clearer.
2026-04-30 20:52:02 -07:00
Nicholas Nethercote 9119225b7f Remove unnecessary trait bound on Subdiagnostic.
FWIW, note that `Diagnostic` doesn't have this bound.
2026-05-01 13:32:54 +10:00
Nicholas Nethercote 82cfcaf7ec Remove useless bounds on Self for impls of concrete types.
When you have `impl Foo for Bar` and `Bar` has no generics it's useless
(and odd) to have `where Self: Baz` bounds on methods when the trait
itself doesn't have those bounds. This commit removes a few.
2026-05-01 13:32:54 +10:00
Nicholas Nethercote bc0e581abf Eliminate IsPrefixOf trait.
It has a single method and a single impl and the trait isn't directly
used. It can just become an inherent method.
2026-05-01 13:32:54 +10:00
Nicholas Nethercote e92ca90902 Remove unused Captures trait. 2026-05-01 13:32:54 +10:00
Nicholas Nethercote 7313fc67db Remove unused IntoVisitor trait. 2026-05-01 13:32:54 +10:00
Austin Henriksen 51e3797ebc bufreader::Buffer: Remove leftover note about initialized field
https://github.com/rust-lang/rust/pull/150129 reworked this field to use `bool` instead of `usize`, which is awesome!
But the field's comment has a leftover note in it which is no longer true, and that needs to be removed.
2026-04-30 23:31:14 -04:00
Jacob Pratt fbde425c84 Rollup merge of #156015 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to https://github.com/rust-lang/rustc-dev-guide/commit/cdd2373cb446ad722b160c5d599910452b3997ee.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-04-30 22:28:36 -04:00
Jacob Pratt a89e69e21d Rollup merge of #156002 - GuillaumeGomez:diagnostic-instead-of-closure, r=JonathanBrouwer
Allow to use `Diagnostic` directly in `SharedContext::emit_lint`

Part of https://github.com/rust-lang/rust/issues/153099.

r? @JonathanBrouwer
2026-04-30 22:28:35 -04:00
Jacob Pratt cf607056a0 Rollup merge of #156000 - pmur:murp/fix-155972, r=wesleywiser
Fix ICE when using -Zinstrument-mcount and -Clinker-flavor=lld

-Zinstrument-mcount passes -pg to the gnu linker command. This option is only supported by the cc frontend.

This fixes https://github.com/rust-lang/rust/issues/155972
2026-04-30 22:28:35 -04:00
Jacob Pratt b39cdf5656 Rollup merge of #155988 - Vastargazing:tests/android-target-env-print-cfg, r=petrochenkov
tests/run-make/print-cfg: add Android target_env case

Regression test for rust-lang/rust#90834

rust-lang/rust#77729 + rust-lang/rust#78929 accidentally gave Android targets `target_env="gnu"`
through `android_base` inheriting from `linux_gnu_base`. rust-lang/rust#90834 moved it
back to plain `linux_base` but didn't add a test, so a future target-spec
refactor could bring it back unnoticed. This adds an Android case to
`tests/run-make/print-cfg` covering exactly that.

r? @petrochenkov
2026-04-30 22:28:34 -04:00
Jacob Pratt 96b94a8a52 Rollup merge of #155987 - nnethercote:infallible-Lifting, r=oli-obk
Make lifting infallible

Details in individual commits.

r? @oli-obk
2026-04-30 22:28:33 -04:00
Jacob Pratt 894bdf298e Rollup merge of #155980 - nnethercote:mv-feature-methods, r=TaKO8Ki
Move `feature*` methods from `parse` mod to `errors` mod.

As the FIXME comment says, these no longer use `ParseSess` and so the `parse` mod is not a good place for them. The `errors` mod is a better home.

r? @TaKO8Ki
2026-04-30 22:28:33 -04:00
Jacob Pratt 0ab1a47246 Rollup merge of #155821 - folkertdev:doc-va-list-clone, r=joshtriplett
c-variadic: document `Clone` and `Drop` instances and require `VaArgSafe: Copy`

tracking issue: https://github.com/rust-lang/rust/issues/44930

Fixing some things that came up in the stabilization PR

r? tgross35
cc @kpreid
2026-04-30 22:28:32 -04:00
Jacob Pratt 5b91e270dc Rollup merge of #155523 - ujjwalvishwakarma2006:reorg-tests-02, r=Kivooeo
Reorganize `tests/ui/issues/` - 02

| old-name | new-sub-dir | new-name |
|-|-|-|
| `issue-19001.rs` [issue](https://github.com/rust-lang/rust/issues/19001) | `recursion/` | `recursive-struct-with-raw-pointer-field.rs` |
| `issue-31769.rs` [issue](https://github.com/rust-lang/rust/issues/31769) | `attributes/` | `dont-allow-inline-and-repr-at-invalid-positions.rs` |
| `issue-31769.stderr` | `attributes/` | `dont-allow-inline-and-repr-at-invalid-positions.stderr` |
| `issue-33202.rs` [issue](https://github.com/rust-lang/rust/issues/33202) | `attributes/` | `repr-on-single-variant-Enum.rs` |
| `issue-38763.rs` [issue](https://github.com/rust-lang/rust/issues/38763) | `foreign/` | `foreign-fn-with-more-than-8-byte-arg-size.rs` |

r? Kivooeo
2026-04-30 22:28:31 -04:00
Jacob Pratt 654c350837 Rollup merge of #154610 - jakubadamw:issue-13065, r=TaKO8Ki
Suggest public re-exports when a private module makes an import path inaccessible

This is an attempt at solving rust-lang/rust#13065.

When a `use` path fails because it passes through a private module (E0603), and a public re-export of the target item exists elsewhere, the compiler will now suggest importing through that re-export instead.

For example, given:

```rust
mod outer {
    pub use self::inner::MyStruct;
    mod inner {
        pub struct MyStruct;
    }
}

use outer::inner::MyStruct; // error: module `inner` is private
```

the compiler will now suggest use `outer::MyStruct`; - the publicly accessible path - rather than just pointing at the private module definition and leaving the user to figure out the alternative.

When possible, relative paths are suggested, including those using `super` (currently capped at a maximum of one `super` path item).

The newly added test is parametrised by editions because of the change in behaviour around `crate::`-prefixed imports in edition 2018. Perhaps that’s an overkill – I’ll be happy to remove the variations for editions 2021 and 2024.

Closes rust-lang/rust#13065.
2026-04-30 22:28:31 -04:00
Jacob Pratt 248756dc40 Rollup merge of #153566 - JohnTitor:sugg-generic-params-from-outer-item-err, r=wesleywiser
Add suggestion for E0401 on inner const items

Fix rust-lang/rust#68373
r? @estebank
2026-04-30 22:28:30 -04:00