Subtree sync for rustc_codegen_cranelift
The main highlights this time are a bunch of inline asm fixes for graviola and a Cranelift update.
r? @ghost
@rustbot label +A-codegen +A-cranelift +T-compiler +subtree-sync
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
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
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
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
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.
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.
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. Fixesrust-lang/rust#153433. Fixesrust-lang/rust#153499. Part of rust-lang/rust#118212.
r? @petrochenkov
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
Defer codegen for the VaList Drop impl to actual uses
This allows compiling libcore with codegen backends that don't actually implement VaList like cg_clif.
fix/extend some mir-opt comments
Looks like CopyProp was refactored without updating that comment.
And for GVN, I think this is what you had in mind @cjgillot but would be great if you could have a look.
Defer codegen for the VaList Drop impl to actual uses
This allows compiling libcore with codegen backends that don't actually implement VaList like cg_clif.
Use a safe `BucketIndex` abstraction in `VecCache`
The current code for indexing into bucket arrays is quite tricky and unsafe, partly because it has to keep manually assuring the compiler that a bucket index is always less than 21.
By encapsulating that knowledge in a 21-value enum, we can make the code clearer and safer, without giving up performance.
Having a dedicated `BucketIndex` type could also help with further cleanups of `VecCache` indexing.
Link LLVM dynamically on aarch64-apple-darwin
Follow-up to rust-lang/rust#152768.
* Link LLVM dynamically on MacOS
* Fix a macOS LLVM dylib name mismatch
The current code for indexing into bucket arrays is quite tricky and unsafe,
partly because it has to keep manually assuring the compiler that a bucket
index is always less than 21.
By encapsulating that knowledge in a 21-value enum, we can make the code
clearer and safer, without giving up performance.
Having a dedicated `BucketIndex` type could also help with further cleanups of
`VecCache` indexing.
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)