Commit Graph

320584 Commits

Author SHA1 Message Date
Jynn Nelson 505d07da28 core and alloc doctests support doctest merging 2026-03-10 11:56:29 +01:00
Jynn Nelson acba81e689 core doctests support panic=abort 2026-03-10 11:56:29 +01:00
Jynn Nelson efe2e6c6c6 rustdoc moves incomplete_features attr up to the top level 2026-03-10 11:56:29 +01:00
Jynn Nelson f1f0b4504a downgrade duplicate features from hard-error -> deny-by-default 2026-03-10 11:56:29 +01:00
Jynn Nelson 9bbe2cd55a additional logging for doctest spawning 2026-03-09 11:42:35 +01:00
bors 98e7077b90 Auto merge of #153025 - joboet:bytestr_precision_display, r=Mark-Simulacrum
core: respect precision in `ByteStr` `Display`

Fixes rust-lang/rust#153022.

`ByteStr`'s `Display` implementation didn't respect the precision parameter. Just like `Formatter::pad`, this is fixed by counting off the characters in the string and truncating after the requested length – with the added complication that the `ByteStr` needs to be divided into chunks first. By including a fast path that avoids counting the characters when no parameters were specified this should also fix the performance regressions caused by rust-lang/rust#152865.
2026-03-09 04:13:35 +00:00
bors eda4fc7733 Auto merge of #153579 - JonathanBrouwer:rollup-DFWynbC, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152535 (std: use `OnceLock` for Xous environment variables)
 - rust-lang/rust#152646 (Update `UnsafeUnpin` impls involving extern types.)
 - rust-lang/rust#153559 (Inline and simplify some code for saving incremental data to disk)
 - rust-lang/rust#151900 (num: Separate public API from internal implementations)
 - rust-lang/rust#153520 (.mailmap: fix broken line with multiple emails)
 - rust-lang/rust#153573 (rustdoc-json: fix incorrect documentation for VariantKind::Struct)

Failed merges:

 - rust-lang/rust#153509 (Cleanup unused diagnostic emission methods - part 2)
2026-03-09 00:40:10 +00:00
Jonathan Brouwer 934afe30cd Rollup merge of #153573 - yshui-forks:rustdoc-types-doc, r=obi1kenobi,GuillaumeGomez
rustdoc-json: fix incorrect documentation for VariantKind::Struct

Seems to have been copy-and-pasted from `Enum::variants`, but `VariantKind::Struct::fields` is for struct variant fields, not enum variants.
2026-03-08 22:51:54 +01:00
Jonathan Brouwer 9b969739e9 Rollup merge of #153520 - DanielEScherzer:patch-4, r=lolbinarycat
.mailmap: fix broken line with multiple emails

Split binarycat's entry into multiple lines, one for each extra email
2026-03-08 22:51:53 +01:00
Jonathan Brouwer 83e6dbf9e1 Rollup merge of #151900 - tgross35:num-internal-imp, r=Mark-Simulacrum
num: Separate public API from internal implementations

Currently we have a single `core::num` module that contains both thin wrapper API and higher-complexity numeric routines. Restructure this by moving implementation details to a new `imp` module.

This results in a more clean separation of what is actually user-facing compared to items that have a stability attribute because they are public for testing.

The first commit does the actual change then the second moves a portion back.
2026-03-08 22:51:52 +01:00
Jonathan Brouwer 15a6976c86 Rollup merge of #153559 - Zalathar:persist, r=jackh726
Inline and simplify some code for saving incremental data to disk

Main changes:
- Inline `encode_query_cache` and `TyCtxt::serialize_query_result_cache`
- Pull value promotion out of `OnDiskCache::drop_serialized_data`
- Panic if `on_disk_cache` is None in an incremental-only path
2026-03-08 22:51:52 +01:00
Jonathan Brouwer e21a5df27e Rollup merge of #152646 - zachs18:unsafeunpin-marker-impls-pointee, r=Mark-Simulacrum
Update `UnsafeUnpin` impls involving extern types.

`UnsafeUnpin` tracking issue: https://github.com/rust-lang/rust/issues/125735

Relaxes from `T: ?Sized` (i.e. `T: MetaSized`) to `T: PointeeSized` for the `UnsafeUnpin` impls for pointers, references, and `PhantomData<T>`, and for the negative `UnsafeUnpin` impl for `UnsafePinned<T>`. (Compare to the impls for `Freeze` on lines 911-921.)

Both `UnsafeUnpin` and `extern type`s (the only way to have a `!MetaSized` type) are unstable, so this should have no effect on stable code.

Also updates the marker_impls macro docs to use PointeeSized bound, as most uses of the macro now do.

Concretely, this change means that the following types will newly implement `UnsafeUnpin`:

* pointers and references to `T` where `T` is an `extern type`
* `PhantomData<T>` where `T` is an extern type
* either of the above where `T` is a `struct` or tuple with `extern type` tail

Additionally, the negative `UnsafeUnpin` impl for `UnsafePinned<T>` is also relaxed to `T: PointeeSized` to align with the analogous negative `Freeze` impl for `UnsafeCell<T>`, even though both structs have `T: ?Sized` in their declaration (which probably should be relaxed, but that is a separate issue), so this part of the change doesn't actually *do* anything currently, but if `UnsafeCell` and `UnsafePinned` are later relaxed to `T: PointeeSized`, then the negative impl will apply to the newly possible instantiations. Also cc https://github.com/rust-lang/rust/issues/152645 that these impls compile at all.
2026-03-08 22:51:51 +01:00
Jonathan Brouwer 1ef29e7af6 Rollup merge of #152535 - joboet:xous_env_once_lock, r=Mark-Simulacrum
std: use `OnceLock` for Xous environment variables

There's no need for exposed-provenance-shenanigans here...

CC @xobs
2026-03-08 22:51:51 +01:00
bors b41f22de2a Auto merge of #153576 - JonathanBrouwer:rollup-oZYO7KY, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#153464 (Use `&C::Key` less in queries.)
 - rust-lang/rust#153553 (Remove the `rustc_data_structures::assert_matches!` re-exports)
 - rust-lang/rust#153561 (Replace the `try_mark_green` hook with direct calls to `tcx.dep_graph`)
 - rust-lang/rust#153564 (rendering interpreter OOM as OOM instead of ICE)
2026-03-08 18:05:25 +00:00
Jonathan Brouwer f0defb0de1 Rollup merge of #153564 - RalfJung:oom-is-not-ice, r=oli-obk
rendering interpreter OOM as OOM instead of ICE

Fixes https://github.com/rust-lang/rust/issues/149643.
Alternative to https://github.com/rust-lang/rust/pull/153481.
2026-03-08 19:04:37 +01:00
Jonathan Brouwer 35152ef343 Rollup merge of #153561 - Zalathar:try-mark-green, r=nnethercote
Replace the `try_mark_green` hook with direct calls to `tcx.dep_graph`

All of the existing call sites are directly touching `tcx.dep_graph` anyway, so the extra layer of indirection provides no real benefit.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-03-08 19:04:37 +01:00
Jonathan Brouwer 11636013f9 Rollup merge of #153553 - Zalathar:assert-matches, r=lqd
Remove the `rustc_data_structures::assert_matches!` re-exports

- https://github.com/rust-lang/rust/pull/151359
- https://github.com/rust-lang/rust/pull/153462
---

Now that the bootstrap stage0 compiler has been bumped to 1.95, we can remove these temporary re-exports from `rustc_data_structures`, and once again import the `assert_matches!` macros directly from std.
2026-03-08 19:04:36 +01:00
Jonathan Brouwer 38108e1e0d Rollup merge of #153464 - nnethercote:less-ref-Key, r=Zalathar
Use `&C::Key` less in queries.

Currently we use a mix of `C::Key` and `&C::Key` parameters. The former is more common and a bit nicer, so convert some of the latter. This results in less converting between the two types, and fewer sigils.
2026-03-08 19:04:36 +01:00
Yuxuan Shui 43e3fd1944 rustdoc-json: fix incorrect documentation for VariantKind::Struct 2026-03-08 15:42:03 +00:00
Ralf Jung 4f48642d1d rendering interpreter OOM as OOM instead of ICE 2026-03-08 13:27:05 +01:00
Nicholas Nethercote face186874 Use &C::Key less in queries.
Currently we use a mix of `C::Key` and `&C::Key` parameters. The former
is more common and a bit nicer, so convert some of the latter. This
results in less converting between the two types, and fewer sigils.
2026-03-08 22:54:12 +11:00
Zalathar 985b41d387 Remove the rustc_data_structures::assert_matches! re-exports 2026-03-08 22:02:23 +11:00
Zalathar 0a369a799f Replace the try_mark_green hook with direct calls to tcx.dep_graph
All of the existing call sites are directly touching `tcx.dep_graph` anyway, so
the extra layer of indirection provides no real benefit.
2026-03-08 21:53:13 +11:00
Zalathar d7490855d5 Inline and simplify some code for saving incremental data to disk
Main changes:
- Inline `encode_query_cache` and `TyCtxt::serialize_query_result_cache`
- Pull value promotion out of `OnDiskCache::drop_serialized_data`
- Panic if `on_disk_cache` is None in an incremental-only path
2026-03-08 21:27:50 +11:00
bors c7b206bba4 Auto merge of #153383 - nnethercote:overhaul-ensure_ok, r=Zalathar
Overhaul `ensure_ok`

The interaction of `ensure_ok` and the `return_result_from_ensure_ok` query modifier is weird and hacky. This PR cleans it up. Details in the individual commits.

r? @Zalathar
2026-03-08 07:03:35 +00:00
bors c3d014032f Auto merge of #153552 - Zalathar:rollup-MALCpPD, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#153202 ([win] Fix truncated unwinds for Arm64 Windows)
 - rust-lang/rust#153437 (coretest in miri: fix using unstable libtest features)
 - rust-lang/rust#153446 (Always use the ThinLTO pipeline for pre-link optimizations)
 - rust-lang/rust#153548 (add test for closure precedence in `TokenStream`s)
2026-03-08 03:45:00 +00:00
Stuart Cook 9886a13ab0 Rollup merge of #153548 - cyrgani:closuretest, r=JohnTitor
add test for closure precedence in `TokenStream`s

A test for a regression found by the https://github.com/rust-lang/rust/pull/151830 crater run in several different crates.
2026-03-08 14:01:36 +11:00
Stuart Cook cc0a60fd74 Rollup merge of #153446 - bjorn3:llvm_pre_link_thinlto, r=cuviper
Always use the ThinLTO pipeline for pre-link optimizations

When using cargo this was already effectively done for all dependencies as cargo passes -Clinker-plugin-lto without -Clto=fat/thin. -Clinker-plugin-lto assumes that ThinLTO will be used. The ThinLTO pre-link pipeline is faster than the fat LTO one. And according to the benchmarks in [^1] there is barely any runtime performance difference between executables that used fat LTO with the fat vs ThinLTO pre-link pipeline.

This also helps avoid having yet another code path if we want to support Unified LTO (that is a single bitcode file that supports being used for both fat LTO and ThinLTO when using linker plugin LTO, we already support it when rustc does LTO as ThinLTO bitcode is enough of a superset of fat LTO bitcode that it happens to work by accident if you don't explicitly have a check preventing mixing of them for the current set of LTO features that rustc exposes.) I'm currently still investigating if rustc would benefit from Unified LTO and how exactly to integrate it.

[^1]: https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774
2026-03-08 14:01:35 +11:00
Stuart Cook a508c476ac Rollup merge of #153437 - RalfJung:miri-libtest-unstable, r=cuviper
coretest in miri: fix using unstable libtest features

Alternative (IMO preferable) to https://github.com/rust-lang/rust/pull/153369. Also reverts that PR.
2026-03-08 14:01:35 +11:00
Stuart Cook 4400f2f835 Rollup merge of #153202 - dpaoliello:arm64unwind, r=cuviper
[win] Fix truncated unwinds for Arm64 Windows

Panic backtraces on ARM64 Windows are truncated because Rust's LLVM configuration sets `NoTrapAfterNoreturn = true`, which suppresses the generation of `brk #0x1` (trap) instructions after calls to `noreturn` functions. Without this trap instruction, the return address from a `noreturn` call points past the end of the calling function into an unrelated function, causing `RtlLookupFunctionEntry` to return the wrong unwind information, which terminates the stack walk prematurely.

In general, `NoTrapAfterNoreturn = true` is recommended against for Windows, since we have seen security vulnerabilities in the past where an attacker has managed to return from a noreturn function, or the function wasn't actually noereturn, resulting in executing whatever was after the call.

This change disables setting `NoTrapAfterNoreturn = true` for Windows.

Fixes rust-lang/rust#140489
2026-03-08 14:01:34 +11:00
bors 052b9c23da Auto merge of #153521 - Zalathar:predicates-of, r=nnethercote
Don't use incremental disk-cache for query `predicates_of`

The `predicates_of` query is a relatively modest wrapper around a few underlying queries that are themselves cached to disk. Removing the additional layer of disk caching appears to be a significant perf win.

This query also appears to be the only query that uses a crate-local `cache_on_disk_if` condition, without also using the `separate_provide_extern` modifier.

- Discovered via https://github.com/rust-lang/rust/pull/153487#discussion_r2895304051
2026-03-07 23:31:34 +00:00
Nicholas Nethercote d4503b017e Overhaul ensure_ok.
`ensure_ok` provides a special, more efficient way of calling a query
when its return value isn't needed. But there is a complication: if the
query is marked with the `return_result_from_ensure_ok` modifier, then
it will return `Result<(), ErrorGuaranteed`. This is clunky and feels
tacked on. It's annoying to have to add a modifier to a query to declare
information present in its return type, and it's confusing that queries
called via `ensure_ok` have different return types depending on the
modifier.

This commit:

- Eliminates the `return_result_from_ensure_ok` modifier. The proc macro
  now looks at the return type and detects if it matches `Result<_,
  ErrorGuarantee>`. If so, it adds the modifier
  `returns_error_guaranteed`. (Aside: We need better terminology to
  distinguish modifiers written by the user in a `query` declaration
  (e.g. `cycle_delayed_bug`) from modifiers added by the proc macro
  (e.g. `cycle_error_handling`.))

- Introduces `ensure_result`, which replaces the use of `ensure_ok` for
  queries that return `Result<_, ErrorGuarantee>`. As a result,
  `ensure_ok` can now only be used for the "ignore the return value"
  case.
2026-03-08 09:39:39 +11:00
cyrgani 1ff7ed583f add test for closure precedence in TokenStreams 2026-03-07 21:02:10 +00:00
bors e370b60cf2 Auto merge of #153544 - JonathanBrouwer:rollup-LT1ogBG, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153462 (Bootstrap update)
 - rust-lang/rust#152210 (Gate #![reexport_test_harness_main] properly)
2026-03-07 20:04:00 +00:00
Jonathan Brouwer 0da3785222 Rollup merge of #152210 - Ozzy1423:attrs7, r=JonathanBrouwer
Gate #![reexport_test_harness_main] properly

Address the FIXME

Removed from `issue-43106-gating-of-builtin-attrs.rs` since that is for stable attributes only.

This would be a breaking change, search of github shows it is mostly but not always used with `#![test_runner]` which is already gated correctly.

Details:
https://github.com/rust-lang/rust/issues/50297

Feel free to close this issue if you think it is not worth addressing the FIXME...
2026-03-07 20:02:30 +01:00
Jonathan Brouwer 65a7e52f63 Rollup merge of #153462 - cuviper:bootstrap-update, r=Mark-Simulacrum
Bootstrap update

- Replace version placeholders with 1.95.0
- Bump stage0 to 1.95.0-beta.1
- Clear `STAGE0_MISSING_TARGETS`
- Update `cfg(bootstrap)`
- Reformat with the new stage0
2026-03-07 20:02:29 +01:00
Josh Stone eb093cfd5d Reformat with the new stage0 2026-03-07 10:42:02 -08:00
Josh Stone 32bae1353e Update cfg(bootstrap) 2026-03-07 10:42:02 -08:00
Josh Stone 7e04ef8df5 Clear STAGE0_MISSING_TARGETS 2026-03-07 10:42:02 -08:00
Josh Stone 1bc673f096 Bump stage0 to 1.95.0-beta.1 2026-03-07 10:42:02 -08:00
Josh Stone 78157ddde9 Replace version placeholders with 1.95.0
(cherry picked from commit bad24ccbec)
2026-03-07 10:42:01 -08:00
Daniel Scherzer c0cb69904e .mailmap: fix broken line with multiple emails
Split binarycat's entry into multiple lines, one for each extra email
2026-03-07 10:20:30 -08:00
bors e3d66fe39a Auto merge of #153541 - JonathanBrouwer:rollup-XmqEf4Q, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153494 (Replace Box<[TraitCandidate]> with &'hir [TraitCandidate<'hir>])
 - rust-lang/rust#153465 (Fix incorrect rustdoc JSON representation of `#[doc(test(..))]` attrs.)
2026-03-07 16:38:09 +00:00
Jonathan Brouwer 1f124413fa Rollup merge of #153465 - obi1kenobi:pg/trailing-bracket-fix, r=aDotInTheVoid
Fix incorrect rustdoc JSON representation of `#[doc(test(..))]` attrs.

Attributes like `#[doc(test(attr(deny(rust_2018_idioms))))]` are accidentally emitted without the final `]`.

Also, the `#[doc(test(no_crate_inject))]` attribute is mistakenly emitted as `#[doc(no_crate_inject)]` — note the missing `test` wrapper.

This PR adds the missing `]` and fixes the `no_crate_inject`, and adds regression tests for both.

Thanks to the folks working on `tonic` and `pyo3` for reporting a `cargo-semver-checks` crash on Rust 1.94 in their projects, which led me to finding this bug. Refs:
- https://github.com/hyperium/tonic/actions/runs/22732044107/job/65957306230?pr=2536
- https://github.com/PyO3/pyo3/actions/runs/22745106403/job/65967167797
- https://github.com/obi1kenobi/cargo-semver-checks/issues/1590

r? @aDotInTheVoid
2026-03-07 17:37:21 +01:00
Jonathan Brouwer 10f2c48549 Rollup merge of #153494 - aerooneqq:boxed-trait-candidates-to-hir-arena, r=petrochenkov
Replace Box<[TraitCandidate]> with &'hir [TraitCandidate<'hir>]

This PR allocates trait candidates on HIR arena and replaces `remove` with `get` in `ResolverAstLowering`. First step for rust-lang/rust#153489.

r? @petrochenkov
2026-03-07 17:37:20 +01:00
bors 085c58f2c0 Auto merge of #153387 - Zalathar:call-query, r=nnethercote
Get rid of `QueryVTable::call_query_method_fn`



Calling the query method to promote a value is equivalent to doing a cache lookup and then calling `execute_query_fn`, so we can just do that manually instead.

There are two “functional” differences here: If a cache hit occurs, we don't record the hit for self-profiling, and we don't register a read of the dep node. In the context of promotion, which touches *all* eligible cache entries just before writing the memory-cached values to disk, those two steps should be unnecessary overhead anyway.

r? nnethercote (or compiler)
2026-03-07 13:06:24 +00:00
Nicholas Nethercote bea3803300 Insert missing ensure_ok calls.
Two places where `ensure_ok` can be used but currently isn't. (These
queries are marked with `return_result_from_ensure_ok`, which means that
`ensure_ok` returns `Result<(), ErrorGuaranteed>`.) This is potentially
a perf win, because `ensure_ok` query calls can be faster.
2026-03-07 21:29:23 +11:00
Nicholas Nethercote 0ffb4adaeb Tweak control flow in query_* functions.
`query_get_at`, `query_ensure`, and `query_ensure_error_guarantee` are
very similar functions, but they all use different control flow styles
which obscures the similarities. This commit rewrites them to all use
a `match`.
2026-03-07 21:29:23 +11:00
Zalathar c7a48e8b87 Don't use incremental disk-cache for query predicates_of
This query is a relatively modest wrapper around a few underlying queries that
are themselves cached to disk. Removing the additional layer of disk caching
appears to be a significant perf win.

This query also appears to be the only query that uses a crate-local
`cache_on_disk_if` condition, without also using the `separate_provide_extern`
modifier.
2026-03-07 17:54:17 +11:00
bors ea5573a6c6 Auto merge of #153519 - JonathanBrouwer:rollup-Soq8THm, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#149937 (spliit out `linker-info` from `linker-messages`)
 - rust-lang/rust#153503 (Fallback to fat LTO for -Clto=thin in cg_gcc)
 - rust-lang/rust#153346 (move never type tests to subdirectories and add some comments)
 - rust-lang/rust#153371 (Fix LegacyKeyValueFormat report from docker build: arm)
 - rust-lang/rust#153508 (Clean up the eager formatting API)
2026-03-07 03:26:12 +00:00