Skip to content

Commit 348d451

Browse files
committed
Fix panic_fmt lint for new panic!() -> panic_2015!() expansion.
1 parent 53c7f3f commit 348d451

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

compiler/rustc_lint/src/panic_fmt.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,15 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
7474
let n_arguments =
7575
(&mut fmt_parser).filter(|a| matches!(a, Piece::NextArgument(_))).count();
7676

77-
// Unwrap another level of macro expansion if this panic!()
78-
// was expanded from assert!() or debug_assert!().
79-
for &assert in &[sym::assert_macro, sym::debug_assert_macro] {
77+
// Unwrap more levels of macro expansion, as panic_2015!()
78+
// was likely expanded from panic!() and possibly from
79+
// [debug_]assert!().
80+
for &assert in &[
81+
sym::std_panic_macro,
82+
sym::core_panic_macro,
83+
sym::assert_macro,
84+
sym::debug_assert_macro,
85+
] {
8086
let parent = expn.call_site.ctxt().outer_expn_data();
8187
if parent
8288
.macro_def_id

0 commit comments

Comments
 (0)