Skip to content

Commit

Permalink
also prune caller_location frames when backtrace=off
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 29, 2022
1 parent ea8dba4 commit f389d46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ fn prune_stacktrace<'mir, 'tcx>(
) -> (Vec<FrameInfo<'tcx>>, bool) {
match ecx.machine.backtrace_style {
BacktraceStyle::Off => {
// Remove all frames marked with `caller_location` -- that attribute indicates we
// usually want to point at the caller, not them.
stacktrace.retain(|frame| !frame.instance.def.requires_caller_location(*ecx.tcx));
// Retain one frame so that we can print a span for the error itself
stacktrace.truncate(1);
(stacktrace, false)
Expand Down

0 comments on commit f389d46

Please sign in to comment.