diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs index 7e2b62f00cce1..3848547f6c3da 100644 --- a/compiler/rustc_lint/src/non_fmt_panic.rs +++ b/compiler/rustc_lint/src/non_fmt_panic.rs @@ -102,7 +102,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc cx.struct_span_lint(NON_FMT_PANICS, arg_span, |lint| { let mut l = lint.build("panic message is not a string literal"); - l.note("this usage of panic!() is deprecated; it will be a hard error in Rust 2021"); + l.note(&format!("this usage of {}!() is deprecated; it will be a hard error in Rust 2021", symbol_str)); l.note("for more information, see "); if !span.contains(arg_span) { // No clue where this argument is coming from. diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr index 7b5e0ee324b39..b62cc378aa5e4 100644 --- a/src/test/ui/non-fmt-panic.stderr +++ b/src/test/ui/non-fmt-panic.stderr @@ -61,7 +61,7 @@ warning: panic message is not a string literal LL | assert!(false, S); | ^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{}" format string to Display the message | @@ -74,7 +74,7 @@ warning: panic message is not a string literal LL | assert!(false, 123); | ^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{}" format string to Display the message | @@ -87,7 +87,7 @@ warning: panic message is not a string literal LL | assert!(false, Some(123)); | ^^^^^^^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{:?}" format string to use the Debug implementation of `Option` | @@ -138,7 +138,7 @@ warning: panic message is not a string literal LL | std::panic!(123); | ^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of std::panic!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{}" format string to Display the message | @@ -155,7 +155,7 @@ warning: panic message is not a string literal LL | core::panic!(&*"abc"); | ^^^^^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of core::panic!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{}" format string to Display the message | @@ -253,7 +253,7 @@ warning: panic message is not a string literal LL | assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see = note: the assert!() macro supports formatting, so there's no need for the format!() macro here help: remove the `format!(..)` macro call @@ -268,7 +268,7 @@ warning: panic message is not a string literal LL | debug_assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of debug_assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see = note: the debug_assert!() macro supports formatting, so there's no need for the format!() macro here help: remove the `format!(..)` macro call @@ -328,7 +328,7 @@ warning: panic message is not a string literal LL | assert!(false, v); | ^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see warning: panic message is not a string literal @@ -354,7 +354,7 @@ warning: panic message is not a string literal LL | assert!(false, v); | ^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{:?}" format string to use the Debug implementation of `T` | @@ -384,7 +384,7 @@ warning: panic message is not a string literal LL | assert!(false, v); | ^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{}" format string to Display the message | @@ -414,7 +414,7 @@ warning: panic message is not a string literal LL | assert!(false, v); | ^ | - = note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 + = note: this usage of assert!() is deprecated; it will be a hard error in Rust 2021 = note: for more information, see help: add a "{}" format string to Display the message |