-
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
Miri: make backtrace function names and spans match up #70590
Conversation
@@ -65,12 +64,12 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> { | |||
if tcx.def_key(self.instance.def_id()).disambiguated_data.data | |||
== DefPathData::ClosureExpr | |||
{ | |||
write!(f, "inside call to closure")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My original intention was to mean "inside this call to", but I guess that's obvious from the call site being displayed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that text was always attached to the call site, not the inside of the call.
Okay I made the caller_location ICE when things are "weird", and stopped skipping the first frame on const-backtraces. |
33263c3
to
96deb95
Compare
@bors r+ |
📌 Commit 96deb95 has been approved by |
🌲 The tree is currently closed for pull requests below priority 500, this pull request will be tested once the tree is reopened |
Rollup of 6 pull requests Successful merges: - rust-lang#70535 (Track the finalizing node in the specialization graph) - rust-lang#70590 (Miri: make backtrace function names and spans match up) - rust-lang#70616 (rustc_target::abi: rename FieldPlacement to FieldsShape.) - rust-lang#70626 (cargotest: remove webrender) - rust-lang#70649 (clean up E0468 explanation) - rust-lang#70662 (compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.) Failed merges: r? @ghost
Why are some frames not rendering code snippets? IMO for miri specifically, a full-source backtrace, no matter the crates each frame comes from (only requirement being that we can load the sources), would be good. |
We used to do that. It took multiple screens worth of height and was horrible. The check is not |
Make backtrace function names and spans match up This is the Miri side of rust-lang/rust#70590. Fixes #521
Currently, Miri backtraces are a bit confusing:
When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is where the main function is called.
This is not how backtraces are usually rendered (including e.g. with
RUST_BACKTRACE=1
). Usually we print next to each function name where inside that function the frame is currently executing, not where the parent frame is executing. With this PR and the Miri side at rust-lang/miri#1283, the backtrace now looks as follows:Now function name and printed line numbers match up in the notes.
This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside.
With this, we can also remove the
span
field from Miri's stack frames (which used to track the caller span of that frame, quite confusing), and then get of a whole lot ofspan
arguments that ultimately just served to fill that field (and as a fallback forcaller_location
, which however was never actually used).r? @oli-obk