-
Notifications
You must be signed in to change notification settings - Fork 13k
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
ICEs should always print the top of the query stack. #70953
Comments
Nominating for a vibe check (this should be easy to implement if we agree we want it). |
Getting / printing the query stack may panic, so I'd prefer it to be done after printing the backtrace, but I guess that would be hidden by default anyway. |
I think always enabling backtraces for rustc would be useful, as it ensures that all bug reports contain a backtrace. Even when the issue is not reproducable. |
discussed in yesterday's T-compiler meeting. There was general support for adding information about the query context to the ICE output. when we had a second ad hoc triage meeting today, @eddyb added that we had issues in the past with trying to always emit backtraces (but it is possible that they have been fixed).
In any case, it seems like we can immediately work on adding a printout for the top of the query stack, and leave the question of whether to add more info beyond that to a later discussion. |
Not "always emit", but rather issues when enabling it via If we ever made the default to emit the backtrace, |
Both |
Something I completely forgot is that the query stack sometimes even has |
For anyone looking to implement this. The relevant work needs to be done in rust/src/librustc_driver/lib.rs Line 1156 in 86c0b85
rust/src/librustc_driver/lib.rs Line 1207 in 86c0b85
|
I'm trying to work on this. Is there some sort of template we are targeting? My proposed solution is adding something like rust/src/librustc_middle/ty/query/plumbing.rs Line 127 in 86c0b85
|
You could also add a |
Great idea, thanks. I assumed that we might break a lot of other functions by changing the signature of |
@georgio any updates on this? |
guys I am working on it and as @oli-obk recommendation, I want to add num_frames argument to try_print_query_stack function to break while loop when loop counter is equal to num_frames, but I am not sure that is it correct or not? |
We can just pass a strict value. This only happens when the compiler panics and is just a single line of information. I don't think this is something we really need to make configurable. |
ok thanks, I will pass f.e 2 to just show two first queries |
This should be closed because of |
E.g. for #70942, instead of:
We could print something more like
(not super sure about the
RUST_BACKTRACE=1
suggestion message)This (and the query stack more generally) should allow quicker diagnosis, and there should be no cost to just having this on by default for ICEs.
It could also be useful to users, as they could use it to figure out roughly where in their code they're triggering the ICE (similar to the
Span
from aspan_bug!
), to work around the ICE in the meanwhile or know which error to fix (in case it's a side-effect of an error) to get rid of the ICE.cc @rust-lang/compiler @rust-lang/wg-diagnostics
The text was updated successfully, but these errors were encountered: