Add comment about how we find the right span in non_fmt_panic.
This commit is contained in:
parent
daa371d189
commit
ad93f48d77
1 changed files with 3 additions and 0 deletions
|
@ -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
|
// Find the span of the argument to `panic!()`, before expansion in the
|
||||||
// case of `panic!(some_macro!())`.
|
// 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_span = arg.span;
|
||||||
let mut arg_macro = None;
|
let mut arg_macro = None;
|
||||||
while !span.contains(arg_span) {
|
while !span.contains(arg_span) {
|
||||||
|
|
Loading…
Reference in a new issue