Commit Graph

340219 Commits

Author SHA1 Message Date
Manuel Drehwald
4f20be3135 also drop now unused host.o 2026-09-22 16:50:51 -04:00
Manuel Drehwald
9b9cb70640 Stop embedding device code, now that the clang-linker-wrapper isn't consuming it anymore 2026-09-22 16:44:04 -04:00
bors
923c95cdf5 Auto merge of #162823 - weihanglo:update-cargo, r=Urgau,weihanglo
Update cargo submodule

9 commits in 7941be6fb416b4cd9666aef7b858dfea25587a8c..495c385d0875c4ba51eb72ea0448a2d4c018b8d4
2026-09-11 20:47:37 +0000 to 2026-09-16 12:48:58 +0000
- Report the number of errors with `build.warnings='deny'` (rust-lang/cargo#17479)
- fix: return correct package specs when resolving workspace deps (rust-lang/cargo#17469)
- refactor(config): Consolidate more config table definitions (rust-lang/cargo#17480)
- fix(git): For git cli, tell users what config we aren't forwarding on error (rust-lang/cargo#17477)
- Lower the lint level of `manual_readme` and `non_kebab_case_bins` to `allow` (rust-lang/cargo#17478)
- fix(trim-paths)!: unremap file in one JSON doc (rust-lang/cargo#17476)
- feat(manifest): support `feature-documentation` in manifests (rust-lang/cargo#17447)
- chore: Add Muscraft to the review rotation (rust-lang/cargo#17471)
- Specify `--edition` in `messages` tests (rust-lang/cargo#17470)

r? Urgau 
for the debugger script part

---

🤖 LLM disclosure: I probably should have tested this change manually, though I let LLM verify it working, sorry. Will do a manual test when I have time or if somebody beats me on that.
2026-09-16 17:29:38 +00:00
bors
92801ede88 Auto merge of #162853 - Zalathar:rollup-7nlu8K9, r=Zalathar
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#156216 (implement const Iterator for Range)
 - rust-lang/rust#160697 (rustc: Tweak the effect of `--jobs` on frontend parallelism)
 - rust-lang/rust#162748 (Enable LLVM Thin LTO for LoongArch64)
 - rust-lang/rust#162769 (Yeet the `DeepRegionResolver` (earlier called `OpportunisticRegionResolver`))
 - rust-lang/rust#162794 (Simplify `ast::UseTreeKind`)
 - rust-lang/rust#162800 (Cleanups related to RefDecodable)
 - rust-lang/rust#162826 (wasm: fix ABI for enums with integer layout and ZST fields)
 - rust-lang/rust#159359 ([rustc_public] Enhance PassMode API)
 - rust-lang/rust#162196 (Offload cmake cleanups)
 - rust-lang/rust#162818 (Add regression test for malformed RPITIT bound ICE with the new solver)
2026-09-16 14:25:20 +00:00
Stuart Cook
6f81ec10c7 Rollup merge of #162818 - zakrad:regr-test-156100, r=petrochenkov
Add regression test for malformed RPITIT bound ICE with the new solver

Fixes rust-lang/rust#156100
2026-09-16 23:42:01 +10:00
Stuart Cook
9fbeaa4062 Rollup merge of #162196 - ZuseZ4:offload-cmake-cleanups, r=Kobzol
Offload cmake cleanups

r? kobzol

Split out of https://github.com/rust-lang/rust/pull/161565, which requires (minor) LLVM changes.
These cleanups are valuable on their own already, and shouldn't be blocked. So let's land it, before it get's stale with all the refactoring going on ^^

Copied the disclaimer: I used an llm to implement the fixes, since I still don't like cmake.
I confirm that on a high-level these are the right fixes as far as I can tell, and I reviewed/refactored it.
2026-09-16 23:42:00 +10:00
Stuart Cook
124a208111 Rollup merge of #159359 - celinval:feat/cast-passmode, r=makai410
[rustc_public] Enhance PassMode API

This change is split into two different commits:
1. [Expand PassMode::Cast with CastTarget](5823ef2aae): This is basically a 1:1 mapping from the internal compiler representation.
2. [Replace Opaque with ArgAttributes in PassMode](75405294d0): Expose the non-LLVM specific ArgAttributes information. Leave the internal representation private for now in case we do want to expand its implementation later.
2026-09-16 23:41:59 +10:00
Stuart Cook
f6b5137514 Rollup merge of #162826 - folkertdev:wasm-int-enum-abi, r=alexcrichton
wasm: fix ABI for enums with integer layout and ZST fields

fixes https://github.com/rust-lang/rust/issues/121408
follow-up to https://github.com/rust-lang/rust/pull/162806

Clang is doing something that is rather annoying for us to emulate: like with unions it looks at the structure of the type, not the representation. But in rust an `enum` that is represented as an integer is not considered an `aggregate` at all, yet may still need to be passed as one if it has any (even ZST) fields.

r? alexcrichton
cc @hanna-kruppe
2026-09-16 23:41:58 +10:00
Stuart Cook
edb6c7b600 Rollup merge of #162800 - Zalathar:ref-decodable, r=nnethercote
Cleanups related to RefDecodable

- Earlier experiments: https://github.com/rust-lang/rust/pull/162287
---

This PR is a series of cleanups to the RefDecodable trait and its associated impls.

Details in individual commits.

There should be no change to compiler output.

r? nnethercote (or compiler)
2026-09-16 23:41:57 +10:00
Stuart Cook
9d7b74c416 Rollup merge of #162794 - nnethercote:simplify-UseTreeKind, r=petrochenkov
Simplify `ast::UseTreeKind`

We can make things simpler by adjusting how the ids are stored. Details in individual commits.

r? @petrochenkov
2026-09-16 23:41:56 +10:00
Stuart Cook
7717522392 Rollup merge of #162769 - jdonszelmann:yeet-opportunistic-region-resolver, r=adwinwhite
Yeet the `DeepRegionResolver` (earlier called `OpportunisticRegionResolver`)

r? @lcnr or @rust-lang/initiative-trait-system-refactor

See [#t-types > resolving equal regions @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/resolving.20equal.20regions/near/623484771)

> [!NOTE]
> I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.
2026-09-16 23:41:55 +10:00
Stuart Cook
85e6f30958 Rollup merge of #162748 - heiher:loong64-llvm-clang-thin-lto, r=jieyouxu
Enable LLVM Thin LTO for LoongArch64

This PR switches the LLVM build cross-compiler from GCC to Clang and enables LLVM Thin LTO for LoongArch64 distributions.

There is no significant performance difference with this change. It also reduces the size of the build artifacts:

| Artifacts                                             | Before | After |
|-------------------------------------------------------|--------|-------|
| rust-nightly-loongarch64-unknown-linux-gnu.tar.xz     | 287M   | 177M  |
| rust-nightly-loongarch64-unknown-linux-gnu directory  | 1.6G   | 849M  |
| rust-nightly-loongarch64-unknown-linux-musl.tar.xz    | 285M   | 177M  |
| rust-nightly-loongarch64-unknown-linux-musl directory | 1.6G   | 847M  |

---

try-job: dist-loongarch64*
2026-09-16 23:41:55 +10:00
Stuart Cook
75721d1e36 Rollup merge of #160697 - petrochenkov:jobtweak, r=bjorn3
rustc: Tweak the effect of `--jobs` on frontend parallelism

We need to be able to express both of these things for the frontend parallelism:
- "Use exactly `N` threads", `--jobs-frontend=N` does this.
- "Use some default number of threads, but not larger than `N`", `--jobs=N` will do it after this PR.
  The "default number" may be 1 now, or 2 during the upcoming nightly testing, or 4 or 8 after the stabilization if we decide to cap the parallelism.

Part of https://github.com/rust-lang/compiler-team/issues/1005.
r? @bjorn3
2026-09-16 23:41:54 +10:00
Stuart Cook
a705949b7f Rollup merge of #156216 - Randl:const-for-impl, r=clarfonthey
implement const Iterator for Range

This allows the use of `for i in i..n` in `const`.

This I believe is interesting enough to be justified under https://github.com/rust-lang/rust/issues/155816

r? @oli-obk
2026-09-16 23:41:53 +10:00
Weihang Lo
5b770b8715 debugger: respect latest trim-paths.json format
Cargo has changed the format from JSONL to plain JSON
2026-09-16 09:26:53 -04:00
Weihang Lo
c51a2988ad Update cargo submodule 2026-09-16 09:26:53 -04:00
bors
e15ceccfc6 Auto merge of #161432 - nnethercote:improve-session-backend-building, r=bjorn3
Improve `Session`/`CodegenBackend` construction



The creation and initialization of sessions and codegen backends is intertwined, which is confusing and error prone. This PR detangles things, and also simplifies the types used for the state within the backends. Details in individual commits.

r? @bjorn3
2026-09-16 11:13:53 +00:00
Nicholas Nethercote
8515e12560 Remove global_backend_features query
It's now possible to get the backend features (a `Vec<String>`) when the
codegen backend is started, pass it back through `CodegenBackendInit`,
and just store it in the `Session`. This removes the need for the query.

Also:

- `WriteBackendMethods::target_machine_factory` no longer needs the
  `target_features` parameter, because it's now available through the
  `sess` parameter.

- `CodegenContext` no longer needs the `backend_features` field because
  we can use `sess.global_backend_features` instead.

- `CodegenBackend::provide` is now a no-op for all the in-tree backends.
  I haven't removed it because out-of-tree backends still rely on it.
2026-09-16 15:29:44 +10: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
WANG Rui
3f8e2bfc76 Enable LLVM Thin LTO for LoongArch64
This PR switches the LLVM build cross-compiler from GCC to Clang and
enables LLVM Thin LTO for LoongArch64 distributions.

There is no significant performance difference with this change. It
also reduces the size of the build artifacts:

| Artifacts                                             | Before | After |
|-------------------------------------------------------|--------|-------|
| rust-nightly-loongarch64-unknown-linux-gnu.tar.xz     | 287M   | 177M  |
| rust-nightly-loongarch64-unknown-linux-gnu directory  | 1.6G   | 849M  |
| rust-nightly-loongarch64-unknown-linux-musl.tar.xz    | 285M   | 177M  |
| rust-nightly-loongarch64-unknown-linux-musl directory | 1.6G   | 847M  |
2026-09-16 13:09:43 +08:00
Nicholas Nethercote
4bfe145fcb Introduce ast::UseTreeAndId
Currently a `NodeId` is stored in a pair with each nested use tree. This
commit changes the pair to a named type `UseTreeAndId`. In most places
this doesn't make much difference but in the AST visitor it gets rid of
several weird special cases.
2026-09-16 14:15:32 +10:00
Evgenii Zheltonozhskii
0c12d6f94b Remove redundant test 2026-09-16 06:35:02 +03:00
bors
28e8a8c81b Auto merge of #162827 - JonathanBrouwer:rollup-JmKukFg, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#161873 (move bug and span_bug macros to rustc_span)
 - rust-lang/rust#162584 (Use File::*lock*() in rustc_data_structures::flock when possible)
 - rust-lang/rust#162704 (Parser: Uninterpolate when checking for const closures, try bikeshed blocks & in relevant diagnostic code)
 - rust-lang/rust#162787 (Fix suggestions for names captured by formatting macros)
 - rust-lang/rust#159562 (Windows: cache the stdio write mode for the duration of a lock session)
 - rust-lang/rust#162813 (Pre lint port cleanups)
 - rust-lang/rust#162822 (PassWrapper: adapt for removal of EABIVersion arg in LLVM 24)
2026-09-16 01:22:39 +00:00
Zalathar
a3db66c97f Remove the decoder type-param from RefDecodable
It's simpler to make the `decode` method generic over `impl TyDecoder`.
2026-09-16 11:00:48 +10:00
Zalathar
e8c03abc73 Add a #[diagnostic::on_unimplemented(..)] hint to RefDecodable 2026-09-16 11:00:48 +10:00
Zalathar
8dd9b9ab5f Remove an unused via-RefDecodable impl in rmeta decoding 2026-09-16 11:00:48 +10:00
Zalathar
a87b21352a Consolidate the via-RefDecodable impls in on_disk_cache
This commit replaces the existing boilerplate impls and the existing macro with
a less confusing macro.

Some unused impls have been removed.
2026-09-16 11:00:48 +10:00
Zalathar
b993427bfd Miscellaneous tidying in ref_decodable
- Added and expanded comments
- Renamed and clarified the impl-decodable macro
- Sorted the macro list of Decodable impls
2026-09-16 11:00:47 +10:00
Zalathar
82a24f2366 Move RefDecodable and related impls into a submodule
The existing `codec` module contains a sea of impls that is hard to navigate.
Extracting the RefDecodable parts into another file should make it easier to
keep track of what is where.

This commit tries to move everything as-is, so that `git diff --color-moved`
can verify that nothing was changed. Subsequent commits will modify the moved
code.
2026-09-16 11:00:47 +10:00
Zalathar
8838b56460 Migrate some RefDecodable impls to impl_ref_decodable_into_arena!
These impls all match the impl provided by the into-arena macro.
2026-09-16 11:00:47 +10:00
Zalathar
3c74470db4 Remove some unused Decodable and RefDecodable impls 2026-09-16 11:00:47 +10:00
Zalathar
0be338853e Avoid an intermediate vec when ref-decoding to &'tcx [T]
For !needs_drop types, this should allow decoding directly into the
arena-allocated slice.

For needs_drop types, the arena already collects into a SmallVec<T>, so this
avoids an intermediate conversion from Vec<T> to SmallVec<T>.
2026-09-16 11:00:47 +10:00
Celina G. Val
bd13c1d291 Rename ValueAbi to ValueRepr and fix abi docs
BREAKING CHANGE: `ValueAbi` is renamed to `ValueRepr` and the
`LayoutShape::abi` field is renamed to `LayoutShape::value_repr`.

The old name was misleading: this type does not describe how values
are passed in function calls (that is `PassMode`), it is a hint for
how backends should represent values (as scalars, vectors, or
aggregates). This aligns with the internal rename from `Abi` to
`BackendRepr`.

Also fixes several doc comments that incorrectly claimed layout
fields define calling behavior.
2026-09-15 22:19:55 +00:00
Celina G. Val
5a1bf7f9bc Replace Opaque with ArgAttributes in PassMode
Expose argument ABI attributes through a structured type instead of
opaque debug strings. ArgAttributes provides accessors for the
extension mode (zero/sign-extend) and pointee alignment, which are
needed by tools doing their own code generation.

This removes all uses of Opaque from the abi module.
2026-09-15 22:16:17 +00:00
Celina G. Val
8420bbd952 [rustc_pub] Expand PassMode::Cast with CastTarget
Replace the opaque representation of `PassMode::Cast` with a
structured `CastTarget` type that exposes the register layout
used by the platform ABI. Add `Uniform`, `Reg`, and `RegKind`
types so tools can inspect how arguments are mapped to registers.

Add `CastTarget::size()` and `Uniform::reg_count()` helpers.
Add a test covering cast on args, returns, mixed register kinds,
multiple arguments, and register exhaustion causing stack spill.
2026-09-15 22:12:36 +00:00
bors
2b9a7be855 Auto merge of #161450 - aerooneqq:syntax-ctxt-non-deterministic-encoding, r=petrochenkov
Fix non-deterministic encoding of syntax contexts



Reiteration of rust-lang/rust#157409. Explanation can be found in comment for `encoding_indices` and in the issue.

Fixes rust-lang/rust#129094. Blocked by rust-lang/rust#161353.

r? @petrochenkov

_No llms used._
2026-09-15 22:12:23 +00:00
Jonathan Brouwer
1ffe14bdb7 Rollup merge of #162822 - durin42:llvm-24-eabi-options, r=cuviper
PassWrapper: adapt for removal of EABIVersion arg in LLVM 24

We never set this to anything but the default that I noticed, and [now](https://github.com/llvm/llvm-project/pull/222672) it's derived from the target triple in LLVM 24.

@rustbot label: +llvm-main
2026-09-15 23:26:59 +02:00
Jonathan Brouwer
354f732b7a Rollup merge of #162813 - mejrs:pre_lint_cleanups, r=JonathanBrouwer,petrochenkov
Pre lint port cleanups

Some minor changes split off from https://github.com/rust-lang/rust/pull/162811, to make that a bit easier to review.

cc @JonathanBrouwer
2026-09-15 23:26:58 +02:00
Jonathan Brouwer
556c0e625b Rollup merge of #159562 - Joel-Wwalker:154071-stdio-handle-cache, r=aapoalas
Windows: cache the stdio write mode for the duration of a lock session

On Windows, every write to stdout/stderr calls `GetStdHandle` and `GetConsoleMode` (and `GetConsoleOutputCP` for consoles) to decide how to write. For bulk writes through a locked handle that is most of the work; rust-lang/rust#154071 measured 14% of CPU time in `is_console` alone.

This caches the handle and the console verdict in the sys-level `Stdout`/`Stderr` and re-queries when a new lock session begins, as [suggested in the issue](https://github.com/rust-lang/rust/issues/154071#issuecomment-4092410339). Holding a `StdoutLock` pins the stream; unlocked writes acquire the lock per call, so they re-query per write exactly as before, and `SetStdHandle` calls made between lock sessions keep working (the rust-lang/rust#40490 behavior is preserved).

Numbers from the issue's workload shape (16 KiB chunks to `NUL`, 4 GiB total, Windows 11):

| mode | before | after |
|---|---|---|
| `stdout().lock()` | 0.478 s (8,561 MiB/s) | 0.120 s (34,350 MiB/s) |
| unlocked | 0.467 s | 0.293 s |

The unlocked case also improves because one implicit lock session can contain several sys-level writes when `LineWriter` splits a chunk at newlines.

The console path cannot run in CI, so it was verified under a pseudoconsole: several writes through one lock session on a CP437 console came through `WriteConsoleW` intact (non-ASCII included), and after `SetConsoleOutputCP` plus a new lock session the refresh picked up the change.

The `refresh` hook is a small `#[cfg(windows)]` shim on `StdoutRaw`/`StderrRaw`; happy to change it to a method on every platform's sys type instead if that is preferred.

Fixes rust-lang/rust#154071
2026-09-15 23:26:58 +02:00
Jonathan Brouwer
2cb8b18100 Rollup merge of #162787 - chenyukang:yukang-fix-105520-format-captured-fields, r=estebank
Fix suggestions for names captured by formatting macros

Fixes rust-lang/rust#105520

also improve rust-lang/rust#141136.
but still can not handle rust-lang/rust#96999.

r? @ghost
2026-09-15 23:26:57 +02:00
Jonathan Brouwer
c26fc64e36 Rollup merge of #162704 - fmease:uninterpolate-more, r=petrochenkov
Parser: Uninterpolate when checking for const closures, try bikeshed blocks & in relevant diagnostic code

On main, various places in the parser manually check for `TokenKind::Ident(…)` while in *most* cases that's not correct / complete as it doesn't account for *interpolated* identifiers (`TokenKind::NtIdent(…)`, "non-terminal" identifiers, i.e., ones that originate from macro metavariables `$ident`).

I've looked at all occurrences of `TokenKind::Ident` & `token::Ident` in the parser to see if each place was intentionally ignoring `NtIdent` or not. I found out that the code pertaining to const closures (unstable feature `const_closures`), to try bikeshed blocks (unstable feature `try_blocks_heterogeneous`) and to some diagnostics & parse error recoveries did not intend to ignore interpolated identifiers. This PR rectifies that.

Note that in most cases, it's not necessary to manually match against `NtIdent` as you can simply utilize helpers like `Token::uninterpolate`, `Token::ident`, `Token::is_keyword`, `Token::is_non_raw_ident` which handle them internally.

I also took the chance to clean up in each vicinity.

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
2026-09-15 23:26:56 +02:00
Jonathan Brouwer
73ee9888b2 Rollup merge of #162584 - bjorn3:incr_comp_prefer_flock, r=petrochenkov
Use File::*lock*() in rustc_data_structures::flock when possible

And only fallback to `fcntl(F_SETLK)` on Unix when `flock()` is not supported. `flock()` is a lot more sane than `fcntl(F_SETLK)` as it is fd scoped rather than process-scoped and reentrant. `fcntl(F_SETLK)` risks multiple instances of rustc inside the same process acquiring a lock on the same file even when an exclusive lock is requested. Using `File::*lock*()` also allows removing a fair amount of platform specific code for the file locking.

Fixes https://github.com/rust-lang/rust/issues/161361
2026-09-15 23:26:55 +02: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
Folkert de Vries
8aff3e62f2 wasm: fix ABI of repr(int) enums with ZST fields 2026-09-15 23:10:34 +02:00
Folkert de Vries
2b7282088d add TyAbiInterface::is_enum 2026-09-15 23:07:25 +02:00
Folkert de Vries
9dcbee96b3 add RegKind::from_primitive 2026-09-15 23:01:10 +02:00
Manuel Drehwald
d5a0a1612b Remove LLVM_CONFIG_REAL variables
Originally introduced in the Enzyme build and coppied around since,
but without effect for a few years by now.
2026-09-15 16:56:44 -04:00
Manuel Drehwald
2c9ec83ff8 Stop building unused libompdevice code 2026-09-15 16:56:40 -04:00
Folkert de Vries
9d60f8642c rename unwrap_trivial_aggregate -> is_aggregate_for_abi 2026-09-15 22:22:24 +02:00