about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-02-17 10:51:22 +0100
committerMara Bos <m-ou.se@m-ou.se>2021-02-17 10:51:22 +0100
commitad93f48d770cc8cfe473e809700201c31550bc68 (patch)
treef41135e57d67694a3af1a3808f82102bd8a31c6c
parentdaa371d1891f6833ad08542caeb3cf424483a0f9 (diff)
downloadrust-ad93f48d770cc8cfe473e809700201c31550bc68.tar.gz
rust-ad93f48d770cc8cfe473e809700201c31550bc68.zip
Add comment about how we find the right span in non_fmt_panic.
-rw-r--r--compiler/rustc_lint/src/non_fmt_panic.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs
index 0c7c8b78845..bfe37ce6959 100644
--- a/compiler/rustc_lint/src/non_fmt_panic.rs
+++ b/compiler/rustc_lint/src/non_fmt_panic.rs
@@ -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) {