Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ICE message for forbidden dep-graph reads. #124252

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

michaelwoerister
Copy link
Member

The new message mentions the main context that the ICE might occur in and it mentions the query/dep-node that is being read.

cc #123781, where this would have been helpful.

@rustbot
Copy link
Collaborator

rustbot commented Apr 22, 2024

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Apr 22, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Apr 22, 2024

That's a significantly more useful message than I expected 😆

@bors r+ rollup

r? @oli-obk

@bors
Copy link
Contributor

bors commented Apr 22, 2024

📌 Commit c373ec0 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 22, 2024

panic!(
"Error: trying to record dependency on DepNode {dep_node} in a \
context that does not allow it (e.g. during query deserialization)."
Copy link
Member

@RalfJung RalfJung Apr 22, 2024

Choose a reason for hiding this comment

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

FWIW, as someone who knows nothing about the query/incremental system, I still don't know that "record dependency" is the same as "invoke query". Or maybe it's not the same, but the explanation you gave me that I actually understood was "you invoked a query in a context that does not allow it". But maybe there are cases where saying "invoked a query" here would be wrong?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Invoking a query is only of several ways of recording something in the dependency graph, but it is by far the most common. I'll update the error message.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is the new message better?

The most common case of recording a dependency on a DepNode `foo` is \
when the correspondng query `foo` is invoked. Invoking queries is not \
allowed as part of loading something from the incremental on-disk cache. \
See <https://github.com/rust-lang/rust/pull/91919>."
Copy link
Member

Choose a reason for hiding this comment

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

That's a lot better, thanks!

Not sure if linking to the PR is very useful, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll leave the link in unless you or @oli-obk think that it's actively hurting understandability.

@michaelwoerister
Copy link
Member Author

Updated the error message: 6146a51

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Apr 22, 2024

📌 Commit 6146a51 has been approved by oli-obk

It is now in the queue for this repository.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 22, 2024
…read-ice, r=oli-obk

Improve ICE message for forbidden dep-graph reads.

The new message mentions the main context that the ICE might occur in and it mentions the query/dep-node that is being read.

cc rust-lang#123781, where this would have been helpful.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2024
…llaumeGomez

Rollup of 5 pull requests

Successful merges:

 - rust-lang#124178 ([cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times)
 - rust-lang#124183 (Stop taking `ParamTy`/`ParamConst`/`EarlyParamRegion`/`AliasTy` by ref)
 - rust-lang#124217 (coverage: Prepare for improved branch coverage)
 - rust-lang#124220 (Miri: detect wrong vtables in wide pointers)
 - rust-lang#124252 (Improve ICE message for forbidden dep-graph reads.)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2024
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#115913 (checked_ilog: improve performance)
 - rust-lang#124178 ([cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times)
 - rust-lang#124183 (Stop taking `ParamTy`/`ParamConst`/`EarlyParamRegion`/`AliasTy` by ref)
 - rust-lang#124217 (coverage: Prepare for improved branch coverage)
 - rust-lang#124230 (Stabilize generic `NonZero`.)
 - rust-lang#124252 (Improve ICE message for forbidden dep-graph reads.)
 - rust-lang#124268 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2024
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#115913 (checked_ilog: improve performance)
 - rust-lang#124178 ([cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times)
 - rust-lang#124183 (Stop taking `ParamTy`/`ParamConst`/`EarlyParamRegion`/`AliasTy` by ref)
 - rust-lang#124217 (coverage: Prepare for improved branch coverage)
 - rust-lang#124230 (Stabilize generic `NonZero`.)
 - rust-lang#124252 (Improve ICE message for forbidden dep-graph reads.)
 - rust-lang#124268 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a60ccc1 into rust-lang:master Apr 23, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 23, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2024
Rollup merge of rust-lang#124252 - michaelwoerister:better-forbidden-read-ice, r=oli-obk

Improve ICE message for forbidden dep-graph reads.

The new message mentions the main context that the ICE might occur in and it mentions the query/dep-node that is being read.

cc rust-lang#123781, where this would have been helpful.
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.

6 participants