Skip to content

Remove QueryCtxt and trait HasDepContext#152704

Open
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:query-ctxt
Open

Remove QueryCtxt and trait HasDepContext#152704
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:query-ctxt

Conversation

@Zalathar
Copy link
Member


With the QueryContext trait removed, wrapper struct QueryCtxt no longer serves a purpose and can be replaced with TyCtxt everywhere.

After that, the only obstacle to removing trait HasDepContext is DepGraph::with_task, which uses the trait to allow passing both a TyCtxt and a query vtable through the context argument. But we can achieve the same result by passing the vtable through the other argument instead, in a tuple alongside the query key.

r? nnethercote

This struct was only wrapping `TyCtxt` in order to implement traits that
were removed by RUST-152636.
The need for a `HasDepContext` impl on tuples can be avoided by passing the
query vtable as part of an argument tuple instead.
@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 16, 2026
self.assert_dep_node_not_yet_allocated_in_current_session(tcx.sess, &dep_node, || {
format!(
"forcing query with already existing `DepNode`\n\
- query-key: {task_arg:?}\n\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't just print the query key now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will print a tuple of (query_name, key), which seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants