Commit Graph

24485 Commits

Author SHA1 Message Date
Jonathan Brouwer 8ae423e5e8 Rollup merge of #154230 - aryannrd:issue-50411, r=Kivooeo
Moved and rename issue-50411 to tests/ui/mir/inliner-double-elaborate
2026-03-25 19:52:59 +01:00
Jonathan Brouwer 7381bbba99 Rollup merge of #154131 - cyrgani:structs-enums, r=Kivooeo
begin `tests/ui/structs-enums` cleanup

Nearly all tests in this directory are heavily outdated, poorly formatted and have a lot of duplication. This PR is the first of a planned series of PRs to combinine this, `ui/structs` and `ui/enum` into a better structure (`ui/adt` maybe?).
2026-03-25 19:52:58 +01:00
Jonathan Brouwer a376772bc1 Rollup merge of #154112 - cyrgani:macros-folder, r=Kivooeo
some `tests/ui/macros` cleanup

Move most tests that do not run any code from `//@ run-pass` to `//@ check-pass` and merge the (outdated) `die-macro-*` tests into one file.
2026-03-25 19:52:57 +01:00
Jonathan Brouwer 047dee4665 Rollup merge of #154090 - danieljofficial:move-tests-statics, r=Kivooeo
Move tests in the statics category

I have moved some tests I feel belong in the statics directory. Please review and let me know if this is the correct way. I think on the first two files I moved, i forgot to turn off rust analyzer and it probably formatted the files, will this be an issue?
2026-03-25 19:52:57 +01:00
Jonathan Brouwer c13e9ec32b Rollup merge of #154364 - aerooneqq:delegation-generics-small-fixes, r=petrochenkov
delegation: don't propagate synthetic params, remove lifetime hacks

Some small fixes after new delegation lowering was merged: remove lifetime hacks as now we get only early-bound lifetimes from generics, don't propagate synthetic generic params as now we know that they are synthetic. Fixes rust-lang/rust#143498. Part of rust-lang/rust#118212.

r? @petrochenkov
2026-03-25 19:52:56 +01:00
Jonathan Brouwer 145917253d Rollup merge of #154363 - aerooneqq:nested-delegations, r=petrochenkov
delegation: fix zero-args nested delegation ICE

This PR fixes an ICE when during lowering of nested delegation we need to access information about its parent, who is also inside body of another delegation. As a fix we lower delegation body even if there are no arguments in signature function, in this case we will see an error `this function takes 0 arguments but 1 argument was supplied`. Fixes rust-lang/rust#154332. Part of rust-lang/rust#118212.

r? @petrochenkov
2026-03-25 19:52:55 +01:00
Jonathan Brouwer 85ddb8e414 Rollup merge of #154313 - mu001999-contrib:fix/154295, r=petrochenkov
Init `self_decl` with a correct visibility

Fixes rust-lang/rust#154295

r? petrochenkov
2026-03-25 19:52:52 +01:00
Jonathan Brouwer 2f1603077b Rollup merge of #154200 - resrever:enable-dwarf-call-sites, r=dingxiangfei2009
debuginfo: emit DW_TAG_call_site entries

Set `FlagAllCallsDescribed` on function definition DIEs so LLVM emits DW_TAG_call_site entries, letting debuggers and analysis tools track tail calls.
2026-03-25 19:52:50 +01:00
Jonathan Brouwer 6e3c17424d Rollup merge of #153702 - SpriteOvO:guard-matcher, r=davidtwco
Add macro matcher for `guard` fragment specifier

Tracking issue #153104

This PR implements a new `guard` macro matcher to match `if-let` guards (specifically [`MatchArmGuard`](https://github.com/rust-lang/reference/blob/50a1075e879be75aeec436252c84eef0fad489f4/src/expressions/match-expr.md#match-guards)). In the upcoming PR, we can use this new matcher in the `matches!` and `assert_matches!` macros to support their use with `if-let` guards. (see #152313)

The original `Expr` used to represent a guard has been wrapped in a new `Guard` type, allowing us to carry the span information of the leading `if` keyword. However, it might be even better to include the `if` keyword in the `Guard` type as well? I've left a FIXME comment in the code.
2026-03-25 19:52:50 +01:00
Jonathan Brouwer 0cd8de3843 Rollup merge of #153049 - Darksonn:kasan-sw-tags, r=fmease
Add `-Zsanitize=kernel-hwaddress`

The Linux kernel has a config option called `CONFIG_KASAN_SW_TAGS`  that enables `-fsanitize=kernel-hwaddress`. This is not supported by Rust.

One slightly awkward detail is that `#[sanitize(address = "off")]` applies to both `-Zsanitize=address` and `-Zsanitize=kernel-address`. Probably it was done this way because both are the same LLVM pass. I replicated this logic here for hwaddress, but it might be undesirable.

Note that `#[sanitize(kernel_hwaddress = "off")]` could be supported as an annotation on statics, but since it's also missing for `#[sanitize(hwaddress = "off")]`, I did not add it.

MCP: https://github.com/rust-lang/compiler-team/issues/975
Tracking issue: https://github.com/rust-lang/rust/issues/154171

cc @rcvalle @maurer @ojeda
2026-03-25 19:52:49 +01:00
mu001999 01795c3eab Init self_decl with a correct vis 2026-03-25 21:41:33 +08:00
Aryan Dubey 2a543acbaf Moved and rename issue-50411 to tests/ui/mir/inliner-double-elaborate
* Move issue-50411 to tests/ui/mir/inliner-double-elaborate
* Addded the link for the issue to inliner-double-elaborate.rs
* Fix tidy issues
* Renamed to inliner-double-elaborate.rs
2026-03-25 10:13:13 +00:00
aerooneqq c2383b53a2 Don't propagate synthetic params, remove lifetime hacks 2026-03-25 13:04:03 +03:00
danieljofficial bca30d4828 add issue link comments and bless 2026-03-25 10:49:21 +01:00
aerooneqq 11a338deb6 Fix nested zero-args delegation ICE 2026-03-25 12:08:31 +03:00
bors 8a703520e8 Auto merge of #154339 - JonathanBrouwer:rollup-FPeeGxJ, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#154311 ([libcore] Disable `doc(auto_cfg)` for integers trait impls)
 - rust-lang/rust#154331 (allow `incomplete_features` in all ui tests)
 - rust-lang/rust#154336 (Remove more BuiltinLintDiag variants - part 3)
2026-03-24 22:00:08 +00:00
cyrgani 97e84d5a56 allow incomplete_features in all ui tests 2026-03-24 20:00:26 +00:00
bors 362211dc29 Auto merge of #154326 - JonathanBrouwer:rollup-MflIdQW, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#152710 (Unalign `PackedFingerprint` on all hosts, not just x86 and x86-64)
 - rust-lang/rust#153874 (constify const Fn*: Destruct)
 - rust-lang/rust#154097 (improve validation error messages: show surrounding type)
 - rust-lang/rust#154277 (use `minicore` more in testing inline assembly)
 - rust-lang/rust#154293 (Use verbose span suggestion for type const)
2026-03-24 18:37:19 +00:00
Jonathan Brouwer 9396ab225e Rollup merge of #154293 - reddevilmidzy:type-diag, r=fmease
Use verbose span suggestion for type const

close: https://github.com/rust-lang/rust/issues/154214

r? fmease
2026-03-24 18:14:18 +01:00
Jonathan Brouwer ef18725442 Rollup merge of #154277 - folkertdev:ui-asm-minicore, r=jieyouxu
use `minicore` more in testing inline assembly

Both for easier development and because some niche assembly features were only tested on one platform.

try-job: aarch64-gnu
try-job: x86_64-gnu
try-job: x86_64-gnu-debug
2026-03-24 18:14:17 +01:00
Jonathan Brouwer ab6401749a Rollup merge of #154097 - RalfJung:validity-error, r=oli-obk
improve validation error messages: show surrounding type

Also, for dyn-downcast show the type we're downcasting to.

r? @oli-obk
2026-03-24 18:14:15 +01:00
Jonathan Brouwer 1e3d3bdb24 Rollup merge of #153874 - bend-n:constify-const-fn-destruct, r=oli-obk
constify const Fn*: Destruct

makes closures const destruct where their upvars are. i think this makes sense
and is how this should be implemented.

r? @oli-obk
2026-03-24 18:14:15 +01:00
Jonathan Brouwer a1c32ca566 Rollup merge of #154276 - cyrgani:incomplete-mcp-2, r=fmease
allow `incomplete_features` in more tests

This PR allows the `incomplete_features` lint for the `traits` and `const-generics` directories. `specialization` will come in a followup PR.

Followup to rust-lang/rust#154174.
Part of https://github.com/rust-lang/rust/issues/154168.
2026-03-24 16:22:50 +01:00
Jonathan Brouwer 1cfbc509e6 Rollup merge of #154142 - aerooneqq:dont-create-ast-generics-2, r=petrochenkov
Delegation: eliminate usage of AST from generics creation

This PR eliminates all interaction with AST during creation of generics, then it supports proper const param types propagation. Fixes rust-lang/rust#153433. Fixes rust-lang/rust#153499. Part of rust-lang/rust#118212.

r? @petrochenkov
2026-03-24 16:22:49 +01:00
Jonathan Brouwer 898b62f590 Rollup merge of #154094 - folkertdev:aarch64-arm-load-store, r=sayantn
add neon load/store assembly test

I'm adding this test because it was requested for the beta backport of https://github.com/rust-lang/rust/issues/153336. We'd like to test this with Miri, but currently there is no load/store pair that roundtrips because one or the other still uses the platform-specific intrinsics.

r? sayantn

I believe test-various runs some arm and android tests?

@bors try job=test-various
2026-03-24 16:22:49 +01:00
Redddy e03983878f Use verbose span suggestion for type const 2026-03-24 15:02:10 +00:00
aerooneqq 1d325ce436 Eliminate usage of AST from generics creation 2026-03-24 14:16:36 +03:00
Jacob Pratt 3574d5748e Rollup merge of #154264 - rustbot:docs-update, r=ehuss
Update books

## rust-embedded/book

1 commits in e88aa4403b4bf2071c8df9509160477e40179099..2463edeb8003c5743918b3739a9f6870b86396f5
2026-03-11 17:49:58 UTC to 2026-03-11 17:49:58 UTC

- Update teaching material duration for bare-metal Rust (rust-embedded/book#409)

## rust-lang/reference

7 commits in c49e89cc8c7c2c43ca625a8d5b7ad9a53a9ce978..7446bf9697c95d155eef33c6a9d91fbd29a5e359
2026-03-18 01:46:01 UTC to 2026-03-10 18:10:22 UTC

- Update `must_use` to use the attribute template (rust-lang/reference#1892)
- Add a rule that enum discriminants may not use generic parameters (rust-lang/reference#2206)
- Actually move out of Box in moving-out-of-Box test (rust-lang/reference#2204)
- Add special cases and links relating to dereferencing boxes (rust-lang/reference#2075)
- Move shebang into its own subchapter (rust-lang/reference#2199)
- Fields of enums and unions should be allowed to overlap (rust-lang/reference#2168)
- [type layout] Clarify size and alignment of pointers to unsized types (rust-lang/reference#2201)
2026-03-23 23:42:52 -04:00
Jacob Pratt 429c8d4ffb Rollup merge of #154017 - GuillaumeGomez:duplicated-locs-scraped, r=Urgau
Fix invalid add of duplicated call locations for the rustdoc scraped examples feature

Fixes rust-lang/rust#153837.

The bug was visible in the highlighting of the scrape examples code samples: the same part of the code was marked as "highlight" (by the scraped examples feature) twice, eventually leading to a wrong state of the HTML DOM status.

To fix the bug, I added a set to not re-add a location if it's already present.

r? @Urgau
2026-03-23 23:42:52 -04:00
Jacob Pratt 8a2bd0fe2f Rollup merge of #153964 - GuillaumeGomez:fix-trait-impl-doc-cfg, r=lolbinarycat
Fix `doc_cfg` not working as expected on trait impls

Fixes https://github.com/rust-lang/rust/issues/153655.

I spent waaaaay too much time on this fix. So the current issue is that rustdoc gets its items in two passes:
1. All items
2. Trait/blanket/auto impls

Because of that, the trait impls are not stored "correctly" in the rustdoc AST, meaning that the `propagate_doc_cfg` pass doesn't work correctly on them. So initially, I tried to "clean" the impls at the same time as the other items. However, it created a monstruous amount of bugs and issues and after two days, I decided to give up on this approach (might be worth fixing that in the future!). You can see what I tried [here](https://github.com/rust-lang/rust/compare/main...GuillaumeGomez:trait-impls-doc_cfg?expand=1).

So instead, since the impls are stored at the end, I create placeholders for impls and in `propagate_doc_cfg`, I store the `cfg` "context" (more clear when reading the code 😛) and re-use it later on when the "real" impl comes up.

r? @lolbinarycat
2026-03-23 23:42:49 -04:00
bors 6f22f61305 Auto merge of #154273 - JonathanBrouwer:rollup-TJZsnIo, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#122668 (Add APIs for dealing with titlecase)
 - rust-lang/rust#153041 (Remove `ATTRIBUTE_ORDER`)
 - rust-lang/rust#153912 (Avoid prematurely choosing a glob import)
 - rust-lang/rust#154093 (const validity checking: do not recurse to references inside MaybeDangling)
 - rust-lang/rust#154257 (Revert eagerly normalize in generalize)
 - rust-lang/rust#154179 (tests/ui/async-await/gat-is-send-across-await.rs: New regression test)
 - rust-lang/rust#154224 (Remove more `BuiltinLintDiag` variants)
 - rust-lang/rust#154245 (Allow applying autodiff macros to trait functions.)
2026-03-23 22:28:18 +00:00
Folkert de Vries 6df99d6523 asm: use minicore more in aarch64/x86_64 asm tests 2026-03-23 22:44:19 +01:00
Eric Huss ae3d87c2a8 Update shebang reference names
This updates the rule names for shebang which were changed in
https://github.com/rust-lang/reference/pull/2192 and
https://github.com/rust-lang/reference/pull/2199.
2026-03-23 14:28:42 -07:00
Guillaume Gomez 73fe4c5a3b Add regression test for #153655 2026-03-23 21:25:46 +01:00
cyrgani 7df43d309c allow incomplete_features in more tests 2026-03-23 20:08:24 +00:00
Jonathan Brouwer a9b484936c Rollup merge of #154245 - ZuseZ4:autodiff-trait-support, r=JonathanBrouwer,jdonszelmann
Allow applying autodiff macros to trait functions.

It will use enzyme to generate a default derivative implementation, which can be overwritten by the user.

closes: https://github.com/rust-lang/rust/issues/153329

r? @JonathanBrouwer
2026-03-23 20:18:36 +01:00
Jonathan Brouwer e158c29ec9 Rollup merge of #154179 - Enselic:gat-is-send-across-await, r=petrochenkov
tests/ui/async-await/gat-is-send-across-await.rs: New regression test

The test began passing in `nightly-2025-10-16`. Probably by c50aebba78 (rust-lang/rust#144064) because it fixed two "does not live long enough" errors. The test fails to compile with `nightly-2025-10-15` with such an error:

    $ rustc +nightly-2025-10-15 --edition 2018 tests/ui/async-await/gat-is-send-across-await.rs
    error: `impl G` does not live long enough
      --> tests/ui/async-await/gat-is-send-across-await.rs:16:24
       |
    16 |       let _: &dyn Send = &async move {
       |  ________________________^
    17 | |         let _gat = g.as_gat();
    18 | |         async{}.await
    19 | |     };
       | |_____^

Closes rust-lang/rust#111852 since that's where the test comes from.
2026-03-23 20:18:35 +01:00
Jonathan Brouwer 7f8f600807 Rollup merge of #154257 - jdonszelmann:revert-eagerly-normalize-in-generalize, r=lcnr
Revert eagerly normalize in generalize

r? @lcnr

Reverts https://github.com/rust-lang/rust/pull/151746

We'll likely pull eager normalization out of generalization

Fixes rust-lang/rust#154173
Fixes rust-lang/rust#154244
2026-03-23 20:18:34 +01:00
Jonathan Brouwer 62a3eab283 Rollup merge of #154093 - RalfJung:validity-maybedangling, r=WaffleLapkin
const validity checking: do not recurse to references inside MaybeDangling

This arguably should be allowed, but we currently reject it:
```rust
#![feature(maybe_dangling)]
use std::mem::MaybeDangling;

const X: MaybeDangling<&bool> = unsafe { std::mem::transmute(&5u8) };
```

r? @WaffleLapkin
2026-03-23 20:18:34 +01:00
Jonathan Brouwer 924b91147b Rollup merge of #153912 - mu001999-contrib:fix-153842, r=petrochenkov
Avoid prematurely choosing a glob import

Fixes rust-lang/rust#153842

Use the following without introducing trait to explain:
```rust
mod a {
    pub use crate::x::y as x; // single import #1
}

mod b {
    pub mod x {
        pub mod y {}
    }
}

use a::x; // single import #2
use b::*; // glob import #3

fn main() {}
```

In current implementation, when `#1` is first resolved, `crate::x` is temporarily taken from glob import `#3` as `crate::b::x`. This happens because `single_import_can_define_name` will see that `#2` cannot define `x` (because it depends on `#1` and `#1` is ignored) and then return `false`. Later, during finalization, `crate::x` in `#1` resolves through single import `#2` instead, which no longer matches the initially cached module `crate::b::x` and triggers the ICE.

I think the resolver should keep this unresolved because `#2` may still define `x` to avoid prematurely choosing a glob import.

r? petrochenkov
2026-03-23 20:18:33 +01:00
Jonathan Brouwer 7011667a9f Rollup merge of #153041 - JonathanBrouwer:attribute_order, r=jdonszelmann
Remove `ATTRIBUTE_ORDER`

r? @jdonszelmann

There's only a few attributes that use `KeepInnermost` and I think I like the consistency of just making them all `KeepOutermost`
2026-03-23 20:18:33 +01:00
bors f66622c7ec Auto merge of #152931 - khyperia:always-check-constarghastype, r=BoxyUwU
Always check `ConstArgHasType` even when otherwise ignoring



fixes https://github.com/rust-lang/rust/issues/149774

helping @BoxyUwU finish up https://github.com/rust-lang/rust/pull/150322, this is a simple tweak/finishing-up of that PR.

this is a breaking change that crater detected has some issues with in Boxy's PR, and hence needs a t-types FCP. I can go and help fix those crates if/once the break is signed off on.
2026-03-23 19:06:58 +00:00
bors eb9d3caf05 Auto merge of #154253 - JonathanBrouwer:rollup-LLZUsz2, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#154241 (`rust-analyzer` subtree update)
 - rust-lang/rust#153686 (`std`: include `dlmalloc` for all non-wasi Wasm targets)
 - rust-lang/rust#154105 (bootstrap: Pass `--features=rustc` to rustc_transmute)
 - rust-lang/rust#153069 ([BPF] add target feature allows-misaligned-mem-access)
 - rust-lang/rust#154085 (Parenthesize or-patterns in prefix pattern positions in pretty printer)
 - rust-lang/rust#154191 (refactor RangeFromIter overflow-checks impl)
 - rust-lang/rust#154207 (Refactor query loading)
 - rust-lang/rust#153540 (drop derive helpers during attribute parsing)
 - rust-lang/rust#154140 (Document consteval behavior of ub_checks, overflow_checks, is_val_statically_known.)
 - rust-lang/rust#154161 (On E0277 tweak help when single type impls traits)
 - rust-lang/rust#154218 (interpret/validity: remove unreachable error kind)
 - rust-lang/rust#154225 (diagnostics: avoid ICE in confusable_method_name for associated functions)
 - rust-lang/rust#154228 (Improve inline assembly error messages)
2026-03-23 15:46:13 +00:00
Jonathan Brouwer 0e4a759501 Fix link_ordinal test 2026-03-23 14:00:22 +01:00
Jonathan Brouwer 34ef9a6146 Remove ATTRIBUTE_ORDER 2026-03-23 13:57:23 +01:00
Jana Dönszelmann e28b48565f add regression test 2026-03-23 12:16:14 +01:00
Jonathan Brouwer 64716caf69 Rollup merge of #154182 - Unique-Usman:ua/constnotype2, r=estebank
diagnostics: avoid ICE for undeclared generic parameter in impl

Avoid an ICE for:

    struct A;
    impl A<B> {}

The compiler no longer panics and can proceed to emit existing diagnostics.

Adds `tests/ui/missing/undeclared-generic-parameter.rs`.

Fixes rust-lang/rust#154165 and introduced by rust-lang/rust#152913
2026-03-23 12:15:00 +01:00
Jonathan Brouwer 82dda891d4 Rollup merge of #154174 - cyrgani:incomplete-mcp, r=JonathanBrouwer
allow `incomplete_features` in most UI tests

This PR allows the `incomplete_features` lint for all UI tests except for the three directories with the largest number of tests (`traits`, `specialization` and `const-generics`) triggering this lint to keep the size of this PR manageable. The remaining three directories will be handled in followup PRs.

Part of https://github.com/rust-lang/rust/issues/154168.
2026-03-23 12:14:59 +01:00
Jonathan Brouwer 364844d8a0 Rollup merge of #154167 - ujjwalvishwakarma2006:move-lto-tests, r=Kivooeo
ui/lto: move and rename two tests from issues/

Move:
- `tests/ui/issues/issue-44056.rs` -> `tests/ui/lto/lto-avx-target-feature.rs`
    - The first test enables both AVX target features and LTO but does not exercise AVX-specific behavior. The test primarily checks that LTO builds successfully with these flags; place it under `ui/lto` for consistency.
- `tests/ui/issues/issue-51947.rs` -> `tests/ui/lto/lto-weak-merge-functions.rs`
    - The second test exercises weak linkage interacting with LTO (merge-functions), so it should belong in `ui/lto`.

I have also added a commented line at the top of each test file indicating the issue it originated from.
2026-03-23 12:14:59 +01:00
Jonathan Brouwer a87d694af2 Rollup merge of #150630 - Mark-Simulacrum:rephrase-compression-warn, r=JonathanBrouwer
Unknown -> Unsupported compression algorithm

Both zstd and zlib are *known* compression algorithms, they just may not be supported by the backend. We shouldn't mislead users into e.g. thinking they made a typo.

cc https://github.com/rust-lang/rust/issues/120953
2026-03-23 12:14:55 +01:00