diff options
| author | bors <bors@rust-lang.org> | 2022-02-07 00:26:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-07 00:26:52 +0000 |
| commit | 25b21a1d160013b2d58c98d0337c75a721317160 (patch) | |
| tree | 623c21da62c05576a090654f254429c722bbeb06 /src/test/ui | |
| parent | 7b43cfc9b25ac4a906bd56d32d3111085dd9e6a1 (diff) | |
| parent | a4b93eb1883d795f335df71d251d37d17b1311fd (diff) | |
| download | rust-25b21a1d160013b2d58c98d0337c75a721317160.tar.gz rust-25b21a1d160013b2d58c98d0337c75a721317160.zip | |
Auto merge of #93179 - Urgau:unreachable-2021, r=m-ou-se,oli-obk
Fix invalid special casing of the unreachable! macro
This pull-request fix an invalid special casing of the `unreachable!` macro in the same way the `panic!` macro was solved, by adding two new internal only macros `unreachable_2015` and `unreachable_2021` edition dependent and turn `unreachable!` into a built-in macro that do dispatching. This logic is stolen from the `panic!` macro.
~~This pull-request also adds an internal feature `format_args_capture_non_literal` that allows capturing arguments from formatted string that expanded from macros. The original RFC #2795 mentioned this as a future possibility. This feature is [required](https://github.com/rust-lang/rust/issues/92137#issuecomment-1018630522) because of concatenation that needs to be done inside the macro:~~
```rust
$crate::concat!("internal error: entered unreachable code: ", $fmt)
```
**In summary** the new behavior for the `unreachable!` macro with this pr is:
Edition 2021:
```rust
let x = 5;
unreachable!("x is {x}");
```
```
internal error: entered unreachable code: x is 5
```
Edition <= 2018:
```rust
let x = 5;
unreachable!("x is {x}");
```
```
internal error: entered unreachable code: x is {x}
```
Also note that the change in this PR are **insta-stable** and **breaking changes** but this a considered as being a [bug](https://github.com/rust-lang/rust/issues/92137#issuecomment-998441613).
If someone could start a perf run and then a crater run this would be appreciated.
Fixes https://github.com/rust-lang/rust/issues/92137
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/consts/const-eval/const_panic.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/consts/const-eval/const_panic_2021.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/macros/unreachable-arg.edition_2021.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/macros/unreachable-arg.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/macros/unreachable-format-arg.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/macros/unreachable-format-args.edition_2015.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/macros/unreachable-format-args.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/non-fmt-panic.fixed | 5 | ||||
| -rw-r--r-- | src/test/ui/non-fmt-panic.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/non-fmt-panic.stderr | 126 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/quote-debug.stdout | 4 |
12 files changed, 182 insertions, 38 deletions
diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr index 8da697fe7ef..2955f11716c 100644 --- a/src/test/ui/consts/const-eval/const_panic.stderr +++ b/src/test/ui/consts/const-eval/const_panic.stderr @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:12:15 | - = note: this error originates in the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:15:15 @@ -68,7 +68,7 @@ error[E0080]: evaluation of constant value failed LL | const Y_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:30:20 | - = note: this error originates in the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:33:20 diff --git a/src/test/ui/consts/const-eval/const_panic_2021.stderr b/src/test/ui/consts/const-eval/const_panic_2021.stderr index 62fe1715fec..cb3b08e0e09 100644 --- a/src/test/ui/consts/const-eval/const_panic_2021.stderr +++ b/src/test/ui/consts/const-eval/const_panic_2021.stderr @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const C: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:12:15 | - = note: this error originates in the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:15:15 @@ -60,7 +60,7 @@ error[E0080]: evaluation of constant value failed LL | const C_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:27:20 | - = note: this error originates in the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:30:20 diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr index 52c0c136366..417120c453e 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr @@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:11:15 | - = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:14:15 diff --git a/src/test/ui/macros/unreachable-arg.edition_2021.stderr b/src/test/ui/macros/unreachable-arg.edition_2021.stderr new file mode 100644 index 00000000000..d70ef31eed6 --- /dev/null +++ b/src/test/ui/macros/unreachable-arg.edition_2021.stderr @@ -0,0 +1,13 @@ +error: format argument must be a string literal + --> $DIR/unreachable-arg.rs:15:18 + | +LL | unreachable!(a); + | ^ + | +help: you might be missing a string literal to format with + | +LL | unreachable!("{}", a); + | +++++ + +error: aborting due to previous error + diff --git a/src/test/ui/macros/unreachable-arg.rs b/src/test/ui/macros/unreachable-arg.rs new file mode 100644 index 00000000000..4024bd20b79 --- /dev/null +++ b/src/test/ui/macros/unreachable-arg.rs @@ -0,0 +1,16 @@ +// ignore-emscripten no processes + +// revisions: edition_2015 edition_2021 +// [edition_2015]edition:2015 +// [edition_2021]edition:2021 +// [edition_2015]run-fail +// [edition_2021]check-fail +// [edition_2015]error-pattern:internal error: entered unreachable code: hello +// [edition_2021]error-pattern:format argument must be a string literal + +#![allow(non_fmt_panics)] + +fn main() { + let a = "hello"; + unreachable!(a); +} diff --git a/src/test/ui/macros/unreachable-format-arg.rs b/src/test/ui/macros/unreachable-format-arg.rs new file mode 100644 index 00000000000..ff059ad9e15 --- /dev/null +++ b/src/test/ui/macros/unreachable-format-arg.rs @@ -0,0 +1,15 @@ +// run-fail +// ignore-emscripten no processes + +// revisions: edition_2015 edition_2021 +// [edition_2015]edition:2015 +// [edition_2021]edition:2021 +// [edition_2015]error-pattern:internal error: entered unreachable code: x is {x} +// [edition_2021]error-pattern:internal error: entered unreachable code: x is 5 + +#![allow(non_fmt_panics)] + +fn main() { + let x = 5; + unreachable!("x is {x}"); +} diff --git a/src/test/ui/macros/unreachable-format-args.edition_2015.stderr b/src/test/ui/macros/unreachable-format-args.edition_2015.stderr new file mode 100644 index 00000000000..dda45d14a3f --- /dev/null +++ b/src/test/ui/macros/unreachable-format-args.edition_2015.stderr @@ -0,0 +1,12 @@ +error: there is no argument named `x` + --> $DIR/unreachable-format-args.rs:13:5 + | +LL | unreachable!("x is {x} and y is {y}", y = 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: did you intend to capture a variable `x` from the surrounding scope? + = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro + = note: this error originates in the macro `$crate::concat` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/macros/unreachable-format-args.rs b/src/test/ui/macros/unreachable-format-args.rs new file mode 100644 index 00000000000..04a31fc1ba3 --- /dev/null +++ b/src/test/ui/macros/unreachable-format-args.rs @@ -0,0 +1,14 @@ +// ignore-emscripten no processes + +// revisions: edition_2015 edition_2021 +// [edition_2015]edition:2015 +// [edition_2021]edition:2021 +// [edition_2015]check-fail +// [edition_2021]run-fail +// [edition_2015]error-pattern:there is no argument named `x` +// [edition_2021]error-pattern:internal error: entered unreachable code: x is 5 and y is 0 + +fn main() { + let x = 5; + unreachable!("x is {x} and y is {y}", y = 0); +} diff --git a/src/test/ui/non-fmt-panic.fixed b/src/test/ui/non-fmt-panic.fixed index d226f4129aa..5191f1877a9 100644 --- a/src/test/ui/non-fmt-panic.fixed +++ b/src/test/ui/non-fmt-panic.fixed @@ -11,6 +11,7 @@ static S: &str = "{bla}"; #[allow(unreachable_code)] fn main() { panic!("{}", "here's a brace: {"); //~ WARN panic message contains a brace + unreachable!("{}", "here's a brace: {"); //~ WARN panic message contains a brace std::panic!("{}", "another one: }"); //~ WARN panic message contains a brace core::panic!("{}", "Hello {}"); //~ WARN panic message contains an unused formatting placeholder assert!(false, "{}", "{:03x} {test} bla"); @@ -24,6 +25,8 @@ fn main() { debug_assert!(false, "{}", "{{}} bla"); //~ WARN panic message contains braces panic!("{}", C); //~ WARN panic message is not a string literal panic!("{}", S); //~ WARN panic message is not a string literal + unreachable!("{}", S); //~ WARN panic message is not a string literal + unreachable!("{}", S); //~ WARN panic message is not a string literal std::panic::panic_any(123); //~ WARN panic message is not a string literal core::panic!("{}", &*"abc"); //~ WARN panic message is not a string literal std::panic::panic_any(Some(123)); //~ WARN panic message is not a string literal @@ -41,8 +44,10 @@ fn main() { } std::panic::panic_any(a!()); //~ WARN panic message is not a string literal + unreachable!("{}", a!()); //~ WARN panic message is not a string literal panic!("{}", 1); //~ WARN panic message is not a string literal + unreachable!("{}", 1); //~ WARN panic message is not a string literal assert!(false, "{}", 1); //~ WARN panic message is not a string literal debug_assert!(false, "{}", 1); //~ WARN panic message is not a string literal diff --git a/src/test/ui/non-fmt-panic.rs b/src/test/ui/non-fmt-panic.rs index 2ffd7638ae0..d0d06b79775 100644 --- a/src/test/ui/non-fmt-panic.rs +++ b/src/test/ui/non-fmt-panic.rs @@ -11,6 +11,7 @@ static S: &str = "{bla}"; #[allow(unreachable_code)] fn main() { panic!("here's a brace: {"); //~ WARN panic message contains a brace + unreachable!("here's a brace: {"); //~ WARN panic message contains a brace std::panic!("another one: }"); //~ WARN panic message contains a brace core::panic!("Hello {}"); //~ WARN panic message contains an unused formatting placeholder assert!(false, "{:03x} {test} bla"); @@ -24,6 +25,8 @@ fn main() { debug_assert!(false, "{{}} bla"); //~ WARN panic message contains braces panic!(C); //~ WARN panic message is not a string literal panic!(S); //~ WARN panic message is not a string literal + unreachable!(S); //~ WARN panic message is not a string literal + unreachable!(S); //~ WARN panic message is not a string literal std::panic!(123); //~ WARN panic message is not a string literal core::panic!(&*"abc"); //~ WARN panic message is not a string literal panic!(Some(123)); //~ WARN panic message is not a string literal @@ -41,8 +44,10 @@ fn main() { } panic!(a!()); //~ WARN panic message is not a string literal + unreachable!(a!()); //~ WARN panic message is not a string literal panic!(format!("{}", 1)); //~ WARN panic message is not a string literal + unreachable!(format!("{}", 1)); //~ WARN panic message is not a string literal assert!(false, format!("{}", 1)); //~ WARN panic message is not a string literal debug_assert!(false, format!("{}", 1)); //~ WARN panic message is not a string literal diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr index f9e6d895136..3305e5cc906 100644 --- a/src/test/ui/non-fmt-panic.stderr +++ b/src/test/ui/non-fmt-panic.stderr @@ -12,7 +12,19 @@ LL | panic!("{}", "here's a brace: {"); | +++++ warning: panic message contains a brace - --> $DIR/non-fmt-panic.rs:14:31 + --> $DIR/non-fmt-panic.rs:14:35 + | +LL | unreachable!("here's a brace: {"); + | ^ + | + = note: this message is not used as a format string, but will be in Rust 2021 +help: add a "{}" format string to use the message literally + | +LL | unreachable!("{}", "here's a brace: {"); + | +++++ + +warning: panic message contains a brace + --> $DIR/non-fmt-panic.rs:15:31 | LL | std::panic!("another one: }"); | ^ @@ -24,7 +36,7 @@ LL | std::panic!("{}", "another one: }"); | +++++ warning: panic message contains an unused formatting placeholder - --> $DIR/non-fmt-panic.rs:15:25 + --> $DIR/non-fmt-panic.rs:16:25 | LL | core::panic!("Hello {}"); | ^^ @@ -40,7 +52,7 @@ LL | core::panic!("{}", "Hello {}"); | +++++ warning: panic message contains unused formatting placeholders - --> $DIR/non-fmt-panic.rs:16:21 + --> $DIR/non-fmt-panic.rs:17:21 | LL | assert!(false, "{:03x} {test} bla"); | ^^^^^^ ^^^^^^ @@ -56,7 +68,7 @@ LL | assert!(false, "{}", "{:03x} {test} bla"); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:18:20 + --> $DIR/non-fmt-panic.rs:19:20 | LL | assert!(false, S); | ^ @@ -69,7 +81,7 @@ LL | assert!(false, "{}", S); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:20:20 + --> $DIR/non-fmt-panic.rs:21:20 | LL | assert!(false, 123); | ^^^ @@ -82,7 +94,7 @@ LL | assert!(false, "{}", 123); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:22:20 + --> $DIR/non-fmt-panic.rs:23:20 | LL | assert!(false, Some(123)); | ^^^^^^^^^ @@ -95,7 +107,7 @@ LL | assert!(false, "{:?}", Some(123)); | +++++++ warning: panic message contains braces - --> $DIR/non-fmt-panic.rs:24:27 + --> $DIR/non-fmt-panic.rs:25:27 | LL | debug_assert!(false, "{{}} bla"); | ^^^^ @@ -107,7 +119,7 @@ LL | debug_assert!(false, "{}", "{{}} bla"); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:25:12 + --> $DIR/non-fmt-panic.rs:26:12 | LL | panic!(C); | ^ @@ -120,7 +132,7 @@ LL | panic!("{}", C); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:26:12 + --> $DIR/non-fmt-panic.rs:27:12 | LL | panic!(S); | ^ @@ -133,7 +145,33 @@ LL | panic!("{}", S); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:27:17 + --> $DIR/non-fmt-panic.rs:28:18 + | +LL | unreachable!(S); + | ^ + | + = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | unreachable!("{}", S); + | +++++ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:29:18 + | +LL | unreachable!(S); + | ^ + | + = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | unreachable!("{}", S); + | +++++ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:30:17 | LL | std::panic!(123); | ^^^ @@ -150,7 +188,7 @@ LL | std::panic::panic_any(123); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:28:18 + --> $DIR/non-fmt-panic.rs:31:18 | LL | core::panic!(&*"abc"); | ^^^^^^^ @@ -163,7 +201,7 @@ LL | core::panic!("{}", &*"abc"); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:29:12 + --> $DIR/non-fmt-panic.rs:32:12 | LL | panic!(Some(123)); | ^^^^^^^^^ @@ -180,7 +218,7 @@ LL | std::panic::panic_any(Some(123)); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message contains an unused formatting placeholder - --> $DIR/non-fmt-panic.rs:30:12 + --> $DIR/non-fmt-panic.rs:33:12 | LL | panic!(concat!("{", "}")); | ^^^^^^^^^^^^^^^^^ @@ -196,7 +234,7 @@ LL | panic!("{}", concat!("{", "}")); | +++++ warning: panic message contains braces - --> $DIR/non-fmt-panic.rs:31:5 + --> $DIR/non-fmt-panic.rs:34:5 | LL | panic!(concat!("{", "{")); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -208,7 +246,7 @@ LL | panic!("{}", concat!("{", "{")); | +++++ warning: panic message contains an unused formatting placeholder - --> $DIR/non-fmt-panic.rs:33:37 + --> $DIR/non-fmt-panic.rs:36:37 | LL | fancy_panic::fancy_panic!("test {} 123"); | ^^ @@ -216,7 +254,7 @@ LL | fancy_panic::fancy_panic!("test {} 123"); = note: this message is not used as a format string when given without arguments, but will be in Rust 2021 warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:43:12 + --> $DIR/non-fmt-panic.rs:46:12 | LL | panic!(a!()); | ^^^^ @@ -233,7 +271,20 @@ LL | std::panic::panic_any(a!()); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:45:12 + --> $DIR/non-fmt-panic.rs:47:18 + | +LL | unreachable!(a!()); + | ^^^^ + | + = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> +help: add a "{}" format string to Display the message + | +LL | unreachable!("{}", a!()); + | +++++ + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:49:12 | LL | panic!(format!("{}", 1)); | ^^^^^^^^^^^^^^^^ @@ -248,7 +299,22 @@ LL + panic!("{}", 1); | warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:46:20 + --> $DIR/non-fmt-panic.rs:50:18 + | +LL | unreachable!(format!("{}", 1)); + | ^^^^^^^^^^^^^^^^ + | + = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> + = note: the unreachable!() macro supports formatting, so there's no need for the format!() macro here +help: remove the `format!(..)` macro call + | +LL - unreachable!(format!("{}", 1)); +LL + unreachable!("{}", 1); + | + +warning: panic message is not a string literal + --> $DIR/non-fmt-panic.rs:51:20 | LL | assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ @@ -263,7 +329,7 @@ LL + assert!(false, "{}", 1); | warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:47:26 + --> $DIR/non-fmt-panic.rs:52:26 | LL | debug_assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ @@ -278,7 +344,7 @@ LL + debug_assert!(false, "{}", 1); | warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:49:12 + --> $DIR/non-fmt-panic.rs:54:12 | LL | panic![123]; | ^^^ @@ -295,7 +361,7 @@ LL | std::panic::panic_any(123); | ~~~~~~~~~~~~~~~~~~~~~~ ~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:50:12 + --> $DIR/non-fmt-panic.rs:55:12 | LL | panic!{123}; | ^^^ @@ -312,7 +378,7 @@ LL | std::panic::panic_any(123); | ~~~~~~~~~~~~~~~~~~~~~~ ~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:67:12 + --> $DIR/non-fmt-panic.rs:72:12 | LL | panic!(v); | ------ ^ @@ -323,7 +389,7 @@ LL | panic!(v); = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:68:20 + --> $DIR/non-fmt-panic.rs:73:20 | LL | assert!(false, v); | ^ @@ -332,7 +398,7 @@ LL | assert!(false, v); = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:72:12 + --> $DIR/non-fmt-panic.rs:77:12 | LL | panic!(v); | ^ @@ -349,7 +415,7 @@ LL | std::panic::panic_any(v); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:73:20 + --> $DIR/non-fmt-panic.rs:78:20 | LL | assert!(false, v); | ^ @@ -362,7 +428,7 @@ LL | assert!(false, "{:?}", v); | +++++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:77:12 + --> $DIR/non-fmt-panic.rs:82:12 | LL | panic!(v); | ^ @@ -379,7 +445,7 @@ LL | std::panic::panic_any(v); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:78:20 + --> $DIR/non-fmt-panic.rs:83:20 | LL | assert!(false, v); | ^ @@ -392,7 +458,7 @@ LL | assert!(false, "{}", v); | +++++ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:82:12 + --> $DIR/non-fmt-panic.rs:87:12 | LL | panic!(v); | ^ @@ -409,7 +475,7 @@ LL | std::panic::panic_any(v); | ~~~~~~~~~~~~~~~~~~~~~ warning: panic message is not a string literal - --> $DIR/non-fmt-panic.rs:83:20 + --> $DIR/non-fmt-panic.rs:88:20 | LL | assert!(false, v); | ^ @@ -421,5 +487,5 @@ help: add a "{}" format string to Display the message LL | assert!(false, "{}", v); | +++++ -warning: 30 warnings emitted +warning: 35 warnings emitted diff --git a/src/test/ui/proc-macro/quote-debug.stdout b/src/test/ui/proc-macro/quote-debug.stdout index a648d6b6d4b..ec54851fcf9 100644 --- a/src/test/ui/proc-macro/quote-debug.stdout +++ b/src/test/ui/proc-macro/quote-debug.stdout @@ -32,9 +32,7 @@ fn main() { lit.set_span(crate::Span::recover_proc_macro_span(2)); lit } else { - { - ::core::panicking::panic("internal error: entered unreachable code") - } + ::core::panicking::panic("internal error: entered unreachable code") } })), crate::TokenStream::from(crate::TokenTree::Punct(crate::Punct::new('\u{3b}', |
