Commit Graph

387 Commits

Author SHA1 Message Date
bors 46c86aef65 Auto merge of #152025 - jhpratt:rollup-Kxb6k3Y, r=jhpratt
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#151378 (Codegen tests for Arm Cortex-R82)
 - rust-lang/rust#151936 (Move the `fingerprint_style` special case into `DepKindVTable` creation)
 - rust-lang/rust#152018 (Move bigint helper tracking issues)
 - rust-lang/rust#151958 (Add codegen test for SLP vectorization)
 - rust-lang/rust#151974 (Update documentation for `Result::ok()`)
 - rust-lang/rust#151975 (Work around rustfmt giving up on a large expression)
 - rust-lang/rust#151990 (Fix missing unused_variables lint when using a match guard)
 - rust-lang/rust#151995 (stabilize ptr_as_ref_unchecked)
 - rust-lang/rust#151999 (attribute parsing: pass recovery mode to Parser.)
 - rust-lang/rust#152009 (Port rustc_preserve_ub_checks to attr parser)
 - rust-lang/rust#152022 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#151968 (Remove `HasDepContext` by merging it into `QueryContext`)
2026-02-03 04:44:02 +00:00
Jonathan Brouwer 9625c1ec9f Rollup merge of #151978 - nnethercote:query-cleanups, r=Zalathar
Query cleanups

A few small cleanups in the query system.

r? @Zalathar
2026-02-02 18:52:16 +01:00
Zalathar 09de0fd848 Use #![feature(adt_const_params)] for static query flags 2026-02-02 18:05:46 +11:00
Nicholas Nethercote c6afd45ac1 Move depth_limit_error out of QueryContext trait.
It's defined and used in `rustc_query_impl`; `rustc_query_system`
doesn't need it. So it can just be an inherent method on `QueryCtxt`.
2026-02-02 10:41:03 +11:00
Nicholas Nethercote 8e2c9c69c6 Eliminate some 'a lifetimes.
Putting `+ 'tcx` on the `QueryDispatcher` trait lets a few other places
be simplified.
2026-02-02 10:31:41 +11:00
Nicholas Nethercote 4ff360e997 Rename some query-related things.
Various `QueryStackFrame` variables are called `query`; `frame` is a
better name. And various `QueryInfo` variables are called `frame`;
`info` is a better name.

This eliminates some confusing `query.query()` occurrences, which is a
good sign, and some `frame.query` occurrences become `info.frame`.
2026-02-02 10:29:55 +11:00
Nicholas Nethercote cd1c773661 Remove lift_query_info.
It doesn't use `self`, which means it doesn't need to be part of the
`QueryContext` trait; we can just call `extract` directly where
necessary.
2026-02-02 10:29:55 +11:00
Zalathar b4bf57b7aa Move the fingerprint_style special case into DepKindVTable creation 2026-02-01 14:31:06 +11:00
Zalathar e044220de5 Make will_cache_on_disk_for_key_fn optional in query vtables 2026-01-30 21:18:29 +11:00
Zalathar d39609b719 Make is_loadable_from_disk_fn optional in query vtables 2026-01-30 21:16:25 +11:00
Zalathar d5e80aa714 Make try_load_from_disk_fn optional in query vtables 2026-01-30 21:16:25 +11:00
Nicholas Nethercote 1c3d9abbad Reduce generics use in the query system.
`QueryStackFrame<I>` is a generic type, and the `I` parameter leaks out
to many other related types. However, it only has two instantiations in
practice:
- `QueryStackFrame<QueryStackFrameExtra>`
- `QueryStackFrame<QueryStackDeferred<'tcx>>`

And most of the places that currently use `QueryStackFrame<I>` are
actually specific to one of the instantiations. This commit removes the
unneeded genericity.

The following types are only ever used with `QueryStackDeferred<'tcx>`:
- QueryMap
- QueryJobInfo
- QueryJob
- QueryWaiter
- QueryLatchInfo
- QueryLatch
- QueryState
- QueryResult
and their `<I>` parameter is changed to `<'tcx>`.

Also, the `QueryContext::QueryInfo` associated type is removed.

`CycleError<I>` and `QueryInfo<I>` are still generic over type, because
they are used with both instantiations.

This required also adding a `<'tcx>` parameter to the traits
`QueryDispatcher` and `QueryContext`, which is annoying but I can't see
how to avoid it.
2026-01-30 10:54:28 +11:00
Nicholas Nethercote 637e2cb5e1 Rename create_query_frame_extra.
It produces a `QueryStackFrameExtra`, so `stack_` should be in the name.
2026-01-30 09:56:41 +11:00
Nicholas Nethercote 654945a736 Simplify QueryStackFrame::new.
Instead of passing a closure that computes a hash and immediately
calling it, just compute the hash and pass the value.
2026-01-30 09:56:41 +11:00
Zalathar db74048b9a Rename, clarify, and document code for "erasing" query values 2026-01-30 00:13:09 +11:00
Zalathar 2a96ea0bee Make QueryDispatcher::Qcx an associated type 2026-01-29 10:59:58 +11:00
Zalathar 2c9175d73d Rename trait QueryConfig to QueryDispatcher 2026-01-27 21:58:29 +11:00
Zalathar 89d7695040 Rename DynamicQuery to QueryVTable 2026-01-27 21:57:18 +11:00
Stuart Cook 9108101955 Rollup merge of #151390 - nnethercote:revert, r=petrochenkov
Reintroduce `QueryStackFrame` split.

I tried removing it in rust-lang/rust#151203, to replace it with something simpler. But a couple of fuzzing failures have come up and I don't have a clear picture on how to fix them. So I'm reverting the main part of rust-lang/rust#151203.

This commit also adds the two fuzzing tests.

Fixes rust-lang/rust#151226, rust-lang/rust#151358.

r? @oli-obk
2026-01-27 17:36:36 +11:00
Nicholas Nethercote 0385e26e7d Reintroduce QueryStackFrame split.
I tried removing it in #151203, to replace it with something simpler.
But a couple of fuzzing failures have come up and I don't have a clear
picture on how to fix them. So I'm reverting the main part of #151203.

This commit also adds the two fuzzing tests.

Fixes #151226, #151358.
2026-01-27 09:42:38 +11:00
Jonathan Brouwer e1760d43cf Rollup merge of #151626 - Zalathar:qcx-deref, r=tiif
Remove `Deref<Target = TyCtxt>` from `QueryCtxt`

Explicitly writing `self.tcx` is easy enough, and lets us remove a bit of non-essential deref magic.
2026-01-26 18:19:16 +01:00
Zalathar 4b8fc13da0 Remove Deref<Target = TyCtxt> from QueryCtxt
Explicitly writing `self.tcx` is easy enough, and lets us remove a bit of
non-essential deref magic.
2026-01-25 12:56:45 +11:00
Zalathar 4b25ccdb91 Rename DepKindStruct to DepKindVTable 2026-01-24 18:22:14 +11:00
Zalathar ff331d2cc8 Rename HandleCycleError to CycleErrorHandling 2026-01-23 13:58:17 +11:00
Zalathar 17c5b7a4b5 Replace make_dep_kind_name_array! with a slice constant 2026-01-21 12:02:26 +11:00
Nicholas Nethercote 90e4a42162 Use with_reduced_queries to avoid query cycles.
This changes the error message of `query-cycle-issue-124901.rs`, which
doesn't matter much.
2026-01-16 19:21:35 +11:00
Nicholas Nethercote 48bcaf7ed1 Revert the QueryStackFrameExtra/QueryStackDeferred split.
PR #138672 introduced a complex and invasive split of `QueryStackFrame`
to avoid a query cycle. This commit reverts that change because there is
a much simpler change that fixes the problem, which will be in the next
commit.
2026-01-16 19:18:42 +11:00
Nicholas Nethercote 4c2e447027 Rename fatal_cycle as cycle_fatal.
To be consistent with the closely related `cycle_stash` and
`cycle_delay_bug`.
2026-01-16 14:55:03 +11:00
ywxt a4d0507af7 Lock shards while collecting active jobs.
Co-authored-by: Zoxc <zoxc32@gmail.com>
2025-11-14 09:01:22 +08:00
bjorn3 973c7527b4 Unify the configuration of the compiler docs
Previously it was rather inconsistent which crates got the rust logo and
which didn't and setting html_root_url was forgotten in many cases.
2025-11-05 11:25:27 +00:00
Jana Dönszelmann 6087d89004 fixup limit handling code 2025-09-08 15:07:12 -07:00
Marijn Schouten a641cfc6f3 DynamicConfig: use canonical clone impl 2025-09-05 12:31:56 +00:00
Yotam Ofek 3b48407f93 Remove unused allow attrs 2025-07-07 12:58:16 +00:00
Camille GILLOT 761d366415 Reuse metadata file from work products. 2025-07-04 14:02:17 +00:00
Jakub Beránek 04ff853e13 Add new self-profile event for aggregating query hit counts 2025-06-25 11:09:58 +02:00
bors 6e23095adf Auto merge of #140145 - Zoxc:job-server-proxy, r=SparrowLii
Add a jobserver proxy to ensure at least one token is always held

This adds a jobserver proxy to ensure at least one token is always held by `rustc`. Currently with `-Z threads` `rustc` can temporarily give up all its tokens, causing `cargo` to spawn additional `rustc` instances beyond the job limit.

The current behavior causes an issue with `cargo fix` which has a global lock preventing concurrent `rustc` instances, but it also holds a jobserver token, causing a deadlock when `rustc` gives up its token. That is fixed by this PR.

Fixes https://github.com/rust-lang/rust/issues/67385.
Fixes https://github.com/rust-lang/rust/issues/133873.
Fixes https://github.com/rust-lang/rust/issues/140093.
2025-05-01 04:11:52 +00:00
Zalathar ed2f4b6d2d Reformat parameters to macros used by with-all-queries 2025-04-29 20:48:51 +10:00
Zalathar 64bcf3b9f6 Rename rustc_query_append! to rustc_with_all_queries! 2025-04-29 20:48:51 +10:00
John Kåre Alsaker cff9efde74 Add a jobserver proxy to ensure at least one token is always held 2025-04-29 07:20:13 +02:00
bors f836ae4e66 Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Interpolated, r=petrochenkov
Remove `Nonterminal` and `TokenKind::Interpolated`

A third attempt at this; the first attempt was #96724 and the second was #114647.

r? `@ghost`
2025-04-14 03:56:55 +00:00
John Kåre Alsaker 927ad1659a Add a dep kind for use of the anon node with zero dependencies 2025-04-02 07:35:05 +02:00
Nicholas Nethercote 1830245a22 Remove recursion_limit increases.
These are no longer needed now that `Nonterminal` is gone.
2025-04-02 16:25:27 +11:00
John Kåre Alsaker 6ca2af6434 Use a function to create QueryStackDeferred to ensure context is Copy 2025-03-26 13:09:36 +01:00
John Kåre Alsaker 6319bb38cc Avoiding calling queries when collecting active queries 2025-03-26 09:36:36 +01:00
Matthias Krüger 43297ffc22 Rollup merge of #138581 - Zoxc:abort-handler-if-locked, r=SparrowLii
Abort in deadlock handler if we fail to get a query map

Resolving query cycles requires the complete active query map, or it may miss query cycles. We did not check that the map is completely constructed before. If there is some error collecting the map, something has gone wrong already. This adds a check to abort/panic if we fail to construct the complete map.

This can help differentiate errors from the `deadlock detected` case if constructing query map has errors in practice.

An `Option` is not used for `collect_active_jobs` as the panic handler can still make use of a partial map.
2025-03-25 18:09:05 +01:00
John Kåre Alsaker 34244c1477 Address comments 2025-03-21 08:14:27 +01:00
John Kåre Alsaker 157008d711 Update comments 2025-03-21 07:37:56 +01:00
John Kåre Alsaker 077b8d5c37 Abort in deadlock handler if we fail to get a query map 2025-03-21 07:37:56 +01:00
John Kåre Alsaker 68fd771bc1 Pass in dep kind names to the duplicate dep node check 2025-03-19 20:12:37 +01:00
bors 1aeb99d248 Auto merge of #122156 - Zoxc:side-effect-dep-node, r=oli-obk
Represent diagnostic side effects as dep nodes

This changes diagnostic to be tracked as a special dep node (`SideEffect`) instead of having a list of side effects associated with each dep node. `SideEffect` is always red and when forced, it emits the diagnostic and marks itself green. Each emitted diagnostic generates a new `SideEffect` with an unique dep node index.

Some implications of this:

- Diagnostic may now be emitted more than once as they can be emitted once when the `SideEffect` gets marked green and again if the task it depends on needs to be re-executed due to another node being red. It relies on deduplicating of diagnostics to avoid that.

- Anon tasks which emits diagnostics will no longer *incorrectly* be merged with other anon tasks.

- Reusing a CGU will now emit diagnostics from the task generating it.
2025-03-19 15:51:54 +00:00