Sync cg clif 2024 12 06
The main highlights this time are a Cranelift update disabling the clif ir verifier by default for better performance.
r? `@ghost`
`@rustbot` label +A-codegen +A-cranelift +T-compiler
Rollup of 5 pull requests
Successful merges:
- #130777 (rust_for_linux: -Zreg-struct-return commandline flag for X86 (#116973))
- #133211 (Extend Miri to correctly pass mutable pointers through FFI)
- #133790 (Improve documentation for Vec::extend_from_within)
- #133930 (rustbook: update to use new mdbook-trpl package from The Book)
- #133931 (Only allow PassMode::Direct for aggregates on wasm when using the C ABI)
r? `@ghost`
`@rustbot` modify labels: rollup
Only allow PassMode::Direct for aggregates on wasm when using the C ABI
For the Rust ABI we don't have any ABI compat reasons to allow PassMode::Direct for aggregates.
rustbook: update to use new mdbook-trpl package from The Book
Updates to the latest merge from `rust-lang/book` and simplifies the dependency chain there. There are now three preprocessors, but only one package, so everything is a lot nicer to deal with from the consuming POV (i.e. here).
Extend Miri to correctly pass mutable pointers through FFI
Based off of https://github.com/rust-lang/rust/pull/129684, this PR further extends Miri to execute native calls that make use of pointers to *mutable* memory.
We adapt Miri's bookkeeping of internal state upon any FFI call that gives external code permission to mutate memory.
Native code may now possibly write and therefore initialize and change the pointer provenance of bytes it has access to: Such memory is assumed to be *initialized* afterwards and bytes are given *arbitrary (wildcard) provenance*. This enables programs that correctly use mutating FFI calls to run Miri without errors, at the cost of possibly missing Undefined Behaviour caused by incorrect usage of mutating FFI.
> <details>
>
> <summary> Simple example </summary>
>
> ```rust
> extern "C" {
> fn init_int(ptr: *mut i32);
> }
>
> fn main() {
> let mut x = std::mem::MaybeUninit::<i32>::uninit();
> let x = unsafe {
> init_int(x.as_mut_ptr());
> x.assume_init()
> };
>
> println!("C initialized my memory to: {x}");
> }
> ```
> ```c
> void init_int(int *ptr) {
> *ptr = 42;
> }
> ```
> should now show `C initialized my memory to: 42`.
>
> </details>
r? ``@RalfJung``
rust_for_linux: -Zreg-struct-return commandline flag for X86 (#116973)
Command line flag `-Zreg-struct-return` for X86 (32-bit) for rust-for-linux.
This flag enables the same behavior as the `abi_return_struct_as_int` target spec key.
- Tracking issue: https://github.com/rust-lang/rust/issues/116973
If a type has unsafe fields, its safety invariants are not simply
the conjunction of its field types' safety invariants. Consequently,
it's invalid to reason about the safety properties of these types
in a purely structural manner — i.e., the manner in which `auto`
traits are implemented.
Makes progress towards #132922.
Rollup of 8 pull requests
Successful merges:
- #132155 (Always display first line of impl blocks even when collapsed)
- #133256 (CI: use free runners for i686-gnu jobs)
- #133607 (implement checks for tail calls)
- #133821 (Replace black with ruff in `tidy`)
- #133827 (CI: rfl: move job forward to Linux v6.13-rc1)
- #133910 (Normalize target-cpus.rs stdout test for LLVM changes)
- #133921 (Adapt codegen tests for NUW inference)
- #133936 (Avoid fetching the anon const hir node that is already available)
r? `@ghost`
`@rustbot` modify labels: rollup