Commit Graph

321916 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 4783d35218 Rollup merge of #154216 - airblast-dev:main, r=tgross35
unstably mark `NonNull::with_exposed_provenance` as const

Feature: `const_nonnull_with_exposed_provenance`
Tracking issue: https://github.com/rust-lang/rust/issues/154215

This PR constifies `NonNull::with_exposed_provenance`.

r? @tgross35
2026-03-25 19:52:58 +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 997493114f Rollup merge of #151148 - Jarcho:gbit_set, r=davidtwco
Add functions to `GrowableBitSet`

Only really need `insert_range` for clippy, but may as well add the others. Using `Range` instead of `RangeBounds` since an end bound is needed for this to make sense and there aren't any traits to enforce that.
2026-03-25 19:52:56 +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 8dfc5edc38 Rollup merge of #154351 - nnethercote:overhaul-Erasable-impls, r=petrochenkov
Overhaul `Erasable` impls

This PR removes many unused `Erasable` impls, converts many of the hand-written impls to macro-generated impls, and sorts the macro's inputs. This cuts over 200 lines of code and fixes three FIXME comments.

r? @petrochenkov
2026-03-25 19:52:55 +01:00
Jonathan Brouwer 908fae7efb Rollup merge of #154348 - ZuseZ4:autodiff-apple, r=Kobzol
re-enable enzyme/autodiff builds on dist-aarch64-apple

Now that https://github.com/rust-lang/rust/pull/151063/ has landed, re-enable enzyme.

cc @sgasho

r? @kobzol
2026-03-25 19:52:54 +01:00
Jonathan Brouwer d0fcb41318 Rollup merge of #154344 - dianqk:update-llvm, r=nikic
Update LLVM to 22.1.2

Fixes https://github.com/rust-lang/rust/issues/154101.
2026-03-25 19:52:53 +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 b5e4b4ca79 Rollup merge of #154269 - RalfJung:miri-recursive-shallow, r=saethlin
miri recursive validation: only check one layer deep

As has been proposed in https://github.com/rust-lang/unsafe-code-guidelines/issues/414, let's see what happens if we make recursive checking in Miri shallow: we treat whatever is behind a reference as if it was inside `MaybeDangling`, which means nested references do not have to be dereferenceable.

This changes the meaning of the original flag -- I don't think it is worth supporting multiple variants of recursive checking (it'd require a bunch of new plumbing), and this seems to be the strictest variant that still has any traction in the discussion.
2026-03-25 19:52:52 +01:00
Jonathan Brouwer 27f9b7ca59 Rollup merge of #154263 - RalfJung:interpret-arg-passing-spans, r=oli-obk
interpret: when passing an argument fails, point at that argument

For a long time now, we did some contortions so that when something goes wrong while initializing the arguments for a function, we point at the call site rather than the callee. Historically, this had to be done because the "current location" in the callee pointed at the first instruction, which would obviously be nonsense. A while ago we gained the ability in the interpreter for the "current location" to be just a span that we point at for errors, but we never reevaluated the decision for how spans are handled during function calls. (We did use this "just a span" location for [errors during the initial stack frame setup](https://github.com/rust-lang/rust/commit/d21e0118d0eefc8b0073fa47fa16699d37047abf), but not for argument initialization.)

There's no always-great choice for pointing at the caller vs the callee: when they disagree about the type of an argument, either side could be wrong. If We do *two* typed copies in that case, one at the caller type and one at the callee type. Arguably we should point at the one that goes wrong, but we don't have a good way to expose that.

What ultimately pushed me over the edge towards pointing at the callee are two points:
- This provides strictly more information. if we point at the callee, the caller is available in the stacktrace. But if we point at the caller, then it might be impossible to figure out the actual callee if a function pointer or dyn call is involved.
- As part of resolving some long-standing questions around retags I am moving retagging to become part of validation, which means the retag and protector initialization of function arguments will happen during argument initialization. These currently point at the argument inside the callee, which I think is strictly preferable for these errors.

The diff will be much smaller with whitespace changes hidden.
2026-03-25 19:52:51 +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
bors 64d5cb603b Auto merge of #149218 - theemathas:pin-coerce-unsized, r=oli-obk
Make PinCoerceUnsized require Deref



Also, delete impls on non-Deref types.

Pin doesn't do anything useful for non-Deref types, so PinCoerceUnsized on such types makes no sense.

This is a breaking change, since stable code can observe the deleted `PinCoerceUnsized` impls by uselessly coercing between such types inside a `Pin`.

There is still some strange behavior, such as `Pin<&mut i32>` being able to coerce to `Pin<&dyn Send>`, but not being able to coerce to `Pin<&i32>`. However, I don't think it's possible to fix this.

Fixes https://github.com/rust-lang/rust/issues/145081
2026-03-25 13:07:28 +00:00
Manuel Drehwald 988633d72c re-enable enzyme/autodiff builds on dist-aarch64-apple 2026-03-25 12:37:03 +01: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
Nicholas Nethercote 4f03262c8a Use impl_erasable_for_types_with_no_type_params! even more.
Some of the hand-written `Erasable` impls only match a single type in
practice. It's easier to just list the concrete types in
`impl_erasable_for_types_with_no_type_params!`.
2026-03-25 16:11:24 +11:00
Nicholas Nethercote dce1805599 Use impl_erasable_for_simple_types! more, and rename it.
Now that 'static lifetimes aren't used, a lot of the hand-written
`Erasable` impls can now be done with the macro. (The only ones that
can't are those with a generic type parameter, because `size_of`
doesn't work in that case.)

Also, `impl_erasable_for_single_lifetime_types!` isn't needed at all.
2026-03-25 16:08:00 +11:00
Theemathas Chirananthavat f55c8cca4c Rewrite safety comment for PinCoerceUnsized 2026-03-25 11:40:27 +07:00
Theemathas Chirananthavat 1e4c1d6f75 Make PinCoerceUnsized require Deref
Also, delete impls on non-Deref types.

Pin doesn't do anything useful for non-Deref types, so PinCoerceUnsized
on such types makes no sense.

This is a breaking change, since stable code can observe the deleted
`PinCoerceUnsized` impls by uselessly coercing between such types
inside a `Pin`.

There is still some strange behavior, such as `Pin<&mut i32>` being
able to coerce to `Pin<&dyn Send>`, but not being able to coerce to
`Pin<&i32>`. However, I don't think it's possible to fix this.

Fixes https://github.com/rust-lang/rust/issues/145081
2026-03-25 11:40:27 +07:00
Nicholas Nethercote efd36a4897 Avoid 'static in Erasable impls.
Using '_ removes unnecessary differences between the impl type and the
associated `Storage` type.
2026-03-25 14:29:10 +11:00
Nicholas Nethercote 2fde4f4210 Adjust some Erasable impls.
A few can be done with the `impl_erasable_for_single_lifetime_types!`
macro instead of being hand-written.
2026-03-25 14:27:45 +11:00
Nicholas Nethercote 289932194a Avoid unnecessary qualification of ErrorGuaranteed.
It's imported and can be used directly within this file, and already is
in a few places.
2026-03-25 14:27:45 +11:00
Nicholas Nethercote 833bf3c375 Sort impl_erasable_* macro calls. 2026-03-25 14:27:45 +11:00
Nicholas Nethercote 8ab0c4cbf3 Remove unused Erasable impls.
There are many!
2026-03-25 14:27:43 +11:00
dianqk 283d705b31 Update LLVM to 22.1.2 2026-03-25 07:32:01 +08: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
Jonathan Brouwer d54a564510 Rollup merge of #154336 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Remove more BuiltinLintDiag variants - part 3

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

Last part of the "easy" migration.

r? @JonathanBrouwer
2026-03-24 22:36:57 +01:00
Jonathan Brouwer 22f3a5dd29 Rollup merge of #154331 - cyrgani:incomplete-3, r=JonathanBrouwer
allow `incomplete_features` in all ui tests

This PR allows the `incomplete_features` lint for the `specialization` directory, thereby allowing it for all UI tests.

Followup to rust-lang/rust#154174 and rust-lang/rust#154276.
Closes https://github.com/rust-lang/rust/issues/154168.
2026-03-24 22:36:57 +01:00
Jonathan Brouwer f9f6c97d8b Rollup merge of #154311 - GuillaumeGomez:fix-integer-doc-cfg, r=eggyal,tgross35
[libcore] Disable `doc(auto_cfg)` for integers trait impls

Fixes rust-lang/rust#153655.

Thanks to https://github.com/rust-lang/rust/pull/153964, `doc(auto_cfg)` finally works as expected on impls. So now this fix works:

<img width="1000" height="806" alt="image" src="https://github.com/user-attachments/assets/f37da375-c2eb-4a7b-abf2-1fdd3a73e2bb" />

cc @eggyal
2026-03-24 22:36:56 +01:00
cyrgani 97e84d5a56 allow incomplete_features in all ui tests 2026-03-24 20:00:26 +00:00
Guillaume Gomez c17dec615d Remove BuiltinLintDiag usage in rustc_metadata 2026-03-24 19:45:17 +01: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
Alice Ryhl 4d86840bf1 Document kernel-hwaddress in Unstable Book 2026-03-24 17:46:20 +00:00
Alice Ryhl 422906d57e Do not check for LEAK & KERNELHWADDRESS because they are incompatible 2026-03-24 17:39:46 +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 65097900fd Rollup merge of #152710 - Zalathar:unalign-fingerprint, r=fmease
Unalign `PackedFingerprint` on all hosts, not just x86 and x86-64

Back in https://github.com/rust-lang/rust/pull/78646, `DepNode` was modified to store an unaligned `PackedFingerprint` instead of an 8-byte-aligned `Fingerprint`. That reduced the size of DepNode from 24 bytes to 17 bytes (nowadays 18 bytes), resulting in considerable memory savings in incremental builds.

See https://github.com/rust-lang/rust/pull/152695#issuecomment-3907091509 for a benchmark demonstrating the impact of *removing* that optimization.

At the time (and today), the unaligning was only performed on x86 and x86-64 hosts, because those CPUs are known to generally have low overhead for unaligned memory accesses. Hosts with other CPU architectures would continue to use an 8-byte-aligned fingerprint and a 24-byte DepNode.

Given the subsequent rise of aarch64 (especially on macOS) and other architectures, it's a shame that some commonly-used builds of rustc don't get those memory-size benefits, based on a decision made several years ago under different circumstances.

We don't have benchmarks to show the actual effect of unaligning DepNode fingerprints on various non-x86 hosts, but it seems very likely to be a good idea on Apple chips, and I have no particular reason to think that it will be catastrophically bad on other hosts. And we don't typically perform this kind of speculative pessimization in other parts of the compiler.
2026-03-24 18:14:14 +01:00
bors 63154b7b47 Auto merge of #154316 - JonathanBrouwer:rollup-qSafo91, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#154094 (add neon load/store assembly test)
 - rust-lang/rust#154142 (Delegation: eliminate usage of AST from generics creation)
 - rust-lang/rust#154276 (allow `incomplete_features` in more tests)
 - rust-lang/rust#154284 (doc: linker-plugin-based LTO: update list of good combinations)
 - rust-lang/rust#154286 (Cherry-pick 1.94.1 release notes)
 - rust-lang/rust#154303 (Remove more `BuiltinLintDiag` variants - part 2)
2026-03-24 15:25:04 +00:00
Jonathan Brouwer a5327061eb Rollup merge of #154303 - GuillaumeGomez:migrate-diag2, r=JonathanBrouwer
Remove more `BuiltinLintDiag` variants - part 2

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

r? @JonathanBrouwer
2026-03-24 16:22:52 +01:00