Commit Graph

25459 Commits

Author SHA1 Message Date
Guillaume Gomez e95df7d6d5 Rollup merge of #155749 - ShoyuVanilla:leakcheck-vis, r=lcnr
`-Znext-solver` Ignore region constraints from the nested goals in leakcheck

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/251
Fixes https://github.com/rust-lang/rust/issues/140577
Fixes https://github.com/rust-lang/rust/issues/153596
2026-05-02 04:12:05 +02: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
Shoyu Vanilla e43a1b5b44 -Znext-solver Ignore region constraints from the nested goals in leakcheck 2026-05-02 00:11:43 +09: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
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
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 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
Jacob Pratt fae8c6edd1 Rollup merge of #155974 - folkertdev:c-variadic-experimental-arch, r=joshtriplett
add `c_variadic_experimental_arch` feature

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

Based on https://hackmd.io/pIbUgMQuQcGaibJcinOcEw#Stabilize-c-variadic-function-definitions-rust155697, we'll gate niche targets where we don't control the implementation of `va_arg`, the ABI is unclear, or in general where we're not confident stabilizing the implementation.
2026-04-30 22:28:28 -04:00
Jacob Pratt 0a05ddf92b Rollup merge of #155954 - cijiugechu:doc_cfg-decl-macro, r=notriddle
rustdoc: preserve parent doc cfg for `macro_export` macros

The detached-item context is discovered before `propagate_doc_cfg`, it is carried on the clean item and consumed by the pass.

Closes rust-lang/rust#100916
2026-04-30 22:28:27 -04:00
Jacob Pratt f7b1e7d892 Rollup merge of #155939 - scrabsha:view-types/feature-gate, r=nikomatsakis
Add feature gate for view_types experiment
2026-04-30 22:28:26 -04:00
Jacob Pratt 0649c3f5d5 Rollup merge of #155249 - hoodmane:wasm-panic-in-cleanup-reland, r=bjorn3
Fix: On wasm targets, call `panic_in_cleanup` if panic occurs in cleanup

Relies on https://github.com/rust-lang/llvm-project/pull/194.
Reland of https://github.com/rust-lang/rust/pull/151771.

Previously this was not correctly implemented. Each funclet may need its own terminate block, so this changes the `terminate_block` into a `terminate_blocks` `IndexVec` which can have a terminate_block for each funclet. We key on the first basic block of the funclet -- in particular, this is the start block for the old case of the top level terminate function.

Rather than using a catchswitch/catchpad pair, I used a cleanuppad. The reason for the pair is to avoid catching foreign exceptions on MSVC. On wasm, it seems that the catchswitch/catchpad pair is optimized back into a single cleanuppad and a catch_all instruction is emitted which will catch foreign exceptions. Because the new logic is only used on wasm, it seemed better to take the simpler approach seeing as they do the same thing.

- [ ] Add test for https://github.com/rust-lang/rust/issues/153948
2026-04-30 22:28:24 -04:00
SynapLink f7c62f533e Fix order-dependent visibility diagnostics 2026-04-30 20:51:53 +02:00
Folkert de Vries ac12c696b8 remove custom va_end implementation in the LLVM backend
it should use the fallback body instead
2026-04-30 20:32:15 +02:00
cijiugechu 09e9d3f6da rustdoc: preserve parent doc cfg for macro_export macros 2026-04-30 16:31:22 +08:00
Vastargazing ef93fbbc9d tests/run-make/print-cfg: add Android target_env case
Android targets must not inherit `target_env="gnu"` from the Linux GNU
base. Cover this in the existing print-cfg run-make test so a future
target-spec refactor cannot silently re-introduce it.
2026-04-30 10:24:54 +03:00
Folkert de Vries 41796ecf1c add c_variadic_experimental_arch feature 2026-04-30 00:47:30 +02:00
Jonathan Brouwer d550bd5c1b Rollup merge of #155967 - GuillaumeGomez:doc-cfg-externs, r=Urgau
Fix `doc_cfg` feature for extern items

Part of rust-lang/rust#150268.

It only solves the extern items issue, but not the others listed in the issue. I will need to think about how to fix them nicely.

r? @Urgau
2026-04-29 23:51:42 +02:00
Jonathan Brouwer cb4bb14237 Rollup merge of #155877 - qaijuang:fix-155727-fnmut-diagnostic, r=wesleywiser
Avoid misleading return-type note for foreign `Fn` callees

Fixes rust-lang/rust#155727.

The issue occurred because the code that emitted the `Fn`/`FnMut` suggestion only avoided the return-type fallback when it could point at a local callee argument. The local case from rust-lang/rust#125325 was fixed in rust-lang/rust#126226, but nested cross-crate cases could still suggest changing the enclosing function's return type even though the relevant `Fn` requirement came from the callee argument.

This is also the broader diagnostic shape discussed in rust-lang/rust#119985.

This PR checks the instantiated callee predicates for an exact `Fn` bound
on the closure argument, and extends `wrong-closure-arg-suggestion-125325` with cross-crate function and method cases for that path.
2026-04-29 23:51:40 +02:00
Jonathan Brouwer 344cc3e233 Rollup merge of #155831 - scrabsha:push-pqrumlqtlsyk, r=JonathanBrouwer
Add `AcceptContext::expect_key_value`
2026-04-29 23:51:39 +02:00
Jonathan Brouwer e556ed96a8 Rollup merge of #155950 - folkertdev:needs-ret-mnemonic, r=chenyukang
use the new `//@ needs-asm-mnemonic: ret` more

Since https://github.com/rust-lang/rust/pull/155692 we have this neat new rule, and a couple of tests should be able to use them.
2026-04-29 23:51:37 +02:00
Jonathan Brouwer 91783dd17f Rollup merge of #155899 - ChrisDenton:dlltool, r=mati865
`dlltool`: Set the working directory to workaround `--temp-prefix` bug

dlltool's `--temp-prefix` argument incorrectly splits paths that contain spaces. To workaround this, we pass a relative path to `--temp-prefix` and set the working directory.

fixes rust-lang/rust#155591
2026-04-29 23:51:35 +02:00
Jonathan Brouwer a0ef691e5a Rollup merge of #155861 - oli-obk:effect-bound-suggestions, r=jdonszelmann
Suggest `[const] Trait` bounds in more places

Right now we have some special logic in the const checker for emitting `[const] Trait` suggestions, but I'm trying to handle that similarly to how it is handled for normal `Trait` clauses. This is just a small step in how it will look on the UX side, which should make my follow-up PRs affect tests less and just be a refactoring
2026-04-29 23:51:35 +02:00
Jonathan Brouwer 416d0bf523 Rollup merge of #155832 - folkertdev:c-variadic-ub-check, r=RalfJung
c-variadic: more precise compatibility check in const-eval

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

This came up in the stabilization report discussion https://github.com/rust-lang/rust/pull/155697#discussion_r3139778447.

As a reminder, this is what C says (in section 7.16.1.1 of the [C23 standard](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf#page=302).

> If type is not compatible with the type of the actual next argument (as promoted according to the default argument promotions), the behavior is undefined, except for the following cases:
>
> -  both types are pointers to qualified or unqualified versions of compatible types;
>  - one type is compatible with a signed integer type, the other type is compatible with the
>  corresponding unsigned integer type, and the value is representable in both types;
>  - one type is pointer to qualified or unqualified void and the other is a pointer to a qualified or
>  unqualified character type;
>  - or, the type of the next argument is `nullptr_t` and type is a pointer type that has the same representation and alignment requirements as a pointer to a character type

I think the last rule is not relevant for us, we don't really have an equivalent of `nullptr_t` as far as I know.

r? RalfJung
cc @tgross35
2026-04-29 23:51:33 +02:00
Jonathan Brouwer d936713d27 Rollup merge of #155721 - cezarbbb:fix-archive-ice-148217, r=bjorn3
When archive format is wrong produce an error instead of ICE

Fix rust-lang/rust#145624. Fix rust-lang/rust#147094. Fix rust-lang/rust#148217.
There are now two-step solutions to replace the original ICE:
Step 1: BSD format archive on a GNU/Linux target should emit a format mismatch warning.
Step 2: Corrupt archive with member offset exceeding file boundary should produce an error, not an ICE.

r? @bjorn3
2026-04-29 23:51:32 +02:00
Jonathan Brouwer cda4395868 Rollup merge of #155189 - RalfJung:reduce-minmax-float, r=petrochenkov
simd_reduce_min/max: remove float support

LLVM currently doesn't have an intrinsic with the right semantics here (see https://github.com/llvm/llvm-project/issues/185827). The only remaining user of this intrinsic with float types is portable-simd and it's easier to implement a fallback there than here, so I opted for making the intrinsic int-only. I kept around the float support in cranelift and Miri because there it already has the desired semantics (matching scalar min/max).

Fixes https://github.com/rust-lang/rust/issues/153395
~~Blocked on https://github.com/rust-lang/portable-simd/pull/515~~
2026-04-29 23:51:30 +02:00
Vadim Petrochenkov d28ea81a98 resolve: Extend ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities 2026-04-29 22:34:16 +03:00
Sasha Pourcelot 77fb8d1d5c Parse view type syntax, mark it as unstable 2026-04-29 18:11:02 +00:00
Sasha Pourcelot 7724d13d5a Add AcceptContext::expect_key_value 2026-04-29 20:00:19 +02:00
Guillaume Gomez 36138dc0b8 Fix doc_cfg feature for extern items 2026-04-29 18:02:25 +02:00
Folkert de Vries c560774cf3 c-variadic: more precise compatibility check in const-eval 2026-04-29 17:45:39 +02:00
bors c935696dd0 Auto merge of #155487 - ShoyuVanilla:canon-ph, r=lcnr
Canonicalize free regions from inputs as placeholders in root univ



Context: The box named *coroutine witness Send lifetime requirements now considered by leakcheck* [this roadmap](https://raw.githubusercontent.com/hexcatnl/roadmap/e380fef94b47c02a056b4c8f05124a9db475b990/next-solver.svg)

Fixes (only for the next-solver) rust-lang/rust#106569 
Prerequisite of https://github.com/rust-lang/rust/pull/155749
2026-04-29 13:17:37 +00:00
cezarbbb b784a1ca79 When archive format is wrong produce an error instead of ICE 2026-04-29 20:21:02 +08:00
Ralf Jung ad7ddbc08e simd_reduce_min/max: remove float support 2026-04-29 13:48:45 +02:00
Shoyu Vanilla f2ae894662 Canonicalize free regions from inputs as placeholders in root univ 2026-04-29 13:13:04 +09:00
Shoyu Vanilla (Flint) 7ffff36037 Rollup merge of #155947 - SynapLink:cleanup/check-pass-variance-tests, r=nnethercote
tests: mark simple UI tests as check-pass

This changes 14 simple UI tests from build-pass to check-pass.

These tests cover type checking, trait bounds, closure inference, deprecation diagnostics, dyn compatibility, and variance. They do not need codegen or linking, so check-pass keeps the intended coverage while removing old FIXME(62277) markers.
2026-04-29 10:40:49 +09:00
Shoyu Vanilla (Flint) 037b1e1746 Rollup merge of #155922 - cyrgani:no-dead-aux-files, r=jieyouxu
delete unused auxiliary test files

Related issue for detecting these properly: https://github.com/rust-lang/rust/issues/133914.
2026-04-29 10:40:48 +09:00
Shoyu Vanilla (Flint) dce5b97c52 Rollup merge of #155648 - ShoyuVanilla:maybe-stalled-on-couroutines, r=lcnr
`-Znext-solver` Propagate `stalled_on_coroutines` as a field in `Certainty::Maybe`

..instead of collecting them with a `ProofTreeVisitor`

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/270
2026-04-29 10:40:46 +09:00
Shoyu Vanilla (Flint) 5d26634476 Rollup merge of #152443 - kjetilkjeka:nvptx_drop_support_old_hw_and_isa, r=ZuseZ4
NVPTX: Drop support for old architectures and old ISAs

This is the implementation of [this MCP](https://github.com/rust-lang/compiler-team/issues/965#issuecomment-3837320262)

I believe it was said that no FCP was needed, but if that is incorrect then the FCP is anyway scheduled to finish in 2 days so it can in any case be merged then.
2026-04-29 10:40:46 +09:00
Chris Denton 6d20c98b81 Test that raw-dylib works with whitespace paths 2026-04-29 00:16:56 +00:00
Chris Denton 23c7bf054b Fix passing paths with space into dlltool 2026-04-29 00:16:36 +00:00
Folkert de Vries 44b9251b18 use the new //@ needs-asm-mnemonic: ret more 2026-04-29 01:28:35 +02:00
Sasha Pourcelot d3992fac94 Add feature gate for view_types 2026-04-28 21:56:06 +00:00