Commit Graph

2307 Commits

Author SHA1 Message Date
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
Jonathan Brouwer
a7be2941de Rollup merge of #163083 - nnethercote:rm-Diag-G, r=oli-obk
Remove `G` generic param from `Diag<'_, G>`

The benefits are outweighed by the costs. Details in invidual commits.

some minor earlier discussion about this change in https://github.com/rust-lang/rust/pull/162630#discussion_r3988468478
2026-09-21 15:19:21 +02:00
James Barford-Evans
c56a9917d8 Wire up f16b in backends 2026-09-21 08:57:52 +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
bjorn3
27ed2eda12 Introduce LockedDir type 2026-09-18 12:10:15 +02: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
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
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
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
305d36bc80 Rollup merge of #162630 - nnethercote:simplify-Diag-G, r=oli-obk
Simplify the `G` in `Diag<'a, G>`

The `EmissionGuarantee` trait isn't necessary, and just complicates things. Details in individual commits.

r? @oli-obk
2026-09-14 15:16:02 +02:00
Roland Xu
d9b3213975 Rollup merge of #162671 - nnethercote:rm-EarlyDiagCtxt-note-help, r=estebank
Remove `EarlyDiagCtxt::early_{note,help}`

We have some top-level `help` and `note` diagnostics emittable at startup. These are weird. This PR eliminates them. Details in individual commits.

r? @estebank
2026-09-13 09:39:00 +08:00
Nicholas Nethercote
09bf6de39e Remove EmissionGuarantee
It's a trait that is used to give `Diag::emit` different return types
depending on the `G` in `Diag<'_, G>`. It works, but it's overkill.
There are only four different `G` types in practice (`BugAbort`,
`FatalAbort`, `ErrorGuaranteed`, and `()`) and having inherent `emit`
methods for each of those four concrete `Diag<'_, G>` types is good
enough.

This commit makes that change. This removes `EmissionGuarantee`
trait bounds from many places, which is nice.
2026-09-12 11:21:03 +10:00
Nicholas Nethercote
396d60358f Remove EarlyDiagCtxt::early_{note,help}
They're now unused.
2026-09-12 11:07:23 +10:00
Nicholas Nethercote
de902bb264 Improve nightly option parse errors
Currently the command `rustc -Zunstable-options -j3 --jobs-backend=1
a.rs`, when run on stable rustc, gives this:
```
error: the option `Z` is only accepted on the nightly compiler

error: the option `jobs` is only accepted on the nightly compiler

error: the option `jobs-backend` is only accepted on the nightly compiler

help: consider switching to a nightly toolchain: `rustup default nightly`

note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>

note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>

error: 3 nightly options were parsed
```

The errors are fine, but top-level help and notes are weird.

This commit changes it to this, which is more normal:
```
error: the option `Z` is only accepted on the nightly compiler

error: the option `jobs` is only accepted on the nightly compiler

error: the option `jobs-backend` is only accepted on the nightly compiler

error: 3 nightly options were parsed
  |
  = help: consider switching to a nightly toolchain: `rustup default nightly`
  = note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>
  = note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>
```

It's a slightly different order but that seems fine.

The commit also makes two other small improvements:
- An unnecessary `match opt.stability` is removed. (There's another
  `opt.stability` check a few lines above.)
- It fixes "1 nightly option were parsed" to "1 nightly option was
  parsed".
2026-09-12 11:07:23 +10:00
Jonathan Brouwer
0470573ea1 Rollup merge of #162193 - jakos-sec:cfi-requires, r=rcvalle
Make -Zsanitizer-cfi-{recover,diag} require -Zsanitizer=cfi

r? rcvalle
2026-09-11 23:59:25 +02:00
Jakob Koschel
22dc6432b0 reviewer feedback and add requires ui tests 2026-09-10 11:52:12 +00:00
Jonathan Brouwer
4482d08f64 Rollup merge of #161821 - steffahn:self-profile-help-message, r=tiif
Add missing option to `-Zself-profile-event` help message as well as information about what the default options are

The `query-cache-hit-count` option was forgotten to be added to the help text when it was added.

The new help text also documents which of the options are part of `default`, and now conveys the information that `args` is also a compound/group option and what it contains.
2026-09-09 15:01:29 +02:00
Frank Steffahn
ac12e6fd52 Improve keep-in-sync comments 2026-09-07 14:46:05 -04:00
Jakub Beránek
a27cae0f5f Cache sanitizer set in Session 2026-09-06 14:43:18 +02:00
bors
f248f40387 Auto merge of #160524 - clubby789:opt-level-opt-none, r=RalfJung
mir-transform: Treat `optimize(none)` the same as `opt-level=0`



cc @RalfJung
2026-09-05 20:19:46 +00:00
Jonathan Brouwer
5c953a1d7c Rollup merge of #161953 - PiJoules:implicit-remove-incompatible-sanitizers, r=davidtwco
sanitizers: Implicitly disable mutually exclusive sanitizers

This attempts to match clang's behavior of implicitly disabling sanitizers that are incompatible. Specifically, if a set of default sanitizers would be incompatible with ones provided by -Zsanitize=..., then clang (and now rust) will opt for keeping the ones specified via flags over the ones used as platform defaults. This helps maintain build consistency where we can just enable sanitizers via flags for both rust and c++ code without needing to manually disable others.

The driving reason for this is asan and safestack where we'd like to enable safestack by default for x86_64 fuchsia but disable it if -Zsanitize=address is passed (matching clang's behavior).

This commit also refactors all uses of `self.opts.unstable_opts.sanitizer` to go through the updated `sanitizer()` method.

AI: Gemini was used to help review the code and write some tests, but it did not generate the whole patch. I edited and reviewed this PR to the best of my ability before pushing for review.
2026-09-04 22:29:11 +02:00
Jonathan Brouwer
f0fd2caeeb Rollup merge of #157808 - 1c3t3a:sanitizer-ignorelist, r=rcvalle
sanitizers: Implement support for the sanitize ignorelist

The sanitize ignorelist gives central controls over which functions, files, etc. should be ignored and not sanitized. It is a common file format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change adds support for this list in Rust as well.

r? @rcvalle
2026-09-04 09:44:44 +02:00
Bastian Kersting
c0e55d66cc sanitizers: Implement support for the sanitize ignorelist
The sanitize ignorelist gives central controls over which functions,
files, etc. should be ignored and not sanitized. It is a common file
format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change
adds support for this list in Rust as well.
2026-09-03 15:53:04 +00:00
Jakob Koschel
213dde3089 Make -Zsanitizer-cfi-{recover,diag} require -Zsanitizer=cfi
Co-Authored-By: Bastian Kersting <bkersting@google.com>
2026-09-02 14:19:33 +00: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
Jonathan Brouwer
549f475a13 Rollup merge of #151618 - ShE3py:rustdoc-print, r=notriddle
rustdoc: add `--print` option

Context: `--print crate-root-lint-levels` (rust-lang/rust#139180) is only available for `rustc` and `clippy-driver`, while it would make sense for it to also be available for `rustdoc` (à la rust-lang/rust#83895.)

Not too sure about the stability of `rustdoc --print=any` or if this needs a MCP; strictly speaking, only `rustdoc +nightly -Z unstable-options --print=crate-root-lint-levels` would be required (and the `rustdoc --print` would be stabilized together with `crate-root-lint-levels`), but I guess that makes sense to have all the `--print`s for consistency.

For regression tests, not sure if ui or run-make is preferable, as run-make would need some sort of trait to avoid duplicating code between `rustc()` and `rustdoc()` (or just test `rustdoc` as it delegates to `rustc`):
021fc25b7a/tests/run-make/print-crate-root-lint-levels/rmake.rs (L82-L88)

@rustbot label +A-CLI +A-print-requests
2026-09-01 21:26:10 +02:00
Lieselotte
0e6616bfc0 rustdoc: filter print kinds 2026-08-31 18:00:52 +02:00
Lieselotte
57cc38f1d6 rustdoc: add --print option 2026-08-31 18:00:51 +02:00
Jonathan Keller
f12defbd75 _ an unused parameter 2026-08-30 22:51:51 -07:00
Jacob Pratt
4a1c2491ff Rollup merge of #161831 - Urgau:rm-env-set, r=nnethercote
Remove experimental `--env-set` option

This PR removes the experimental/unstable `--env-set` option.

The primary motivation for the feature meson/ninja [consider it](https://github.com/rust-lang/rust/issues/161609#issuecomment-5387803734) insufficient and a failure. They are even [planning](https://github.com/rust-lang/rust/issues/161609#issuecomment-5395180550) to use a wrapper anyway, entirely removing the need for it.

I looked at GitHub search and apart from Buck2 who [seemed to be using it](https://github.com/rust-lang/rust/issues/161609#issuecomment-5401813494), I didn't find a significant user.
2026-08-30 20:57:11 -04:00
Jonathan Brouwer
6f607f4806 Rollup merge of #161788 - jnkel:check-llvm-version, r=saethlin
Check to ensure we're running against the correct LLVM version

The recent LLVM version bump exposed several cases of mishandling LLVM versions, both in-tree and downstream (rust-lang/rust#161335, rust-lang/rust#161377, rust-lang/rust#161572, rust-lang/rust#162013, https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/opt-dist.20pipeline.20failure.20in.20MSYS2.20CI.20when.20compiling.2E.2E.2E/with/619077952).

If the compiler is run against an incompatible LLVM version, the most common failure mode is a segfault within LLVM, often when looking up target information. This is not obvious to debug, so this PR adds an LLVM version check before initializing LLVM so that we can produce a clearer error.

The second commit in this PR performs a `dladdr` lookup to print the path to the LLVM we're using. We already have code to do this for finding the sysroot, which I repurposed. However, I don't mind reverting this if it's too complex/risky.

I would appreciate if someone with permissions could trigger a try build on AIX, Windows, and WASI as the second commit touches platform-specific code that I can't test locally.

Before:

```
error: rustc interrupted by SIGSEGV, printing backtrace
0   librustc_driver-18049a207bb38ba8.dy 0x000000010e09e9b8 _RNvNtCsfNrGi27GPxl_17rustc_driver_impl14signal_handler17print_stack_trace + 140
1   libsystem_platform.dylib            0x0000000184c7d744 _sigtramp + 56
2   libLLVM.dylib                       0x000000011a9e22e0 _ZNK4llvm15MCSubtargetInfo13checkFeaturesENS_9StringRefE + 40
3   librustc_driver-18049a207bb38ba8.dy 0x000000010e44c798 LLVMRustHasFeature + 104
4   librustc_driver-18049a207bb38ba8.dy 0x000000010e3c4e34 _RINvXs0_NtNtNtCsk8HLZXaYIk4_4core4iter8adapters3mapINtB6_3MapINtNtB8_7flatten7FlatMapINtNtB8_6filter6FilterINtNtNtBc_5slice4iter4IterTReNtNtCs79s86CIooN0_12rustc_target15target_features9StabilityRSB28_EENCINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB4G_s_0E0EIBO_INtNtNtNtCs99cPMl0y5Ob_3std11collections4hash3set8IntoIterB28_ENCNCB3h_s_00ENCB3h_s_0ENCINvXs8_NtCsdLs5ZkLaCXa_9hashbrown3setINtB7v_7HashSetNtNtCsSGoTcZpb2F_10rustc_span6symbol6SymbolNtCs5ZGGmiYplBm_10rustc_hash13FxBuildHasherEINtNtNtBa_6traits7collect6ExtendB8e_E6extendBX_E0ENtNtB9I_8iterator8Iterator4folduNCINvNvBar_8for_each4callTB8e_uENCINvXs1i_NtB7x_3mapINtBbD_7HashMapB8e_uB8V_EIB9E_Bbm_E6extendBN_E0E0EB4K_ + 880
5   librustc_driver-18049a207bb38ba8.dy 0x000000010e2ad884 _RINvXs1i_NtCsdLs5ZkLaCXa_9hashbrown3mapINtB7_7HashMapNtNtCsSGoTcZpb2F_10rustc_span6symbol6SymboluNtCs5ZGGmiYplBm_10rustc_hash13FxBuildHasherEINtNtNtNtCsk8HLZXaYIk4_4core4iter6traits7collect6ExtendTBP_uEE6extendINtNtNtB2m_8adapters3map3MapINtNtB3r_7flatten7FlatMapINtNtB3r_6filter6FilterINtNtNtB2o_5slice4iter4IterTReNtNtCs79s86CIooN0_12rustc_target15target_features9StabilityRSB52_EENCINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB7A_s_0E0EIB3n_INtNtNtNtCs99cPMl0y5Ob_3std11collections4hash3set8IntoIterB52_ENCNCB6b_s_00ENCB6b_s_0ENCINvXs8_NtB9_3setINtBaq_7HashSetBP_B1x_EIB2g_BP_E6extendB3O_E0EEB7E_ + 344
6   librustc_driver-18049a207bb38ba8.dy 0x000000010e2b1ec4 _RINvXs8_NtCsdLs5ZkLaCXa_9hashbrown3setINtB6_7HashSetNtNtCsSGoTcZpb2F_10rustc_span6symbol6SymbolNtCs5ZGGmiYplBm_10rustc_hash13FxBuildHasherEINtNtNtNtCsk8HLZXaYIk4_4core4iter6traits7collect6ExtendBO_E6extendINtNtNtB2k_8adapters7flatten7FlatMapINtNtB3m_6filter6FilterINtNtNtB2m_5slice4iter4IterTReNtNtCs79s86CIooN0_12rustc_target15target_features9StabilityRSB4G_EENCINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB7e_s_0E0EINtNtB3m_3map3MapINtNtNtNtCs99cPMl0y5Ob_3std11collections4hash3set8IntoIterB4G_ENCNCB5P_s_00ENCB5P_s_0EEB7i_ + 68
7   librustc_driver-18049a207bb38ba8.dy 0x000000010e2bfa90 _RINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB1o_s_0EB1s_ + 148
8   librustc_driver-18049a207bb38ba8.dy 0x000000010e2fb918 _RNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config + 68
9   librustc_driver-18049a207bb38ba8.dy 0x000000010e292fb0 _RNvNtCs6x0lOIkloew_15rustc_interface4util17add_configuration + 48
10  librustc_driver-18049a207bb38ba8.dy 0x000000010e06b204 _RINvMs_Csfkr8sXZt4uY_10scoped_tlsINtB5_9ScopedKeyNtCsSGoTcZpb2F_10rustc_span14SessionGlobalsE3setNCNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB1G_31run_in_thread_pool_with_globalsNCINvNtB1I_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE000uEB44_ + 1112
11  librustc_driver-18049a207bb38ba8.dy 0x000000010e090914 _RINvCsSGoTcZpb2F_10rustc_span27create_session_globals_thenuNCNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB14_31run_in_thread_pool_with_globalsNCINvNtB16_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE000EB3s_ + 168
12  librustc_driver-18049a207bb38ba8.dy 0x000000010e07823c _RINvNtNtCs99cPMl0y5Ob_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE00uEB3C_ + 112
13  librustc_driver-18049a207bb38ba8.dy 0x000000010e04efa4 _RNSNvYNCINvNtNtCs99cPMl0y5Ob_3std6thread9lifecycle15spawn_uncheckedNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB1a_31run_in_thread_pool_with_globalsNCINvNtB1c_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE00uEs_0INtNtNtCsk8HLZXaYIk4_4core3ops8function6FnOnceuE9call_once6vtableB3y_ + 208
14  librustc_driver-18049a207bb38ba8.dy 0x0000000111697118 _RNvNvMs0_NtNtNtCs99cPMl0y5Ob_3std3sys6thread4unixNtB7_6Thread3new12thread_start + 392
15  libsystem_pthread.dylib             0x0000000184c73c58 _pthread_start + 136
16  libsystem_pthread.dylib             0x0000000184c6ec1c thread_start + 8

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=33554432
```

After:

```
thread 'rustc' (3568488) panicked at compiler/rustc_codegen_llvm/src/llvm_util.rs:59:13:
LLVM version mismatch: this compiler was built for LLVM 23, but LLVM 22.1.8 was found at /Users/keljonathan/code/rust/build/aarch64-apple-darwin/stage0/lib/libLLVM.dylib
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/panicking.rs:679:5
   1: core::panicking::panic_fmt
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/core/src/panicking.rs:80:14
   2: configure_llvm
             at ./compiler/rustc_codegen_llvm/src/llvm_util.rs:59:13
   3: {closure#0}
             at ./compiler/rustc_codegen_llvm/src/llvm_util.rs:35:13
   4: {closure#0}<rustc_codegen_llvm::llvm_util::init::{closure_env#0}>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/sync/once.rs:166:41
   5: <std::sys::sync::once::queue::Once>::call
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/sys/sync/once/queue.rs:225:21
   6: call_once<rustc_codegen_llvm::llvm_util::init::{closure_env#0}>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/sync/once.rs:166:20
   7: init
             at ./compiler/rustc_codegen_llvm/src/llvm_util.rs:34:14
   8: init
             at ./compiler/rustc_codegen_llvm/src/lib.rs:223:9
   9: {closure#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>
             at ./compiler/rustc_interface/src/interface.rs:440:29
  10: {closure#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>
             at ./compiler/rustc_interface/src/util.rs:223:17
  11: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
             at ./compiler/rustc_interface/src/util.rs:180:24
  12: set<rustc_span::SessionGlobals, rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>
             at /Users/keljonathan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/scoped-tls-1.0.1/src/lib.rs:137:9
  13: create_session_globals_then<(), rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>>
             at ./compiler/rustc_span/src/lib.rs:156:21
  14: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
             at ./compiler/rustc_interface/src/util.rs:176:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/keljonathan/code/rust/rustc-ice-2026-08-25T22_23_11-1423.txt` to your bug report

note: rustc 1.100.0-dev running on aarch64-apple-darwin

note: compiler flags: -C rpath -C debuginfo=0 -Z unstable-options

query stack during panic:
end of query stack
```
2026-08-30 21:48:02 +02:00
Lieselotte
938b233e4c doc: PrintKind 2026-08-30 15:05:23 +02:00
Hanna Kruppe
c7d949d9ea Remove -Zsaturating-float-casts flag
I added this flag back in 2017 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-08-29 13:50:44 +02:00
Yukang
3637675bfc Report the configured Polonius default in -Z help 2026-08-29 15:57:05 +08:00
Leonard Chan
868bc2a074 sanitizers: Implicitly disable mutually exclusive sanitizers
This attempts to match clang's behavior of implicitly disabling
sanitizers that are incompatible. Specifically, if a set of default
sanitizers would be incompatible with ones provided by -Zsanitize=...,
then clang (and now rust) will opt for keeping the ones specified via
flags over the ones used as platform defaults. This helps maintain build
consistency where we can just enable sanitizers via flags for both rust and
c++ code without needing to manually disable others.

The driving reason for this is asan and safestack where we'd like to
enable safestack by default for x86_64 fuchsia but disable it if
-Zsanitize=address is passed (matching clang's behavior).

This commit also refactors all uses of `self.opts.unstable_opts.sanitizer`
to go through the updated `sanitizer()` method.

AI: Gemini was used to help review the code and write some tests, but it
did not generate the whole patch. I edited and reviewed this PR to the
best of my ability before pushing for review.
2026-08-28 22:47:24 +00:00
Urgau
fadc7c6a3d Remove experimental --env-set option 2026-08-26 21:05:11 +02:00
Frank Steffahn
9a1ef58bc1 Add missing self-profile-event option and information about default options to help message
The `query-cache-hit-count` option was forgotten to be added to the help text when it was added.

The new help text also documents which of the options are part of `default`,
and now conveys the information that `args` is also a compound/group option as well as what it contains.
2026-08-26 17:10:40 +02:00
Jonathan Keller
5841e102da Look up and print path to wrong LLVM version 2026-08-25 11:48:16 -07:00
Ralf Jung
6bc1b1b1b7 -Ctarget-feature is not unsafe (any more) 2026-08-23 16:18:51 +02:00
Jonathan Brouwer
0105913af4 Rollup merge of #159282 - blyxyas:walk-items-creader, r=jackh726
Update documentation for `-Zdump-dep-graph`

The supposed output path was incorrect. Using `-Zdump-dep-graph` does NOT emit to `/tmp/dep_graph.gv`, but to 2 files, one being `dep_graph.txt` and the other `dep_graph.dot` in the current directory

r? @jackh726 :: Because kinda related to Incremental Systems Rethought.
2026-08-22 10:48:41 +02:00
Jamie Hill-Daniel
fcdb1a50b4 mir-transform: Handle the optimize attribute the same as -C opt-level 2026-08-21 18:20:48 +01:00
Jacob Pratt
cc58c4218f Rollup merge of #161259 - mejrs:attr_structures, r=JonathanBrouwer
move some attribute related structs out of rustc_attr_ir

This changes it so that

- rustc_session no longer depends on rustc_attr_ir
- rustc_attr_ir no longer depends on rustc_target (which is a fairly sizeable crate)
- rustc_attr_ir and rustc_target can compile in parallel

Previous graph:
<img width="985" height="512" alt="image" src="https://github.com/user-attachments/assets/cbde2414-043e-45f2-88a2-f77a5c9df60c" />

Graph with this PR:
<img width="1248" height="474" alt="image" src="https://github.com/user-attachments/assets/e0e13794-b17b-4337-8768-f0191cb1c0e6" />

r? @JonathanBrouwer
2026-08-21 08:43:39 -04:00
bors
526c36b4c4 Auto merge of #160619 - Kivooeo:enable-next-solver, r=lcnr,jdonszelmann,kobzol
Enable `-Znext-solver` on nightly by default



Implementation of https://github.com/rust-lang/compiler-team/issues/1014 cc https://github.com/rust-lang/blog.rust-lang.org/pull/1896 https://github.com/rust-lang/rust/issues/160895

This enables `-Znext-solver=globally` by default in nightly, but keeps `-Znext-solver=coherence` for most tests.
2026-08-21 09:19:18 +00:00
mejrs
7bec351981 move CollapseMacroDebuginfo 2026-08-21 10:35:10 +02:00
mejrs
8d970ffe69 Move NativeLibKind 2026-08-21 10:35:04 +02:00
mejrs
38af4a23c2 move CrateType 2026-08-21 10:35:02 +02:00
mejrs
589bb91122 Move Limit 2026-08-21 10:33:56 +02:00
bors
16a623ad67 Auto merge of #161434 - jhpratt:rollup-hq3P7uc, r=jhpratt
Rollup of 25 pull requests

Successful merges:

 - rust-lang/rust#152617 (std: implement `sleep_until` for Fuchsia)
 - rust-lang/rust#158934 (diagnostics: fix `let x: vec![]` suggestion pointing into stdlib)
 - rust-lang/rust#160995 (Tiny readability cleanups for initialization dataflow analyses)
 - rust-lang/rust#161277 (bootstrap: Move all non-module items out of the crate root)
 - rust-lang/rust#161295 (std: don't panic on long-elapsed deadlines for `sleep_until`)
 - rust-lang/rust#161368 (Double-word align `_Unwind_Exception`)
 - rust-lang/rust#161370 (Uplift rustfmt macro formatting fix)
 - rust-lang/rust#161378 (`FlowSensitiveAnalysis` cleanups)
 - rust-lang/rust#161420 (Bump wasm-component-ld to 0.5.30)
 - rust-lang/rust#161429 (Tighten allocator `Send`/`Sync` requirements for `Arc` in preparation for refactor)
 - rust-lang/rust#158032 (Offload expose device selection)
 - rust-lang/rust#158855 (Add `desktop` method to `CommandExt`)
 - rust-lang/rust#160299 (Stabilize `bool::toggle`)
 - rust-lang/rust#160842 (Apply `&[T]` visualizer to `*const [T]`, `*mut [T]` and `Box<[T]>`)
 - rust-lang/rust#160981 (Partially support building and locating wasm proc-macros)
 - rust-lang/rust#161199 (Add regression test for non lifetime binders)
 - rust-lang/rust#161212 (rust-installer/install-template.sh: catch cp(1) error when installing…)
 - rust-lang/rust#161302 (Add regression test for inconsistent import resolution from issue 147208)
 - rust-lang/rust#161329 (Add regression tests for a few fixed issues with E-needs-test)
 - rust-lang/rust#161330 (Add regression test for nested RPIT not an iterator ICE)
 - rust-lang/rust#161331 (Bitset simplifications)
 - rust-lang/rust#161340 (rustdoc: enable scrolling only on table/code)
 - rust-lang/rust#161351 (Cleanup: Move impl of `#[rustc_dump_object_lifetime_defaults]`)
 - rust-lang/rust#161355 (Add file path to some archive build errors)
 - rust-lang/rust#161373 (Allow running EC2 jobs locally)
2026-08-21 06:25:29 +00:00
Jacob Pratt
d6998e29a5 Rollup merge of #160981 - bjorn3:proc_macro_refactors7, r=Mark-Simulacrum
Partially support building and locating wasm proc-macros

For building this currently only removes the crate type check and doesn't implement crate metadata support for wasip2 or the proc-macro ABI. And for locating wasip2 needs support for loading crate metadata. Crate metadata building and loading should work for wasip1.

Part of https://github.com/rust-lang/rust/issues/160389

r? @Mark-Simulacrum
2026-08-20 21:34:31 -04:00
mejrs
7cd9c920cd rustc_session; remove rustc_lint_defs rex-exports 2026-08-20 23:02:49 +02:00