Skip to content

Avoiding calling queries when collecting active queries#138672

Merged
bors merged 2 commits intorust-lang:masterfrom
Zoxc:deferred-queries-in-deadlock-handler
Mar 27, 2025
Merged

Avoiding calling queries when collecting active queries#138672
bors merged 2 commits intorust-lang:masterfrom
Zoxc:deferred-queries-in-deadlock-handler

Conversation

@Zoxc
Copy link
Copy Markdown
Contributor

@Zoxc Zoxc commented Mar 18, 2025

This PR changes active query collection to no longer call queries. Instead the fields needing queries have their computation delayed to when an cycle error is emitted or when printing the query backtrace in a panic.

This is done by splitting the fields in QueryStackFrame needing queries into a new QueryStackFrameExtra type. When collecting queries QueryStackFrame will contain a closure that can create QueryStackFrameExtra, which does make use of queries. Calling lift on a QueryStackFrame or CycleError will convert it to a variant containing QueryStackFrameExtra using those closures.

This also only calls queries needed to collect information on a cycle errors, instead of information on all active queries.

Calling queries when collecting active queries is a bit odd. Calling queries should not be done in the deadlock handler at all.

This avoids the out of memory scenario in #124901.

Loading
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

7 participants