Skip to content

Commit

Permalink
Add comment about how we find the right span in non_fmt_panic.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Feb 17, 2021
1 parent daa371d commit ad93f48
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_lint/src/non_fmt_panic.rs
Expand Up @@ -71,6 +71,9 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc

// Find the span of the argument to `panic!()`, before expansion in the
// case of `panic!(some_macro!())`.
// We don't use source_callsite(), because this `panic!(..)` might itself
// be expanded from another macro, in which case we want to stop at that
// expansion.
let mut arg_span = arg.span;
let mut arg_macro = None;
while !span.contains(arg_span) {
Expand Down

0 comments on commit ad93f48

Please sign in to comment.