Skip to content

Commit ad93f48

Browse files
committed
Add comment about how we find the right span in non_fmt_panic.
1 parent daa371d commit ad93f48

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_lint/src/non_fmt_panic.rs

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
7171

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

0 commit comments

Comments
 (0)