diff options
Diffstat (limited to 'src/test')
8 files changed, 50 insertions, 13 deletions
diff --git a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff index 57485993dce..1a454bab4d0 100644 --- a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff @@ -21,7 +21,7 @@ let mut _19: *const T; // in scope 0 at $DIR/issue_76432.rs:9:54: 9:68 let mut _20: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 let mut _21: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 - let mut _22: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: !; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL let mut _23: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:7:19: 7:29 scope 1 { debug v => _2; // in scope 1 at $DIR/issue_76432.rs:7:9: 7:10 @@ -66,16 +66,16 @@ } bb1: { - StorageLive(_22); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + span: $SRC_DIR/core/src/panic.rs:LL:COL // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar(<ZST>)) } // ty::Const // + ty: &str // + val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + span: $SRC_DIR/core/src/panic.rs:LL:COL // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) } } 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-format-arg.rs b/src/test/ui/macros/unreachable-format-arg.rs new file mode 100644 index 00000000000..7d83b698d79 --- /dev/null +++ b/src/test/ui/macros/unreachable-format-arg.rs @@ -0,0 +1,13 @@ +// 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 + +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/proc-macro/quote-debug.stdout b/src/test/ui/proc-macro/quote-debug.stdout index 79651f01b95..3738bffd733 100644 --- a/src/test/ui/proc-macro/quote-debug.stdout +++ b/src/test/ui/proc-macro/quote-debug.stdout @@ -33,9 +33,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}', |
