Commit Graph

54687 Commits

Author SHA1 Message Date
bors 798a011ace Auto merge of #153865 - Zalathar:rollup-tKflfa5, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#153769 (target specs: stricter checks for LLVM ABI values, and correlate that with cfg(target_abi))
 - rust-lang/rust#153811 (Don't pass a separate `DepKind` to `query_feed`)
 - rust-lang/rust#153817 (relocate several ui tests)
 - rust-lang/rust#153840 (tests/debuginfo/basic-stepping.rs: Add cdb test)
 - rust-lang/rust#153858 (Use named fields in ChunkedBitSet's `Chunk::Mixed`)
2026-03-14 13:39:01 +00:00
Stuart Cook 4f3a0ff25c Rollup merge of #153858 - Zalathar:ones-count, r=Kivooeo
Use named fields in ChunkedBitSet's `Chunk::Mixed`

This helps to clarify that the field with type `ChunkSize` is a count of 1s, not a length or size.

There should be no change to compiler behaviour.
2026-03-14 23:30:12 +11:00
Stuart Cook ec9bc94414 Rollup merge of #153811 - Zalathar:query-feed, r=nnethercote
Don't pass a separate `DepKind` to `query_feed`

This PR makes two small tweaks to the `query_feed` function, which is called by macro-generated methods on TyCtxtFeed:

- Don't pass `DepKind` as a separate argument, because it's already in the QueryVTable
- Rename `query_vtable` to `query`, to match other functions that take QueryVTable

r? nnethercote (or compiler)
2026-03-14 23:30:11 +11:00
Stuart Cook 59f98f0e3d Rollup merge of #153769 - RalfJung:target-spec-abi-checks, r=madsmtm
target specs: stricter checks for LLVM ABI values, and correlate that with cfg(target_abi)

This tightens the checks for `llvm_abiname`, `llvm_floatabi` and `rustc_abi` in our target specs. Those are the fields that actually control the ccABI. With this commit, we now have an allowlist of value for these fields for all architectures (we previously only had that for some architectures). We also check that `cfg(target_abi)` suitably correlates with the actual ccABI. I based this check on our in-tree targets. For all ccABIs where we had a bunch of "random" values that don't directly correlate to the ccABI (like "uwp"), I also allowed  `cfg(target_abi)`  to remain empty, and whenever it is allowed to be empty I also allowed arbitrary other values for JSON targets. However, there's still a risk that JSON targets will fail this new check -- the idea is that we'll then get bugreports and can adjust the check as needed.

I had to adjust the target specs for non-ARM32 Apple targets as those were all setting `llvm_floatabi`, which to my knowledge makes no sense -- LLVM only actually does anything with that field on ARM32. I also adjusted the target specs for MIPS32 targets: one of them was setting llvm_abiname, and then it seems safer and more consistent to set that for all targets, so I set it to "o32" everywhere which seems to be the default.

Cc @workingjubilee
2026-03-14 23:30:10 +11:00
Ralf Jung 2662303112 mips: require LLVM ABI to be explicitly set, but also allow n32 2026-03-14 11:58:42 +01:00
bors fd2649988f Auto merge of #153690 - nnethercote:find_dep_kind_root, r=petrochenkov
`find_dep_kind_root` tweaks

Two minor changes relating to `find_dep_kind_root`.

r? @SparrowLii
2026-03-14 10:27:50 +00:00
Zalathar 0a90f8ddc2 Use named fields in ChunkedBitSet's Chunk::Mixed
This helps to clarify that the field with type `ChunkSize` is a count of 1s,
not a length or size.
2026-03-14 21:17:33 +11:00
Ralf Jung c4fb58ff9a target specs: tighten checks for llvm_abiname and llvm_floatabi, and tie them to cfg(target_abi) 2026-03-14 10:06:14 +01:00
Stuart Cook 22409b471c Rollup merge of #153786 - Zoxc:rm-from-cycle-error-specs, r=nnethercote
Remove `value_from_cycle_error` specializations

This removes `value_from_cycle_error` specializations which are not involved in custom cycle error handling.

This is a step towards removing query cycle recovery.
2026-03-14 17:30:24 +11:00
Stuart Cook 4625821025 Rollup merge of #153818 - oli-obk:const-closures, r=fee1-dead
Reimplement const closures

Tracking issue: rust-lang/rust#106003

Best reviewed commit-by-commit

The old solver can't handle `for<'a> |x: &'a()| ()` closures in const contexts, but that feature is unstable itself, so we can just leave it to the next solver to handle.

We need a lot more tests, we're testing the bare minimum of success and failure paths right now.

r? @fee1-dead
2026-03-14 17:30:24 +11:00
Stuart Cook e0bb94ec67 Rollup merge of #153760 - Zalathar:query-impl, r=nnethercote
Move and expand the big `rustc_query_impl` macro into a physical `query_impl.rs`

While looking through https://github.com/rust-lang/rust/pull/153588, I came up with a related but different change that I think resolves a lot of tension in the current module arrangement.

The core idea is that if we both define and expand the big macro in the same physical module `rustc_query_impl::query_impl`, then we no longer need to worry about where `mod query_impl` should be declared, or where its imports should go, because those questions now have simple and obvious answers.

The second commit follows up with some more changes inspired by https://github.com/rust-lang/rust/pull/153588. Those particular follow-ups are not essential to the main idea of this PR.

r? nnethercote
2026-03-14 17:30:23 +11:00
Stuart Cook 1d49de5b06 Rollup merge of #153376 - Zoxc:cycle-waiters-iter, r=nnethercote
Replace `visit_waiters` with `abstracted_waiters_of`

This replaces `visit_waiters` which uses closures to visit waiters with `abstracted_waiters_of` which returns a list of waiters. This makes the control flow of their users a bit clearer.

Additionally `abstracted_waiters_of` includes non-query waiters unlike `visit_waiters`. This means that `connected_to_root` now considers resumable waiters from the compiler root as being connected to root, while previously only non-resumable waiters counted. This can result in some additional entry points being found. Similarly in the loop detecting entry points we now consider queries in the cycle with direct resumable waiters from the compiler root as being entry points.

When looking for entry points we now look at waiters until we found a query to populate the `EntryPoint.waiter` field instead of stopping when we determined it to be an entry point.

cc @petrochenkov @nnethercote
2026-03-14 17:30:23 +11:00
Stuart Cook 76b769c8ad Rollup merge of #152621 - petrochenkov:graph2, r=Zalathar
LinkedGraph: support adding nodes and edges in arbitrary order

If an edge uses some not-yet-known node, we just leave the node's data empty, that data can be added later.

Use this support to avoid skipping edges in RetainedDepGraph.

This is continuation of https://github.com/rust-lang/rust/pull/152590, that PR just fixes the ICE, this PR also preserves all the edges in debug dumps.
This is also a minimized version of https://github.com/rust-lang/rust/pull/151821 with a smaller amount of data structure hacks.
2026-03-14 17:30:22 +11:00
Zalathar 7d4ee745eb Don't pass a separate DepKind to query_feed
The query's dep kind can be obtained from its vtable instead.

This commit also renames the `query_vtable` parameter to `query`, to be more
consistent with other functions that take a QueryVTable.
2026-03-14 15:57:46 +11:00
Zalathar 69ea0c506d Use more fully-qualified paths and local imports in query_impl 2026-03-14 15:41:20 +11:00
Zalathar 6699c13683 Move the big rustc_query_impl macro into a physical query_impl.rs
Moving the macro and its expansion into the same physical file resolves a lot
of tension in the current module arrangement.

Code in the macro is now free to use plain imports in the same file, and there
is no longer any question of whether `mod query_impl` should be declared inside
the macro, or surrounding a separate expansion site.
2026-03-14 15:41:00 +11:00
Nicholas Nethercote ddd1a69483 Remove Clone derive on QueryJobInfo.
This requires refactoring `depth_limit_error` to do some extra work
immediately instead of returning a cloned `info`.
2026-03-14 10:25:03 +11:00
Nicholas Nethercote 314e224fa5 Streamline find_dep_kind_root.
`current_id` is removable.
2026-03-14 09:17:03 +11:00
Oli Scherer c521b8084f Remove the incomplete marker from const closures 2026-03-13 20:29:43 +00:00
Oli Scherer 8629126289 Allow calling const closures on the old solver 2026-03-13 20:29:43 +00:00
Oli Scherer 1867653c81 Allow calling const closures in const items 2026-03-13 20:29:43 +00:00
Matthias Krüger cc41ba4899 Rollup merge of #153798 - zachs18:remove-pointerlikecandidate, r=JohnTitor
Remove unused `SelectionCandidate::PointerLikeCandidate`

The `PointerLike` trait was removed in https://github.com/rust-lang/rust/pull/143308, as part of `dyn*` being removed.

`!null` pattern types were added in https://github.com/rust-lang/rust/pull/142339 , which added `SelectionCandidate::PointerLikeCandidate`, IIUC to allow pattern types to implement `PointerLike`, but `PointerLike` was removed after that PR was first written, so (I assume) that functionality was mostly removed on a rebase, but this part didn't get removed. (see an earlier version of that PR that mentioned `LangItem::PointerLike`: https://github.com/rust-lang/rust/commit/50cab826283cc94f0eb0180907545fbd7dd3d50a before it got rebased over the rollup containing 143308: https://github.com/rust-lang/rust/pull/142339#issuecomment-3037059069 )

cc @oli-obk
2026-03-13 19:50:14 +01:00
John Kåre Alsaker fed57899b9 Remove value_from_cycle_error specialization for type_of 2026-03-13 18:52:26 +01:00
John Kåre Alsaker cdbe2b35b5 Remove value_from_cycle_error specialization for erase_and_anonymize_regions_ty 2026-03-13 18:52:10 +01:00
John Kåre Alsaker 791f4f9315 Remove value_from_cycle_error specialization for type_of_opaque_hir_typeck 2026-03-13 18:51:53 +01:00
bors 0e4bafc47c Auto merge of #153822 - JonathanBrouwer:rollup-2kSY2xg, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#153650 (Streamline active job collection.)
 - rust-lang/rust#153707 (Remove `CycleErrorHandling`.)
 - rust-lang/rust#153384 (Add missing safety doc for CString::from_vec_unchecked and async_drop_in_place)
 - rust-lang/rust#153752 (fix(delegation): Filter Out Module Segments in Generic Args Inheritance)
 - rust-lang/rust#153797 (Compiletest: Fix compare-output-by-lines directive)
 - rust-lang/rust#153810 (compiletest: Use PYTHONPATH for lldb too, not only gdb)
 - rust-lang/rust#153820 (Rename `opt_span_diag_lint` into `opt_span_lint` and remove `emit_diag_lint`)
2026-03-13 13:42:46 +00:00
Jonathan Brouwer 65b6ac9503 Rollup merge of #153820 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Rename `opt_span_diag_lint` into `opt_span_lint` and remove `emit_diag_lint`

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

Should be the last naming cleanup hopefully. :)

r? @JonathanBrouwer
2026-03-13 13:27:51 +01:00
Jonathan Brouwer a77d5c9908 Rollup merge of #153707 - nnethercote:rm-CycleErrorHandling, r=Zalathar
Remove `CycleErrorHandling`.

This PR removes the `cycle_*` query modifiers and `CycleErrorHandling`. Some good simplicity wins. Details in individual commits.

r? @Zalathar
2026-03-13 13:27:49 +01:00
Guillaume Gomez 9d45c1e1d4 Rename LintContext::opt_span_diag_lint method into opt_span_lint 2026-03-13 12:31:51 +01:00
Guillaume Gomez a280f54264 Remove unused LintContext::emit_diag_lint method 2026-03-13 12:15:40 +01:00
Nicholas Nethercote c6c150b0e0 Remove CycleErrorHandling.
Currently if a cycle error occurs the error is created, then handled
according to `CycleErrorHandling` (which comes from the
`cycle_delay_bug` query modifer, or lack thereof), and then
`value_from_cycle_error` is called.

This commit changes things so the error is created and then just passed
to `value_from_cycle_error`. This gives `value_from_cycle_error` full
control over how it's handled, eliminating the need for
`CycleErrorHandling`. This makes things simpler overall.
2026-03-13 22:00:10 +11:00
Nicholas Nethercote 834b7e7e43 Streamline active job collection.
`collect_active_jobs_from_all_queries` takes a `require_complete` bool,
and then some callers `expect` a full map result while others allow a
partial map result. The end result is four possible combinations, but
only three of them are used/make sense.

This commit introduces `CollectActiveJobsKind`, a three-value enum that
describes the three sensible combinations, and rewrites
`collect_active_jobs_from_all_queries` around it. This makes it and its
call sites much clearer, and removes the weird `Option<()>` and
`Result<QueryJobMap, QueryJobMap>` return types.

Other changes of note.
- `active` is removed. The comment about `make_frame` is out of date,
  and `create_deferred_query_stack_frame` *is* safe to call with the
  query state locked.
- When shard locking failure is allowed, collection no longer stops on
  the first failed shard.
2026-03-13 21:57:59 +11:00
Nicholas Nethercote 1d7b332143 Remove Representability.
Its last meaningful uses were removed in #153493.
2026-03-13 21:48:51 +11:00
John Kåre Alsaker 1f44a11518 Replace visit_waiters with abstracted_waiters_of 2026-03-13 11:47:57 +01:00
bors 8db65c7172 Auto merge of #153684 - cuviper:min-llvm-21, r=nikic
Update the minimum external LLVM to 21

With this change, we'll have stable support for LLVM 21 and 22.
For reference, the previous increase to LLVM 20 was rust-lang/rust#145071.

cc @rust-lang/wg-llvm
r? nikic
2026-03-13 10:36:35 +00:00
Stuart Cook aa2efbc60a Rollup merge of #153492 - Zoxc:querykeyid, r=nnethercote
Add a `TaggedQueryKey` to identify a query instance

This adds back a `TaggedQueryKey` enum which represents a query kind and the associated key. This is used to replace `QueryStackDeferred` and `QueryStackFrameExtra` and the associated lifting operation for cycle errors

This approach has a couple of benefits:
- We only run description queries when printing the query stack trace in the panic handler
- The unsafe code for `QueryStackDeferred` is removed
- Cycle handles have access to query keys, which may be handy

Some further work could be replacing `QueryStackFrame` with `TaggedQueryKey` as the extra information can be derived from it.
2026-03-13 18:28:11 +11:00
John Kåre Alsaker 85967c4de4 Add a TaggedQueryKey to identify a query instance 2026-03-13 07:49:38 +01:00
Stuart Cook 8669e0c27e Rollup merge of #153428 - nnethercote:fix-query-comments, r=Zalathar
Avoid duplicated query modifier comments.

There is currently some duplication.
2026-03-13 14:14:14 +11:00
Stuart Cook 04594428b9 Rollup merge of #153188 - Kivooeo:min-rec-limit, r=lcnr
implementation of `-Z min-recursion-limit`

impl of https://github.com/rust-lang/compiler-team/issues/969, closes https://github.com/rust-lang/rust/issues/153132

r? lcnr
2026-03-13 14:14:13 +11:00
Stuart Cook a8290c6576 Rollup merge of #153766 - nnethercote:try_execute_query-tweaks, r=cjgillot
`try_execute_query` tweaks

Details in individual commits.

r? @cjgillot
2026-03-13 14:14:13 +11:00
Stuart Cook 19f7c9442c Rollup merge of #153691 - nnethercote:misc-tweaks, r=yaahc
Miscellaneous tweaks

A hodge-podge of small changes that didn't fit anywhere else.

r? @yaahc
2026-03-13 14:14:12 +11:00
Nicholas Nethercote f0c27602b1 Some tiny improvements to try_execute_query.
The previous commit inlined `execute_job` without changing any of its
code. This commit does a few tiny follow-up changes.
2026-03-13 13:59:31 +11:00
Nicholas Nethercote 8b0c2591fa Inline and remove execute_job.
`execute_job` has a single call site in `try_execute_query`. This commit
inlines and removes `execute_job`, but also puts the part that checks
feedable results in its own separate function, `check_feedable`, because
it's a nicely separate piece of logic.

The big win here is that all the code dealing with the `QueryState` is
now together in `try_execute_query`: get the lock, do the lookup, drop
the lock, create the job guard, and complete the job guard. Previously
these steps were split across two functions which I found hard to
follow.

This commit purely moves code around, there are no other changes.
2026-03-13 13:59:29 +11:00
Nicholas Nethercote 73e56e8e86 Don't recompute key_hash in wait_for_query.
We compute `key_hash` in `try_execute_query`, so we can just pass the
value in.
2026-03-13 13:41:32 +11:00
Nicholas Nethercote 16dcceb5bc Avoid duplicated query modifier comments.
By removing the ones in `compiler/rustc_middle/src/queries.rs`, and
making `compiler/rustc_middle/src/query/modifiers.rs` the single
source of truth.
2026-03-13 13:24:46 +11:00
Zachary S 814c7508a9 Remove PointerLikeCandidate 2026-03-12 18:52:14 -05:00
Josh Stone 52dfa94cdc Update the minimum external LLVM to 21 2026-03-12 16:45:42 -07:00
Kivooeo 919fd6b64c add new unstable flag for minimal recursion 2026-03-12 20:48:26 +00:00
Jonathan Brouwer 4c56778448 Rollup merge of #153787 - GuillaumeGomez:rename-lint_level, r=JonathanBrouwer,Urgau
Rename `rustc_middle::lint::diag_lint_level` into `lint_level`

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

Renaming back `diag_lint_level` into `lint_level` since the original function was completely replaced and removed.

r? @JonathanBrouwer
2026-03-12 20:30:22 +01:00
Guillaume Gomez 862729e745 Rename rustc_middle::lint::diag_lint_level into emit_lint_base 2026-03-12 18:37:00 +01:00