1704 Commits

Author SHA1 Message Date
Jonathan Brouwer
03f0b69902 Rollup merge of #164165 - FranciscoTGouveia:rustc-show-spans-attr, r=petrochenkov
Add a new `rustc_show_spans` internal attribute

This new internal attribute is a first step for solving rust-lang/rust#126763.

Given the code:
```rust
#![feature(rustc_attrs)]

mod x { pub const Y: u8 = 1; }

macro_rules! path  { ($a:tt, $b:tt) => { let _ = $a::$b; }; }

#[rustc_show_spans(path)]
fn no_macro() { let _ = x::Y; }

#[rustc_show_spans(path)]
fn path_bug() { path!(x, Y); }
```

We can now report the spans and thus show the bug of the span not falling inside the macro context:
```
note: showing the spans of the path
 --> test.rs:8:25
  |
8 | fn no_macro() { let _ = x::Y; }
  |                         ^^^^

note: showing the spans of the path
  --> test.rs:11:23
   |
11 | fn path_bug() { path!(x, Y); }
   |                       ^^^^

```

r? @petrochenkov
2026-10-14 19:29:16 +02:00
Francisco Gouveia
fdefc162fb Add a new rustc_show_spans internal attribute
This new attribute is a first step for solving issue 126763.
Now, we can easily test out where spans end up, particularly useful for
ensuring that spans end up in the best suitable macro context.
2026-10-12 22:41:32 +01:00
Jonathan Brouwer
e3c3417ff6 Rollup merge of #163824 - adamgemmell:dev/adagem01/neon-in-registers, r=davidtwco
aarch64: Use neon registers for ABI on targets that require `neon"

This PR is the aarch64 version of https://github.com/rust-lang/rust/pull/161583.

When a target requires the neon feature (which all `aarch64[_be]` hardfloat targets do), pass any vectors that fit (all sized vectors on aarch64 should do) in those registers.

We also make disable the `neon` target feature a hard error since doing so is much more likely to result in miscompilations as a result of this change, as the previous patch did for SSE.

I've also check the stdarch CI for aarch64-unknown-linux-gnu and aarch64_be-linux-gnu locally with no issues.
2026-10-12 11:30:01 +02:00
Jonathan Brouwer
a2170e9351 Rollup merge of #163956 - Urgau:rustdoc-doctest-scopes, r=GuillaumeGomez
Pass the unremapped path to the `rustc` invocation for doctests

Turns out that `--remap-path-scope` is only half working with doctests, this is because `rustdoc` use a secret environment variable to pass the real filename of the doctest.

However we were only passing a remapped path. That means that doctests source path were getting remapped, but only for one scope: `documentation`. It didn't respect `macro` for `file!` for example.

To fix this, we have to:
 1. pass the local path to the `rustc` invocation
 2. have `rustc` treat that path as a real filename and apply remapping per scope to it
    - I had to add a new `Input` variant, otherwise I can't differentiate normal input `-` from doctests `-` source
 4. we have to pass `--remap-path-{prefix,scope}` to `rustc` so the path actually gets remap properly
2026-10-09 22:07:02 +02:00
Urgau
8f2db6e821 Correctly represent doctest source as a RealFileName plus line 2026-10-08 22:11:13 +02:00
Josh Triplett
a2a68b3692 Don't store VecCache::present when not needed
`VecCache` stores a second set of buckets, `present`, that track the
keys used. This supports simpler iteration over the buckets, when doing
incremental builds, `-Zincremental-verify-ich`, self-profiling, or rustc
debug assertions.

However, when doing a full non-incremental build and *not* doing
verify-ich, self-profiling, or rustc debug assertions, the second set of
buckets are never used, and maintaining them wastes space and
instructions.

Disable that code for that case, and add assertions ensuring `present`
never gets used.

Verifying this requires running a local copy of the perf collector that
does not pass `-Zincremental-verify-ich` on full builds. I ran the
`cargo`, `image`, and `ripgrep` builds locally under both bench and DHAT
profiling, and also ran `aws-sdk-ec2` (1.175.1) as a bench.

aws-sdk-ec2 full check max-rss improved by 62.6 MiB (1.13%).

cargo DHAT peak saved 4.7 MiB (0.74%), max-rss saved 2.6 MiB (0.30%).
image DHAT peak saved 2.3 MiB (1.73%), max-rss saved 1.50 MiB (0.53%).
ripgrep DHAT peak saved 2.02 MiB (3.22%), max-rss saved 1.10 MiB (0.55%).

(Differences in DHAT peak vs max-rss are likely due to allocations vs
actually accessed pages within those allocations. Differences in amount
saved between benchmarks are due to number of queries and number of
buckets needed to hold those queries.)

All of these also improved marginally in instructions executed.
2026-10-06 15:31:29 -07:00
Adam Gemmell
32848d8217 Make disabling neon a hard error 2026-10-06 14:51:14 +01:00
bors
260f1acad9 Auto merge of #163721 - tmiasko:pretty-dataflow, r=Amanieu
Annotate MIR with dataflow results for testing purposes

When requested through an internal rustc attribute, include dataflow
results in MIR output, i.e., `-Zunpretty=mir` or `--emit mir`.

For now, supported dataflows are:
* `#[rustc_mir(rustc_pretty_live_locals)]`
* `#[rustc_mir(rustc_pretty_transitive_live_locals)]`

The mechanism is intended to supersede existing `rustc_peek` intrinsic.
For demonstration also migrates one of tests based on `rustc_peek`:
tests/ui/mir-dataflow/liveness-projection.rs.
2026-10-04 22:32:51 +00:00
tmiasko
3b3e0980a6 Annotate MIR with dataflow results for testing purposes
When requested through an internal rustc attribute, include dataflow
results in MIR output, i.e., `-Zunpretty=mir` or `--emit mir`.

For now, supported dataflows are:
* `#[rustc_mir(rustc_pretty_live_locals)]`
* `#[rustc_mir(rustc_pretty_transitive_live_locals)]`

The mechanism is intended to supersede existing `rustc_peek` intrinsic.
For demonstration also migrates one of tests based on `rustc_peek`:
tests/ui/mir-dataflow/liveness-projection.rs.
2026-10-04 15:12:57 +00:00
sjwang05
add63e4e72 yeet old solver coherence 2026-10-04 04:19:49 -07:00
Esteban Küber
0103c947a5 When compiling without a specified --edition, emit a eprintln message
Use same wording as cargo does when `package.edition` is unspecified.

Do not suggest `--edition=future` on stable.
2026-10-03 18:21:08 +00:00
Jonathan Brouwer
c336759961 Rollup merge of #163336 - Amanieu:move-elimination/tail-copy-to-move, r=tmiasko
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
2026-09-30 10:20:58 +02:00
bors
c1070d6938 Auto merge of #163449 - JonathanBrouwer:rollup-RD7XqTw, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#163327 (remove `MutTy`)
 - rust-lang/rust#162910 (Deterministic encoding of `DefPathHashMap`)
 - rust-lang/rust#163009 (dont store arbitrary parsed attributes in thir)
 - rust-lang/rust#162683 (Use attribute parser for `#[inline()]` attribute check)
 - rust-lang/rust#163429 (lint on `Ident::from_str_and_span` taking a string literal)
 - rust-lang/rust#163431 (Allow `#[repr(simd)]` with `f16b`)
 - rust-lang/rust#163433 (Support also `try-jobs:` to specify custom try jobs)
2026-09-28 15:28:49 +00:00
Jonathan Brouwer
2cc3eebcd2 Rollup merge of #162910 - aerooneqq:det-def-path-hash-map-encoding, r=petrochenkov
Deterministic encoding of `DefPathHashMap`

This PR splits DefPathHashMap into two parts: deterministic (`det_part`) and non-deterministic (`non_det_part`). `det_part` is used while we sure that allocation and insertion order of def ids is deterministic, at the moment of writing it happens before we start parallel checks after prefetch of `hir_crate_items` in `run_required_analysis`. Up until this point of compilation the allocation of def ids and their insertion order into `det_part` should be the same between different compilations.

Next, when non-determinism starts due to parallel compilation we put all mapping between local hash and def ids into a `SortedMap` which gives us ready-to-use sorted by local hash slice of pairs to encode while encoding metadata.

Note, that this PR does not solve the problem of allocation of different def indices to same code entities (meaning same local hash), this problem is solved in rust-lang/rust#162809 by remapping needed local def indices.
Also note that we serialize `det_part` as a raw bytes sequence, so during remapping if we do not place all def indices that are needed to be remapped into separate container we will end up with copying `det_part`, changing some entries in it and then serialize it as a bytes sequence. With the approach in this PR we do not copy and modify `det_part`, instead we do all modifications in `non_det_part`.

r? @petrochenkov
2026-09-28 16:45:09 +02:00
Jonathan Brouwer
773bab3921 Rollup merge of #163303 - nnethercote:fix-Span-eq-ord, r=oli-obk
Remove `PartialOrd`/`Ord` impls for `Span`/`SpanData`

Because they are inconsistent with the `PartialEq`/`Eq` impls, and span ordering is inherently dubious. Details in individual commits.

r? @oli-obk
2026-09-28 14:19:39 +02:00
Jonathan Brouwer
b36d57558d Rollup merge of #163289 - pmur:murp/llvm-stack-size, r=oli-obk
Ensure llvm worker threads have sufficient stack space

The rustc driver sets the default stack size to 16MB, however worker threads spawned by the backend will use std's default stack size (usually 2MB).

Pass through the stack size chosen by the driver to the backend, and explicitly request the stack size.

This probably isn't the preferred way to do this, but maybe a starting point to educate me.

This doesn't catch every spawned thread (jobserver and ctrlc also create them through std). Are there other threads which might be sensitive to small stack sizes?

Fixes rust-lang/rust#163272
2026-09-28 14:19:38 +02:00
Jonathan Brouwer
1c87a25d83 Rollup merge of #163250 - mejrs:hir_imports3, r=JonathanBrouwer
Remove rustc_hir's attribute re-exports

Followup to https://github.com/rust-lang/rust/pull/160336, see also rust-lang/rust#163170, rust-lang/rust#163207 and rust-lang/rust-clippy/pull/17714

Very minor touchups here and there, nothing involving code changes.

r? @JonathanBrouwer
2026-09-27 18:58:12 +02:00
Nicholas Nethercote
4326cf73a3 Remove PartialOrd/Ord impls for Span/SpanData
`Span` and `SpanData` encode four fields: `lo`/`hi`, `ctxt`, and
`parent`. `ctxt` and `parent` have unorderable types.

Both types ignore `ctxt` and `parent` for `PartialOrd`/`Ord`. But their
`PartialEq`/`Eq` impls do *not* ignore those fields. This eq/ord
inconsistency is a bug. It was introduced in #123165.

The idea of ordering spans in general is dubious, because of `ctxt` and
`parent`. But the idea of ordering spans just with `lo`/`hi` is fine.
Therefore, this commit does the following.

- Removes the `PartialOrd`/`Ord` impls for `Span`/`SpanData`

- Adds a `Span::lo_hi` method which can be used in lots of places where
  span locations are involved in sorting. E.g.
  `xs.sort_by_key(|span| span.lo_hi())`

- Adds `OrdSpan`, a newtype around `Span` that impls
  `PartialEq`/`Eq`/`PartialOrd`/`Ord` using `lo_hi`. This is for storing
  spans in ordered types like `BTreeMap<OrdSpan, T>`.

Note also that some `sort`+`dedup` combinations might not remove all
duplicates with the old eq/ord inconsistency. These now all do the right
thing, which could affect some error messages, though in practice
nothing in the test suite is affected.
2026-09-26 09:05:21 +10:00
Daniel Smith
424d9ecb1a Convert crate hash to use metadata instead of HIR 2026-09-25 14:56:26 -04:00
mejrs
564f208ba9 compiler: remove rustc_hir attr re-exports 2026-09-25 18:39:43 +02:00
Paul Murphy
0f125fae31 Ensure llvm worker threads have sufficient stack space
The rustc driver sets the default stack size to 16MB, however
worker threads spawned by the backend will use std's default
stack size (usually 2MB).

Pass through the stack size chosen by the driver to the backend,
and explicitly request the stack size.
2026-09-25 09:22:55 -05:00
Jonathan Brouwer
f0f6653e3b Rollup merge of #159287 - bjorn3:incr_comp_session_from_scratch, r=nnethercote
Build a new incr comp session dir from scratch every time

Rather than copying the old incr comp dir and then modifying it. This saves a copy/hardlink for files that are modified. And it removes the need for accurate work product tracking to avoid accumulating cruft, which is non-trivial. We don't accurately track the pre-LTO bitcode files for ThinLTO for example.

Part of https://github.com/rust-lang/compiler-team/issues/908
2026-09-24 16:05:26 +02:00
bjorn3
5ed0180b64 Build a new incr comp session dir from scratch every time
Rather than copying the old incr comp dir and then modifying it. This
saves a copy/hardlink for files that are modified. And it removes the
need for accurate work product tracking to avoid accumulating cruft,
which is non-trivial. We don't accurately track the pre-LTO bitcode
files for ThinLTO for example.
2026-09-24 12:34:06 +02:00
Amanieu d'Antras
a08787066f Add the experimental -Zmir-move-elimination option 2026-09-23 04:02:23 +01:00
Jonathan Brouwer
e1b8be29ff Rollup merge of #160859 - Jamesbarford:feat/fb16-pt1, r=folkertdev,tgross35
`core::num::f16b` Rust's 16bit Brain Float

Implements the [RFC: f16b type](https://github.com/rust-lang/rfcs/pull/3983). Best reviewed commit by commit, happy to split into separate PRs if that is deemed easier to review. However the line count and surface area is, in my opinion, reasonably small.

Adds;
- ABI plumbing for the `f16b` along with `bfloat` lang item to work with LLVM, GCC is explicitly `unimplemented!(...)`
- `f16b` feature gate, page for `f16b` on libruscdoc and a `struct bf16` in `core::num`
- Tests
- Treat `f16b` as a scalar primitive for scalable vectors

Issues;
- [Tracking Issue](https://github.com/rust-lang/rust/issues/160630)
- [RFC](https://github.com/rust-lang/rfcs/pull/3983)
2026-09-21 15:19:23 +02:00
aerooneqq
0dde918649 Deterministic def path hash map encoding 2026-09-21 14:48:10 +03:00
James Barford-Evans
df1b5c9671 f16b Implementation and documentation 2026-09-21 08:57:51 +01:00
Nicholas Nethercote
30b8dfc353 Remove G generic param from Diag<'_, G>
It encodes the `emit` behaviour, one of:
- `BugAbort`: Abort as a bug.
- `FatalAbort`: Abort as a fatal error.
- `ErrorGuaranteed`: Return an `ErrorGuaranteed` (the default).
- `()`: return `()`.

This is useful but `Diag` is very widely used and it's arguably not
useful enough to be worth the generic parameter. This commit removes it.

Benefits:
- Many fewer generic parameters, including many functions where the
  genericity is entirely uninteresting. This includes every
  `Diagnostic::into_diag` and `Subdiagnostic::add_to_diag`. Removes the
  need for the comment about `<G>` on `trait Diagnostic`.
- No `PhantomData` in `Diag`.
- Makes bootstrapping a bit faster.

The downside is there is no longer a single `emit` method.
- Getting a `!` return type requires calling `emit_bug` or `emit_fatal`.
  This only affects a few call sites.
- Getting an `ErrorGuaranteed` return type requires calling `emit_err`.
  This affects a lot of call sites. (It arguably makes call sites more
  self-documenting.)
- Using the wrong `emit_*` on a diagnostic causes a runtime abort, which
  previously couldn't occur. Seems unlikely, but it's not impossible.
- Note: If no particular return type is needed, `emit` can be used for
  any diagnostic. (Bug/fatal diagnostics will still trigger abort.)
2026-09-21 09:57:42 +10:00
Jonathan Brouwer
1d8d9cadf2 Rollup merge of #162873 - nnethercote:fix-emit_bug, r=mejrs
Adjust `bug!`/`span_bug!` emission

PR rust-lang/rust#161873 moved these macros from `rustc_middle` to `rustc_span`. In doing so it made some undesirable changes.

- The internal `emit_producing_nothing` became public.

- The macros now have different behaviour to function-based ICEs like `dcx.bug(..)` or `dcx.struct_bug(..).emit()`.

This commit reverts those changes. This brings back `Box<dyn Any>` output in a few tests because the panic payload is `ExplicitBug` (which std doesn't know about) rather than `String`. That might be worth fixing again in the future, but if so, it should be done in a way that works with all aborts, not just those done via the macros.

r? @mejrs
2026-09-19 08:45:41 +02:00
Nicholas Nethercote
2598e89f8a Simplify query stack printing
Currently it uses `eprintln!` for the "query stack during panic" header
and "end of query stack" footer and
`struct_failure_note(..).with_span(..).emit()` for the stack frames. The
difference is curious.

Looking more closely:
- failure notes lack a leading label (e.g. no "note: ");
- although the failure note is given a span, the span never renders
  because the `AnnotateSnippetEmitter` used for the query stack has an
  empty source map field;
- the JSON emitter is never involved here.

Therefore, the only difference between using `struct_failure_note` and
`eprintln!` is that the former prints in bold. But boldness for frames
isn't important; indeed, normal backtrace frames don't use bold.

So the commit changes query stack frame printing to use `eprintln!`,
removes some now unnecessary `dcx` arguments, and also removes
`struct_failure_note`. That leaves "For more information about an error,
try `rustc --explain {}`" as the only use of `FailureNote`.
2026-09-18 18:47:07 +10:00
Nicholas Nethercote
0e617d448a Adjust bug!/span_bug! emission
PR #161873 moved these macros from `rustc_middle` to `rustc_span`. In
doing so it made some undesirable changes.

- The internal `emit_producing_nothing` became public.

- It gave the macros different behaviour to function-based ICEs like
  `dcx.bug(..)` or `dcx.struct_bug(..).emit()`.

- `ExplicitBug` is not used, so `report_ice` prints an extraneous,
  unintended "the compiler unexpectedly panicked" message.

- It broke the interaction between `span_bug!` and
  `-Ztrack-diagnostics`.

This commit adjusts things to avoid the undesirable changes. It required
moving `ExplicitBug` to `rustc_span`. Setting `diag.emitted_at` fixed
the `-Ztrack-diagnostics` problem, seen in the change from `callback.rs`
to `validate.rs` in `track7.stderr`.

`Box<dyn Any>` output now occurs again in a few tests because the panic
payload is `ExplicitBug` (which std doesn't know about) rather than
`String`. That might be worth addressing in the future but it would
require a different/additional mechanism and is beyond the scope of this
PR.
2026-09-18 15:44:23 +10:00
bors
498b89dd40 Auto merge of #161583 - RalfJung:x86-sse-abi, r=nikic
x86: on targets that requires SSE, use those registers for ABI



Now that https://github.com/llvm/llvm-project/issues/142321 is fixed, we can use the vector ABI without re-introducing https://github.com/rust-lang/rust/issues/139029. So this effectively reverts https://github.com/rust-lang/rust/pull/141309.

Since this means we are relying on the SSE target feature for the Rust ABI, we also need to turn the ABI target feature check into a hard error. If we don't do that, we'll get post-mono errors in some situations and plain miscompilations in others.

Also this will cause performance regressions on LLVM 22 and 21 as those don't have the fix for  https://github.com/llvm/llvm-project/issues/142321. IMO that's fine. Programs will do the right thing, they will just be a bit slower due to https://github.com/rust-lang/rust/issues/139029.

r? @nikic 
Cc @tgross35
2026-09-18 04:48:34 +00:00
Jonathan Brouwer
8297751077 Rollup merge of #162366 - TheHighestBit:copy-on-finalize-error, r=bjorn3
Replace hard linked `metadata.rmeta` with a copy when finalizing the incremental compilation session dir fails

Fixes rust-lang/rust#151181.

Since 1.90.0, on ReFS (Windows Dev Drive) volumes finalizing the incremental compilation session directory would fail with `Access is denied. (os error 5)`. The issue was caused by rust-lang/rust#114669, which meant that `metadata.rmeta` inside the session dir was a hard link to a file that was potentially being used by several other processes and ReFS seemingly refuses to rename such directories.  As a fallback, we try to replace the hard linked metadata file with a copy instead, so that the rename can succeed.

I don't think adding a test for this is possible due to the lack of a ReFS runner but I added a unit test for the `replace_hard_link_with_copy` helper.

r? @bjorn3
2026-09-17 21:00:08 +02:00
Ralf Jung
429c1c18ca x86: on targets that requires SSE, use those registers for ABI 2026-09-17 08:03:01 +02:00
Joosep Orasmäe
0bae8cff69 Move metadata work product name into a constant 2026-09-16 20:15:22 +03:00
Nicholas Nethercote
81210c9d79 Change CodegenBackend::init to take &mut self
It currently takes `&self`, which is a bit strange for an `init` method.
As a result, the Cranelift and GCC backends have to use types with
interior mutability.

This commit changes it to `&mut self`. Benefits:

- The Cranelift backend can use `Option` instead of `OnceCell` to
  indicate uninit vs. init.

- The GCC backend can avoid `Mutex`, and use `bool` instead of
  `AtomicBool`, which makes things much simpler. The commit also
  restructures `GccCodegenBackend` to mirror `CraneliftCodegenBackend`:
  just contain an `Option<BackendConfig>`, which makes the uninit vs.
  init distinction foolproof. (E.g. no need to set `lto_supported` to
  false and then later overwrite it with the real value.) As part of
  this the `LockedTargetInfo` type is renamed `SharedTargetInfo` because
  that better matches its new internals. (All this compiles both with
  and without the "master" feature set.)
2026-09-16 15:29:44 +10:00
Nicholas Nethercote
51673f89e1 Split build_session
Session creation is currently awkward: we build a mostly-initialized
session, then use it to initialize a codegen backend, and then use the
codegen backend to finish initializing the session.

And it's not just awkward: within the Cranelift backend's `init` method
`sess.lto()` is called, which consults `sess.thin_lto_supported`,
*before* that field has been properly set! In practice it had no effect
but it's worth fixing.

This commit cleans up this mess. It introduces `EarlySession`, which
contains just four `Session` fields, the ones that are needed for
codegen backend initialization. It is now a field within `Session`, and
`Session` derefs to `EarlySession` to avoid changing a zillion
`sess.target`/`sess.opts`/etc. occurrences. `EarlySession` is passed to
`init`, which returns a `CodegenBackendInit` that contains the
backend-specific information needed to build a `Session`. (It replaces
the `replaced_intrinsics`, `fallback_intrinsics`, and
`thin_lto_supported` methods.) The `Session` can then be built in a
single step. No more `Session`/`CodegenBackend` initialization
intermingling.

A few functions that previously took a `Session` now take something
else, e.g. a `Target`. Some `Session` methods are now `EarlySession`
methods. And a new `early_lto` method is used for Cranelift's LTO check.
2026-09-16 15:29:42 +10:00
Jonathan Brouwer
a6a54687e5 Rollup merge of #161873 - mejrs:bug, r=tiif
move bug and span_bug macros to rustc_span

This allows them to be used without depending on rustc_middle.

This is done by using a rustc_interface callback so that, if the callback is set, a internal compiler error diagnostic is printed through that. After that the panic is initiated.

r? @jdonszelmann @bjorn3
2026-09-15 23:26:55 +02:00
mejrs
784649bf5f use rustc_interface callback to emit span_bug diagnostic 2026-09-15 16:20:16 +02:00
Stuart Cook
a7dfc4fe5e Rollup merge of #160585 - durin42:rustc-reject-sanitizer-proc-macro, r=TaKO8Ki
diagnostics: reject sanitizer compiles of proc-macro

We discussed this at the project all hands way back in May, and I'm only just now getting to it. Since proc-macros get loaded into rustc, it's not helpful to try and compile them in a sanitizer mode because you'll most likely end up with incompatible uses of things like the sanitizer runtimes.
2026-09-15 21:43:53 +10:00
bjorn3
e525d70b9f Avoid panic when metadata encoder is called with errors
And remove the encoded metadata if there are any errors or delayed bugs
after encoding.
2026-09-10 09:40:29 +02:00
bors
dbad1bab60 Auto merge of #162105 - Zalathar:arena-cache, r=nnethercote
Avoid the `arena_cache` modifier for several queries



The `arena_cache` query modifier is convenient, but we can potentially avoid some overhead by allocating values into the central `tcx.arena` when possible.

There should be no change to compiler output.
2026-09-06 02:32:06 +00:00
bors
f207aa3913 Auto merge of #162333 - Zalathar:rollup-DdpfsFl, r=Zalathar
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#162324 (miri subtree update)
 - rust-lang/rust#162170 (bootstrap: use target's LLVM libdir when cross-compiling)
 - rust-lang/rust#158312 (Adds support for AArch64 SVE to inline assembly)
 - rust-lang/rust#159792 (A more readable debug map for IndexMaps)
 - rust-lang/rust#160745 (make closures act like MaybeDangling)
 - rust-lang/rust#161263 (break rustc_expand-rustc_middle dependency)
 - rust-lang/rust#161895 (std::sys::pal::sgx: fix mismatched alloc/free alignment)
 - rust-lang/rust#161940 (Promote `wasm32-wasip3` to a tier 2 target)
 - rust-lang/rust#161397 (coverage: Tidy tests and add some new ones)
 - rust-lang/rust#161616 (Report precondition violation for `<usize as SliceIndex>::get_unchecked` in const-eval)
 - rust-lang/rust#162248 (Add regression test for unsized const parameter default ICE)
 - rust-lang/rust#162250 (Fix hashing of span end columns in incremental compilation)
 - rust-lang/rust#162265 (cargotest: add lockfiles)
 - rust-lang/rust#162318 (bootstrap: Fix broken path for `./x doc compiler/rustc --open`)
2026-09-05 17:04:57 +00:00
Zalathar
be58a505e5 Remove an existing out-of-line impl of Arena::alloc_os_str 2026-09-06 00:35:47 +10:00
mejrs
297c72a614 break rustc_expand-rustc_middle dependency 2026-09-05 02:17:36 +02:00
Jonathan Brouwer
1ac8991699 Rollup merge of #162277 - nnethercote:rustc_middle-resolution, r=petrochenkov
Introduce `rustc_middle::middel::resolve`

There are various types used to carry name resolution results across crate boundaries. They are scattered across places like `rustc_middle::ty`, `rustc_middle::metadata`, and `rustc_hir::def`.

This commit moves them into the new module, a more logical place for them to live. As part of this it eliminates the small `rustc_middle::metadata` module.

One nice consequence of this change: it removes the single use of a `LocalDefId` in `rustc_ast`. (This is what got my attention in the first place.)

r? @petrochenkov
2026-09-04 22:29:01 +02:00
Ralf Jung
2fa835fc72 make -Ctarget-feature warnings more explicitly FCWs 2026-09-04 08:22:14 +02:00
Nicholas Nethercote
1545557cd2 Introduce rustc_middle::middel::resolve
There are various types used to carry name resolution results across
crate boundaries. They are scattered across places like
`rustc_middle::ty`, `rustc_middle::metadata`, and `rustc_hir::def`.

This commit moves them into the new module, a more logical place for
them to live. As part of this it eliminates the small
`rustc_middle::metadata` module.

One nice consequence of this change: it removes the single use of a
`LocalDefId` in `rustc_ast`. (This is what got my attention in the first
place.)
2026-09-04 15:44:05 +10:00
Jonathan Brouwer
36b19a5167 Rollup merge of #161280 - RalfJung:abi-required-target-feature-arm, r=davidtwco
make target feature ABI check a hard error on ARM

With LLVM 24, we now (finally) get hard errors from the backend for "you want ABI X but the target features required for that ABI are missing", at least on the ARM backend:
```
error: <unknown>:0:0: in function _RNvXsc_Cs4Af2OiBEA1T_8minicoreiNtB5_3Add3add i32 (i32, i32): calling convention is hard-float, but floating-point registers are unavailable
```
That's not a pretty error, so let's make rust emit a hard error before we even get there -- just on ARM for now, matching LLVM. We have emitted a future-compat error for this since Rust 1.86 (https://github.com/rust-lang/rust/pull/136147, https://github.com/rust-lang/rust/pull/134794). I'm not making it a hard error everywhere since for other targets we are still figuring out the exact things we have to check, and it's better to do that without risking new hard errors.

For ARM, the exact check we are doing is:
- every target must set `llvm_floatabi` to either "soft" or "hard"
- on softfloat targets, no check is needed
- on hardfloat targets, the "fpregs" target feature is *required* and the the "soft-float" target feature is *forbidden*

Since this is a new hard error, this probably requires FCP. I am not sure for which team -- @rust-lang/lang is often involved for target feature things, but this is mostly about rejecting invalid `-C` flags which are handled by t-compiler (@davidtwco @BoxyUwU).

Fixes https://github.com/rust-lang/rust/issues/161276
Tracking issue rust-lang/rust#116344
Cc @TimNN
2026-09-03 20:02:51 +02:00
Jonathan Brouwer
198bd21de8 Rollup merge of #161971 - hanna-kruppe:rm-flag-satfpcast, r=RalfJung
Remove -Zsaturating-float-casts flag

I added this flag back in 2017 (rust-lang/rust#45205) to enable benchmarking of the saturating semantics when it was newly implemented and still experimental. But saturation has been the official semantics for float<->int `as` casts for years now. A flag for turning it off no longer serves any purpose, it's just `-Zplease-miscompile-casts` now.
2026-09-01 21:26:14 +02:00