rustc_codegen_cranelift subtree update
Subtree update of `rustc_codegen_cranelift` to 05409775ad.
Created using https://github.com/rust-lang/josh-sync.
r? @ghost
@rustbot label +A-codegen +A-cranelift +T-compiler +subtree-sync
update deferred subtype test
The previous test relied on the order in which we evaluate obligations and started to fail with the new solver because we also emitted `Subtype(?z, ?y)` obligations. The new solver makes these steps invariant, which changes this test to only check
This breakage is tracked as part of fd79fd8cde/notes/stabilization-report/meta.md (eagerly-evaluating-nested-goals) but feels very artificial to me and is something I don't care about.
cc @rust-lang/types
r? types
MIR move elimination [2/6]: TailCopyToMove
Depends on rust-lang/rust#163335
This PR implements a pre-pass for the `MoveElimination` pass from https://github.com/rust-lang/rfcs/pull/3943.
`TailCopyToMove` turns `Copy` into `Move` just before a `Return` terminator. This is valid even for places that have been borrowed because the `Return` will invalidate borrows anyway. This is necessary to allow the source of the copy to be unified with the return place.
r? tmiasko
arch::breakpoint: update docs
Update the docs to remove the guaranteed abort, since the LLVM intrinsic we compile this to does not actually make such a guarantee -- for instance, on old ARM systems, no abort may be triggered. If a headless x86 system makes the BR interrupt a NOP, no abort will happen either, and we haven't decided that that is an invalid configuration.
Also see the extensive discussion that was summarized in https://github.com/rust-lang/rust/issues/162953.
Tracking issue: https://github.com/rust-lang/rust/issues/133724.
Cc @joshtriplett
Rollup of 4 pull requests
Successful merges:
- rust-lang/rust#163024 (Add `Dir` equivalents of `fs::metadata` & `fs::symlink_metadata`)
- rust-lang/rust#162839 (Bump min Emscripten version to 4.0, drop deprecated -sWASM_BIGINT for wasm32-unknown-emscripten)
- rust-lang/rust#163370 (Fix incorrect typo suggestion for `struct field` shorthands)
- rust-lang/rust#163471 (do not suggest capturing `'_` twice in `use<...>` for E0700)
Allow writing
```rust
struct Diagnostic {
#[primary_span]
#[label("label text")]
span: Span,
#[context]
context: Span,
}
```
So that the code pointed at by `context` is shown in the rendered diagnostic without an underline.
do not suggest capturing `'_` twice in `use<...>` for E0700
starting from `use<'_>` with a second anonymous lifetime to capture, E0700 suggests `use<'_, '_>`. that fails with:
```
error: cannot capture parameter `'_` twice
```
then the compiler suggests `use<'_, '_, '_>`. both `AddPreciseCapturing::New` and `AddPreciseCapturing::Existing` are `machine-applicable` (rustc_trait_selection/src/diagnostics.rs:1876 and :1888) so rustfix applies the broken edit.
the branch for an opaque without `use<..>` already skips lifetimes that are captured. this adds the same check to the branch for an existing `use<..>`.
the issue repro compiles clean on edition 2024 and needs 2021 so the test starts one step in with `use<'_>` already written. two extra cases check the guard stays narrow: `use<>` with one anonymous lifetime still gets `use<'_>` and a named lifetime still gets suggested by name.
one note. the guard removes the suggestion without replacing it so someone who already wrote `use<'_>` gets no path forward. a correct suggestion needs to name the elided lifetimes and suggest_precise_capturing cannot do that today. that the multipart suggestion this issue asks for will be the follow up.
https://github.com/rust-lang/rust/issues/132199
r? @oli-obk
Fix incorrect typo suggestion for `struct field` shorthands
Fixesrust-lang/rust#163324
by passing the field `Ident` to the suggestion builder to correctly expand unresolved struct shorthands.
r? @maxdexh
Bump min Emscripten version to 4.0, drop deprecated -sWASM_BIGINT for wasm32-unknown-emscripten
This documents Emscripten 4.0.0 as the minimum supported version, and removes the on-by-default `-sWASM_BIGINT` link argument from the `wasm32-unknown-emscripten` target spec.
`WASM_BIGINT` has been enabled by default since Emscripten 4.0.0 (January 2025), and newer Emscripten versions now emit a deprecation warning whenever it is set explicitly (emscripten-core/emscripten#27558), so every link through rustc currently produces a warning. Since Emscripten's warning categories are not fine-grained enough to suppress this one setting without also disabling `-Wdeprecated` in general, the cleanest fix is to drop the flag and rely on the default.
* `-sWASM_BIGINT` removed from the target's post-link args (`-sABORTING_MALLOC=0` is retained)
* Platform support docs updated to state the Emscripten 4.0.0 minimum, with the install snippet using `latest` rather than pinning 3.1.68
Rust CI already installs the latest Emscripten release, so no CI changes are needed. Users on Emscripten < 4.0.0 who rely on the prebuilt `std` would need to upgrade or pass `-C link-arg=-sWASM_BIGINT` explicitly.
Add `Dir` equivalents of `fs::metadata` & `fs::symlink_metadata`
This adds methods to `Dir` that allow querying the metadata of files/directories relative to a `Dir`. Miri would [really like](https://github.com/rust-lang/miri/issues/5327) to be able to do this so I figured I'd give it a shot. :)
The first commit refactors the Unix `DirEntry` methods a bit with `cfg_select` to avoid repeating the `cfg` condition.
Tracking issue: https://github.com/rust-lang/rust/issues/120426
try-jobs: test-x86_64-msvc-1
Specialize `advance_back_by` like the forward version
We specialized `advance_by` in rust-lang/rust#141086, so it makes sense to have
`advance_back_by` use the same trick in reverse, i.e. `try_rfold`.
This also updates `nth_back` to mirror `nth`, and the rest of the
`DoubleEndedIterator` methods already match `Iterator`.