From bce86219830e386d1247364b6018ede2e85d3036 Mon Sep 17 00:00:00 2001 From: Jacob Pratt Date: Mon, 4 Oct 2021 00:33:43 -0400 Subject: [PATCH] Stabilize `const_panic` --- compiler/rustc_borrowck/src/lib.rs | 2 +- .../src/transform/check_consts/check.rs | 2 - .../src/transform/check_consts/ops.rs | 17 ------- compiler/rustc_data_structures/src/lib.rs | 2 +- compiler/rustc_feature/src/accepted.rs | 2 + compiler/rustc_feature/src/active.rs | 3 -- compiler/rustc_index/src/vec.rs | 8 +++- compiler/rustc_mir_dataflow/src/lib.rs | 2 +- compiler/rustc_mir_transform/src/lib.rs | 2 +- library/core/src/lib.rs | 2 +- src/test/mir-opt/remove-never-const.rs | 1 - ...ever_const.no_codegen.PreCodegen.after.mir | 4 +- src/test/ui/consts/const-eval/const_panic.rs | 1 - .../ui/consts/const-eval/const_panic.stderr | 48 +++++++++---------- .../ui/consts/const-eval/const_panic_2021.rs | 1 - .../consts/const-eval/const_panic_2021.stderr | 40 ++++++++-------- .../const-eval/const_panic_libcore_bin.rs | 1 - .../const-eval/const_panic_libcore_bin.stderr | 12 ++--- .../const-eval/const_panic_track_caller.rs | 1 - .../const_panic_track_caller.stderr | 8 ++-- .../const-eval/feature-gate-const_panic.rs | 10 ---- .../feature-gate-const_panic.stderr | 33 ------------- .../const-eval/panic-assoc-never-type.rs | 1 - .../const-eval/panic-assoc-never-type.stderr | 4 +- .../ui/consts/const-eval/panic-never-type.rs | 1 - .../consts/const-eval/panic-never-type.stderr | 4 +- src/test/ui/consts/const-eval/unwind-abort.rs | 2 +- src/test/ui/consts/const-float-bits-conv.rs | 1 - src/test/ui/consts/const-float-classify.rs | 1 - src/test/ui/consts/control-flow/assert.rs | 10 +--- ...ssert.const_panic.stderr => assert.stderr} | 4 +- .../consts/control-flow/assert.stock.stderr | 23 --------- src/test/ui/consts/control-flow/basics.rs | 2 - .../consts/control-flow/short-circuit-let.rs | 2 - .../ui/consts/control-flow/short-circuit.rs | 2 - src/test/ui/consts/issue-32829.rs | 2 +- src/test/ui/consts/issue-32829.stderr | 8 ++-- .../consts/issue-66693-panic-in-array-len.rs | 2 - .../issue-66693-panic-in-array-len.stderr | 6 +-- src/test/ui/consts/issue-66693.rs | 2 - src/test/ui/consts/issue-66693.stderr | 6 +-- src/test/ui/consts/issue-76064.rs | 4 +- src/test/ui/consts/issue-76064.stderr | 10 ++-- ..._refers_to_static_cross_crate.32bit.stderr | 6 --- ..._refers_to_static_cross_crate.64bit.stderr | 6 --- src/test/ui/consts/ptr_comparisons.rs | 1 - src/test/ui/consts/ptr_comparisons.stderr | 10 ++-- src/test/ui/consts/ptr_is_null.rs | 2 +- src/test/ui/consts/unwind-abort.rs | 2 +- src/test/ui/enum-discriminant/niche.rs | 2 - .../rfc-2632-const-trait-impl/const-drop.rs | 1 - 51 files changed, 100 insertions(+), 229 deletions(-) delete mode 100644 src/test/ui/consts/const-eval/feature-gate-const_panic.rs delete mode 100644 src/test/ui/consts/const-eval/feature-gate-const_panic.stderr rename src/test/ui/consts/control-flow/{assert.const_panic.stderr => assert.stderr} (82%) delete mode 100644 src/test/ui/consts/control-flow/assert.stock.stderr diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 43032ae81cbbd..e6260157d11a7 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -2,7 +2,7 @@ #![feature(bool_to_option)] #![feature(box_patterns)] -#![feature(const_panic)] +#![cfg_attr(bootstrap, feature(const_panic))] #![feature(crate_visibility_modifier)] #![feature(format_args_capture)] #![feature(in_band_lifetimes)] diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index 57d92005a5649..fd5cd269a3a9e 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -887,8 +887,6 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> { // At this point, we are calling a function, `callee`, whose `DefId` is known... if is_lang_panic_fn(tcx, callee) { - self.check_op(ops::Panic); - // `begin_panic` and `panic_display` are generic functions that accept // types other than str. Check to enforce that only str can be used in // const-eval. diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index 1d0ee949a221b..c92104b001dec 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -368,23 +368,6 @@ impl NonConstOp for MutDeref { } } -#[derive(Debug)] -pub struct Panic; -impl NonConstOp for Panic { - fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status { - Status::Unstable(sym::const_panic) - } - - fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> { - feature_err( - &ccx.tcx.sess.parse_sess, - sym::const_panic, - span, - &format!("panicking in {}s is unstable", ccx.const_kind()), - ) - } -} - /// A call to a `panic()` lang item where the first argument is _not_ a `&str`. #[derive(Debug)] pub struct PanicNonStr; diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index b1f04bfbf0a84..1a6c106f43315 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -12,7 +12,7 @@ #![feature(associated_type_bounds)] #![feature(auto_traits)] #![feature(bool_to_option)] -#![feature(const_panic)] +#![cfg_attr(bootstrap, feature(const_panic))] #![feature(control_flow_enum)] #![feature(core_intrinsics)] #![feature(extend_one)] diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 69e0e3a013667..2ef0e0f6b1e56 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -297,6 +297,8 @@ declare_features! ( (accepted, arbitrary_enum_discriminant, "1.56.0", Some(60553), None), /// Allows macro attributes to observe output of `#[derive]`. (accepted, macro_attributes_in_derive_output, "1.57.0", Some(81119), None), + /// Allows panicking during const eval (producing compile-time errors). + (accepted, const_panic, "1.57.0", Some(51999), None), // ------------------------------------------------------------------------- // feature-group-end: accepted features diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index f8b865e615c2e..eae7f7854ecb1 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -425,9 +425,6 @@ declare_features! ( /// Allows using the `amdgpu-kernel` ABI. (active, abi_amdgpu_kernel, "1.29.0", Some(51575), None), - /// Allows panicking during const eval (producing compile-time errors). - (active, const_panic, "1.30.0", Some(51999), None), - /// Allows `#[marker]` on certain traits allowing overlapping implementations. (active, marker_trait_attr, "1.30.0", Some(29864), None), diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index 8535a7c866d96..453469f55744d 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -124,7 +124,9 @@ macro_rules! newtype_index { #[inline] $v const fn from_usize(value: usize) -> Self { - // FIXME: replace with `assert!(value <= ($max as usize));` once `const_panic` is stable + #[cfg(not(bootstrap))] + assert!(value <= ($max as usize)); + #[cfg(bootstrap)] [()][(value > ($max as usize)) as usize]; unsafe { Self::from_u32_unchecked(value as u32) @@ -133,7 +135,9 @@ macro_rules! newtype_index { #[inline] $v const fn from_u32(value: u32) -> Self { - // FIXME: replace with `assert!(value <= $max);` once `const_panic` is stable + #[cfg(not(bootstrap))] + assert!(value <= $max); + #[cfg(bootstrap)] [()][(value > $max) as usize]; unsafe { Self::from_u32_unchecked(value) diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index 72c4e27cbeabf..402391b87eaa9 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -2,7 +2,7 @@ #![feature(bool_to_option)] #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(const_panic)] +#![cfg_attr(bootstrap, feature(const_panic))] #![feature(exact_size_is_empty)] #![feature(in_band_lifetimes)] #![feature(iter_zip)] diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index b1b31e0784cfe..0ca640cd7b173 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -1,7 +1,7 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(crate_visibility_modifier)] -#![feature(const_panic)] +#![cfg_attr(bootstrap, feature(const_panic))] #![feature(in_band_lifetimes)] #![feature(iter_zip)] #![feature(map_try_insert)] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 2230461b5f4b5..3e562184614ab 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -123,7 +123,7 @@ #![feature(const_fn_trait_bound)] #![feature(const_impl_trait)] #![feature(const_mut_refs)] -#![feature(const_panic)] +#![cfg_attr(bootstrap, feature(const_panic))] #![feature(const_precise_live_drops)] #![feature(const_raw_ptr_deref)] #![feature(const_refs_to_cell)] diff --git a/src/test/mir-opt/remove-never-const.rs b/src/test/mir-opt/remove-never-const.rs index 1673f14b45ce4..017746647ab0d 100644 --- a/src/test/mir-opt/remove-never-const.rs +++ b/src/test/mir-opt/remove-never-const.rs @@ -5,7 +5,6 @@ // Force generation of optimized mir for functions that do not reach codegen. // compile-flags: --emit mir,link -#![feature(const_panic)] #![feature(never_type)] #![warn(const_err)] diff --git a/src/test/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir b/src/test/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir index 6f4a024d20f93..bf62c8441fd11 100644 --- a/src/test/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir +++ b/src/test/mir-opt/remove_never_const.no_codegen.PreCodegen.after.mir @@ -1,11 +1,11 @@ // MIR for `no_codegen` after PreCodegen fn no_codegen() -> () { - let mut _0: (); // return place in scope 0 at $DIR/remove-never-const.rs:19:20: 19:20 + let mut _0: (); // return place in scope 0 at $DIR/remove-never-const.rs:18:20: 18:20 scope 1 { } bb0: { - unreachable; // scope 0 at $DIR/remove-never-const.rs:20:13: 20:33 + unreachable; // scope 0 at $DIR/remove-never-const.rs:19:13: 19:33 } } diff --git a/src/test/ui/consts/const-eval/const_panic.rs b/src/test/ui/consts/const-eval/const_panic.rs index 100faded079d5..5b9a8f8e2a279 100644 --- a/src/test/ui/consts/const-eval/const_panic.rs +++ b/src/test/ui/consts/const-eval/const_panic.rs @@ -1,4 +1,3 @@ -#![feature(const_panic)] #![allow(non_fmt_panics)] #![crate_type = "lib"] diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr index e98e4a506c0d6..3932c2bc0ac73 100644 --- a/src/test/ui/consts/const-eval/const_panic.stderr +++ b/src/test/ui/consts/const-eval/const_panic.stderr @@ -1,96 +1,96 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:7:15 + --> $DIR/const_panic.rs:6:15 | LL | const Z: () = std::panic!("cheese"); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15 + | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:6:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:10:16 + --> $DIR/const_panic.rs:9:16 | LL | const Z2: () = std::panic!(); - | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16 + | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:9:16 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:13:15 + --> $DIR/const_panic.rs:12:15 | LL | const Y: () = std::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15 + | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:12:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:16:15 + --> $DIR/const_panic.rs:15:15 | LL | const X: () = std::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15 + | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:15:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:19:15 + --> $DIR/const_panic.rs:18:15 | LL | const W: () = std::panic!(MSG); - | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15 + | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:18:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:22:16 + --> $DIR/const_panic.rs:21:16 | LL | const W2: () = std::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:22:16 + | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:21:16 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:25:20 + --> $DIR/const_panic.rs:24:20 | LL | const Z_CORE: () = core::panic!("cheese"); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:25:20 + | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:24:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:28:21 + --> $DIR/const_panic.rs:27:21 | LL | const Z2_CORE: () = core::panic!(); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:28:21 + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:27:21 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:31:20 + --> $DIR/const_panic.rs:30:20 | LL | const Y_CORE: () = core::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:31:20 + | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:30:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:34:20 + --> $DIR/const_panic.rs:33:20 | LL | const X_CORE: () = core::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:34:20 + | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:33:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:37:20 + --> $DIR/const_panic.rs:36:20 | LL | const W_CORE: () = core::panic!(MSG); - | ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:37:20 + | ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:36:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic.rs:40:21 + --> $DIR/const_panic.rs:39:21 | LL | const W2_CORE: () = core::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:40:21 + | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:39:21 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_panic_2021.rs b/src/test/ui/consts/const-eval/const_panic_2021.rs index 9b8652a776e61..4702aa2f5f01c 100644 --- a/src/test/ui/consts/const-eval/const_panic_2021.rs +++ b/src/test/ui/consts/const-eval/const_panic_2021.rs @@ -1,5 +1,4 @@ // edition:2021 -#![feature(const_panic)] #![crate_type = "lib"] const MSG: &str = "hello"; 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 9eb241ae8e59d..975a07e2b0efa 100644 --- a/src/test/ui/consts/const-eval/const_panic_2021.stderr +++ b/src/test/ui/consts/const-eval/const_panic_2021.stderr @@ -1,80 +1,80 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:7:15 + --> $DIR/const_panic_2021.rs:6:15 | LL | const A: () = std::panic!("blåhaj"); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'blåhaj', $DIR/const_panic_2021.rs:7:15 + | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'blåhaj', $DIR/const_panic_2021.rs:6:15 | = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:10:15 + --> $DIR/const_panic_2021.rs:9:15 | LL | const B: () = std::panic!(); - | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:10:15 + | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:9:15 | = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:13:15 + --> $DIR/const_panic_2021.rs:12:15 | LL | const C: () = std::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:13:15 + | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:12:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:16:15 + --> $DIR/const_panic_2021.rs:15:15 | LL | const D: () = std::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:16:15 + | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:15:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:19:15 + --> $DIR/const_panic_2021.rs:18:15 | LL | const E: () = std::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:19:15 + | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:18:15 | = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:22:20 + --> $DIR/const_panic_2021.rs:21:20 | LL | const A_CORE: () = core::panic!("shark"); - | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'shark', $DIR/const_panic_2021.rs:22:20 + | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'shark', $DIR/const_panic_2021.rs:21:20 | = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:25:20 + --> $DIR/const_panic_2021.rs:24:20 | LL | const B_CORE: () = core::panic!(); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:25:20 + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:24:20 | = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:28:20 + --> $DIR/const_panic_2021.rs:27:20 | LL | const C_CORE: () = core::unreachable!(); - | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:28:20 + | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:27:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:31:20 + --> $DIR/const_panic_2021.rs:30:20 | LL | const D_CORE: () = core::unimplemented!(); - | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:31:20 + | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:30:20 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_2021.rs:34:20 + --> $DIR/const_panic_2021.rs:33:20 | LL | const E_CORE: () = core::panic!("{}", MSG); - | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:34:20 + | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:33:20 | = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs index 1ea0845c968c6..d4dc1a51d73aa 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs @@ -1,6 +1,5 @@ #![crate_type = "bin"] #![feature(lang_items)] -#![feature(const_panic)] #![no_main] #![no_std] 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 9abf8a20b8a35..b3fa38241a4ef 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 @@ -1,24 +1,24 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_libcore_bin.rs:9:15 + --> $DIR/const_panic_libcore_bin.rs:8:15 | LL | const Z: () = panic!("cheese"); - | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15 + | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:8:15 | = note: this error originates in the macro `$crate::panic::panic_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:12:15 + --> $DIR/const_panic_libcore_bin.rs:11:15 | LL | const Y: () = unreachable!(); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15 + | ^^^^^^^^^^^^^^ 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 `$crate::panic::panic_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:15:15 + --> $DIR/const_panic_libcore_bin.rs:14:15 | LL | const X: () = unimplemented!(); - | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15 + | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:14:15 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_panic_track_caller.rs b/src/test/ui/consts/const-eval/const_panic_track_caller.rs index 7c2532673c835..9cf7a3ba7dc1c 100644 --- a/src/test/ui/consts/const-eval/const_panic_track_caller.rs +++ b/src/test/ui/consts/const-eval/const_panic_track_caller.rs @@ -1,4 +1,3 @@ -#![feature(const_panic)] #![allow(non_fmt_panics)] #![crate_type = "lib"] diff --git a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr b/src/test/ui/consts/const-eval/const_panic_track_caller.stderr index 9a458db6ea24d..5c3b412d37fcc 100644 --- a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr +++ b/src/test/ui/consts/const-eval/const_panic_track_caller.stderr @@ -1,14 +1,14 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_panic_track_caller.rs:16:5 + --> $DIR/const_panic_track_caller.rs:15:5 | LL | b() | ^^^ | | - | the evaluated program panicked at 'hey', $DIR/const_panic_track_caller.rs:16:5 - | inside `c` at $DIR/const_panic_track_caller.rs:16:5 + | the evaluated program panicked at 'hey', $DIR/const_panic_track_caller.rs:15:5 + | inside `c` at $DIR/const_panic_track_caller.rs:15:5 ... LL | const X: u32 = c(); - | --- inside `X` at $DIR/const_panic_track_caller.rs:22:16 + | --- inside `X` at $DIR/const_panic_track_caller.rs:21:16 error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/feature-gate-const_panic.rs b/src/test/ui/consts/const-eval/feature-gate-const_panic.rs deleted file mode 100644 index ba5b07239a200..0000000000000 --- a/src/test/ui/consts/const-eval/feature-gate-const_panic.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn main() {} - -const Z: () = panic!("cheese"); -//~^ ERROR panicking in constants is unstable - -const Y: () = unreachable!(); -//~^ ERROR panicking in constants is unstable - -const X: () = unimplemented!(); -//~^ ERROR panicking in constants is unstable diff --git a/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr b/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr deleted file mode 100644 index 8d8e94cd4ff8a..0000000000000 --- a/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0658]: panicking in constants is unstable - --> $DIR/feature-gate-const_panic.rs:3:15 - | -LL | const Z: () = panic!("cheese"); - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #51999 for more information - = help: add `#![feature(const_panic)]` to the crate attributes to enable - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0658]: panicking in constants is unstable - --> $DIR/feature-gate-const_panic.rs:6:15 - | -LL | const Y: () = unreachable!(); - | ^^^^^^^^^^^^^^ - | - = note: see issue #51999 for more information - = help: add `#![feature(const_panic)]` to the crate attributes to enable - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0658]: panicking in constants is unstable - --> $DIR/feature-gate-const_panic.rs:9:15 - | -LL | const X: () = unimplemented!(); - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #51999 for more information - = help: add `#![feature(const_panic)]` to the crate attributes to enable - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs index ab0256a986dbc..2bdf5d5476576 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs @@ -2,7 +2,6 @@ // Regression test for #66975 #![warn(const_err)] -#![feature(const_panic)] #![feature(never_type)] struct PrintName; diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr index f1c606a8a2e5d..9631b7748b546 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -1,8 +1,8 @@ error[E0080]: evaluation of constant value failed - --> $DIR/panic-assoc-never-type.rs:11:21 + --> $DIR/panic-assoc-never-type.rs:10:21 | LL | const VOID: ! = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:10:21 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/panic-never-type.rs b/src/test/ui/consts/const-eval/panic-never-type.rs index dd875768b168f..a74d3ba297189 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-never-type.rs @@ -1,6 +1,5 @@ // Regression test for #66975 #![warn(const_err)] -#![feature(const_panic)] #![feature(never_type)] const VOID: ! = panic!(); diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr index 9b7f2181c1662..8f312d673a175 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-never-type.stderr @@ -1,8 +1,8 @@ error[E0080]: evaluation of constant value failed - --> $DIR/panic-never-type.rs:6:17 + --> $DIR/panic-never-type.rs:5:17 | LL | const VOID: ! = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:5:17 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/unwind-abort.rs b/src/test/ui/consts/const-eval/unwind-abort.rs index 89b5135fd37e3..2b0e58166c254 100644 --- a/src/test/ui/consts/const-eval/unwind-abort.rs +++ b/src/test/ui/consts/const-eval/unwind-abort.rs @@ -1,4 +1,4 @@ -#![feature(c_unwind, const_panic, const_extern_fn)] +#![feature(c_unwind, const_extern_fn)] const extern "C" fn foo() { panic!() //~ ERROR evaluation of constant value failed diff --git a/src/test/ui/consts/const-float-bits-conv.rs b/src/test/ui/consts/const-float-bits-conv.rs index 2dfc6de859783..c857ad6df2de2 100644 --- a/src/test/ui/consts/const-float-bits-conv.rs +++ b/src/test/ui/consts/const-float-bits-conv.rs @@ -1,7 +1,6 @@ // compile-flags: -Zmir-opt-level=0 // run-pass -#![feature(const_panic)] #![feature(const_float_bits_conv)] #![feature(const_float_classify)] diff --git a/src/test/ui/consts/const-float-classify.rs b/src/test/ui/consts/const-float-classify.rs index 5d38e032ac408..74238d0dd9231 100644 --- a/src/test/ui/consts/const-float-classify.rs +++ b/src/test/ui/consts/const-float-classify.rs @@ -1,7 +1,6 @@ // compile-flags: -Zmir-opt-level=0 // run-pass -#![feature(const_panic)] #![feature(const_float_bits_conv)] #![feature(const_float_classify)] #![feature(const_trait_impl)] diff --git a/src/test/ui/consts/control-flow/assert.rs b/src/test/ui/consts/control-flow/assert.rs index b311cb140ccf6..9d17f65b93cab 100644 --- a/src/test/ui/consts/control-flow/assert.rs +++ b/src/test/ui/consts/control-flow/assert.rs @@ -1,14 +1,8 @@ -// Test that `assert` works when `const_panic` is enabled. - -// revisions: stock const_panic - -#![cfg_attr(const_panic, feature(const_panic))] +// Test that `assert` works in consts. const _: () = assert!(true); -//[stock]~^ ERROR panicking in constants is unstable const _: () = assert!(false); -//[stock]~^ ERROR panicking in constants is unstable -//[const_panic]~^^ ERROR evaluation of constant value failed +//~^ ERROR evaluation of constant value failed fn main() {} diff --git a/src/test/ui/consts/control-flow/assert.const_panic.stderr b/src/test/ui/consts/control-flow/assert.stderr similarity index 82% rename from src/test/ui/consts/control-flow/assert.const_panic.stderr rename to src/test/ui/consts/control-flow/assert.stderr index 1deaa937edb37..8b1ca183de98b 100644 --- a/src/test/ui/consts/control-flow/assert.const_panic.stderr +++ b/src/test/ui/consts/control-flow/assert.stderr @@ -1,8 +1,8 @@ error[E0080]: evaluation of constant value failed - --> $DIR/assert.rs:10:15 + --> $DIR/assert.rs:5:15 | LL | const _: () = assert!(false); - | ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:10:15 + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:5:15 | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/control-flow/assert.stock.stderr b/src/test/ui/consts/control-flow/assert.stock.stderr deleted file mode 100644 index 0caaeca4ad23f..0000000000000 --- a/src/test/ui/consts/control-flow/assert.stock.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0658]: panicking in constants is unstable - --> $DIR/assert.rs:7:15 - | -LL | const _: () = assert!(true); - | ^^^^^^^^^^^^^ - | - = note: see issue #51999 for more information - = help: add `#![feature(const_panic)]` to the crate attributes to enable - = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0658]: panicking in constants is unstable - --> $DIR/assert.rs:10:15 - | -LL | const _: () = assert!(false); - | ^^^^^^^^^^^^^^ - | - = note: see issue #51999 for more information - = help: add `#![feature(const_panic)]` to the crate attributes to enable - = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/control-flow/basics.rs b/src/test/ui/consts/control-flow/basics.rs index 3a4f24bbcc339..02e5501f10cfe 100644 --- a/src/test/ui/consts/control-flow/basics.rs +++ b/src/test/ui/consts/control-flow/basics.rs @@ -2,8 +2,6 @@ // run-pass -#![feature(const_panic)] - const X: u32 = 4; const Y: u32 = 5; diff --git a/src/test/ui/consts/control-flow/short-circuit-let.rs b/src/test/ui/consts/control-flow/short-circuit-let.rs index 4dfa22b8ebaf6..8a58d06ac87bd 100644 --- a/src/test/ui/consts/control-flow/short-circuit-let.rs +++ b/src/test/ui/consts/control-flow/short-circuit-let.rs @@ -2,8 +2,6 @@ // run-pass -#![feature(const_panic)] - const X: i32 = { let mut x = 0; let _ = true && { x = 1; false }; diff --git a/src/test/ui/consts/control-flow/short-circuit.rs b/src/test/ui/consts/control-flow/short-circuit.rs index f6a0f03a4a6b8..6abe107855f80 100644 --- a/src/test/ui/consts/control-flow/short-circuit.rs +++ b/src/test/ui/consts/control-flow/short-circuit.rs @@ -3,8 +3,6 @@ // Test that both `&&` and `||` actually short-circuit. // Formerly, both sides were evaluated unconditionally -#![feature(const_panic)] - const TRUE: bool = true || panic!(); const FALSE: bool = false && panic!(); diff --git a/src/test/ui/consts/issue-32829.rs b/src/test/ui/consts/issue-32829.rs index adfee7b925cc5..25f323b9803c8 100644 --- a/src/test/ui/consts/issue-32829.rs +++ b/src/test/ui/consts/issue-32829.rs @@ -1,5 +1,5 @@ static S : u64 = { { panic!("foo"); 0 } }; -//~^ ERROR panicking in statics is unstable +//~^ ERROR could not evaluate static initializer fn main() { println!("{:?}", S); diff --git a/src/test/ui/consts/issue-32829.stderr b/src/test/ui/consts/issue-32829.stderr index eba15e3fcca8a..4b25bf1c99e18 100644 --- a/src/test/ui/consts/issue-32829.stderr +++ b/src/test/ui/consts/issue-32829.stderr @@ -1,13 +1,11 @@ -error[E0658]: panicking in statics is unstable +error[E0080]: could not evaluate static initializer --> $DIR/issue-32829.rs:1:22 | LL | static S : u64 = { { panic!("foo"); 0 } }; - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'foo', $DIR/issue-32829.rs:1:22 | - = note: see issue #51999 for more information - = help: add `#![feature(const_panic)]` to the crate attributes to enable = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/issue-66693-panic-in-array-len.rs b/src/test/ui/consts/issue-66693-panic-in-array-len.rs index 718a19067a6ac..fc0dcd7a44daa 100644 --- a/src/test/ui/consts/issue-66693-panic-in-array-len.rs +++ b/src/test/ui/consts/issue-66693-panic-in-array-len.rs @@ -2,8 +2,6 @@ // in a separate stage before `const`s and `statics` and so the error below is hit and // the compiler exits before generating errors for the others. -#![feature(const_panic)] - fn main() { let _ = [0i32; panic!(2f32)]; //~^ ERROR: argument to `panic!()` in a const context must have type `&str` diff --git a/src/test/ui/consts/issue-66693-panic-in-array-len.stderr b/src/test/ui/consts/issue-66693-panic-in-array-len.stderr index 2dd445b434b58..4ccbeb73c8a25 100644 --- a/src/test/ui/consts/issue-66693-panic-in-array-len.stderr +++ b/src/test/ui/consts/issue-66693-panic-in-array-len.stderr @@ -1,5 +1,5 @@ error: argument to `panic!()` in a const context must have type `&str` - --> $DIR/issue-66693-panic-in-array-len.rs:8:20 + --> $DIR/issue-66693-panic-in-array-len.rs:6:20 | LL | let _ = [0i32; panic!(2f32)]; | ^^^^^^^^^^^^ @@ -7,10 +7,10 @@ LL | let _ = [0i32; panic!(2f32)]; = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed - --> $DIR/issue-66693-panic-in-array-len.rs:12:21 + --> $DIR/issue-66693-panic-in-array-len.rs:10:21 | LL | let _ = [false; panic!()]; - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-66693-panic-in-array-len.rs:12:21 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-66693-panic-in-array-len.rs:10:21 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/issue-66693.rs b/src/test/ui/consts/issue-66693.rs index 77fe4417d5b10..909bef7aefbd3 100644 --- a/src/test/ui/consts/issue-66693.rs +++ b/src/test/ui/consts/issue-66693.rs @@ -1,8 +1,6 @@ // Tests that the compiler does not ICE when const-evaluating a `panic!()` invocation with a // non-`&str` argument. -#![feature(const_panic)] - const _: () = panic!(1); //~^ ERROR: argument to `panic!()` in a const context must have type `&str` diff --git a/src/test/ui/consts/issue-66693.stderr b/src/test/ui/consts/issue-66693.stderr index 3349e9813a809..3db6716a72e8b 100644 --- a/src/test/ui/consts/issue-66693.stderr +++ b/src/test/ui/consts/issue-66693.stderr @@ -1,5 +1,5 @@ error: argument to `panic!()` in a const context must have type `&str` - --> $DIR/issue-66693.rs:6:15 + --> $DIR/issue-66693.rs:4:15 | LL | const _: () = panic!(1); | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | const _: () = panic!(1); = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: argument to `panic!()` in a const context must have type `&str` - --> $DIR/issue-66693.rs:9:19 + --> $DIR/issue-66693.rs:7:19 | LL | static _FOO: () = panic!(true); | ^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | static _FOO: () = panic!(true); = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: argument to `panic!()` in a const context must have type `&str` - --> $DIR/issue-66693.rs:13:5 + --> $DIR/issue-66693.rs:11:5 | LL | panic!(&1); | ^^^^^^^^^^^ diff --git a/src/test/ui/consts/issue-76064.rs b/src/test/ui/consts/issue-76064.rs index d511f75df8129..3c153ad726e28 100644 --- a/src/test/ui/consts/issue-76064.rs +++ b/src/test/ui/consts/issue-76064.rs @@ -1,5 +1,3 @@ -// Note: non-`&str` panic arguments gained a separate error in PR #80734 -// which is why this doesn't match the issue -struct Bug([u8; panic!("panic")]); //~ ERROR panicking in constants is unstable +struct Bug([u8; panic!("panic")]); //~ ERROR evaluation of constant value failed fn main() {} diff --git a/src/test/ui/consts/issue-76064.stderr b/src/test/ui/consts/issue-76064.stderr index 875bc5c5cd330..ef9d140536a3d 100644 --- a/src/test/ui/consts/issue-76064.stderr +++ b/src/test/ui/consts/issue-76064.stderr @@ -1,13 +1,11 @@ -error[E0658]: panicking in constants is unstable - --> $DIR/issue-76064.rs:3:17 +error[E0080]: evaluation of constant value failed + --> $DIR/issue-76064.rs:1:17 | LL | struct Bug([u8; panic!("panic")]); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ the evaluated program panicked at 'panic', $DIR/issue-76064.rs:1:17 | - = note: see issue #51999 for more information - = help: add `#![feature(const_panic)]` to the crate attributes to enable = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr index 64d8540878ec2..186c5b1856baa 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr @@ -161,17 +161,11 @@ help: skipping check that does not even have a feature gate | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: skipping check for `const_panic` feature - --> $DIR/const_refers_to_static_cross_crate.rs:32:77 - | -LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | ^^^^^^^^ help: skipping check that does not even have a feature gate --> $DIR/const_refers_to_static_cross_crate.rs:32:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 10 previous errors; 3 warnings emitted diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr index 8e793ab3f0d91..7a64abd7b9cb8 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr @@ -161,17 +161,11 @@ help: skipping check that does not even have a feature gate | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: skipping check for `const_panic` feature - --> $DIR/const_refers_to_static_cross_crate.rs:32:77 - | -LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | ^^^^^^^^ help: skipping check that does not even have a feature gate --> $DIR/const_refers_to_static_cross_crate.rs:32:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this warning originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 10 previous errors; 3 warnings emitted diff --git a/src/test/ui/consts/ptr_comparisons.rs b/src/test/ui/consts/ptr_comparisons.rs index 9b5fd18f818b0..971b7c3cb179a 100644 --- a/src/test/ui/consts/ptr_comparisons.rs +++ b/src/test/ui/consts/ptr_comparisons.rs @@ -5,7 +5,6 @@ // normalize-stderr-64bit: "size 8" -> "size $$WORD" #![feature( - const_panic, core_intrinsics, const_raw_ptr_comparison, const_ptr_offset, diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr index a28ae521d5b9a..48cd5da213f3d 100644 --- a/src/test/ui/consts/ptr_comparisons.stderr +++ b/src/test/ui/consts/ptr_comparisons.stderr @@ -7,19 +7,19 @@ LL | unsafe { intrinsics::offset(self, count) } | pointer arithmetic failed: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds | inside `ptr::const_ptr::::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - ::: $DIR/ptr_comparisons.rs:61:34 + ::: $DIR/ptr_comparisons.rs:60:34 | LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) }; - | ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:61:34 + | ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:60:34 error[E0080]: evaluation of constant value failed - --> $DIR/ptr_comparisons.rs:64:33 + --> $DIR/ptr_comparisons.rs:63:33 | LL | unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: alloc3 has size $WORD, so pointer to 1000 bytes starting at offset 0 is out-of-bounds error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:68:27 + --> $DIR/ptr_comparisons.rs:67:27 | LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- @@ -31,7 +31,7 @@ LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + = note: for more information, see issue #71800 error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:73:27 + --> $DIR/ptr_comparisons.rs:72:27 | LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- diff --git a/src/test/ui/consts/ptr_is_null.rs b/src/test/ui/consts/ptr_is_null.rs index 324f59443f721..8babb68585dea 100644 --- a/src/test/ui/consts/ptr_is_null.rs +++ b/src/test/ui/consts/ptr_is_null.rs @@ -1,7 +1,7 @@ // compile-flags: --crate-type=lib // check-pass -#![feature(const_ptr_is_null, const_panic)] +#![feature(const_ptr_is_null)] const FOO: &usize = &42; diff --git a/src/test/ui/consts/unwind-abort.rs b/src/test/ui/consts/unwind-abort.rs index d9d0b91011d9a..6c94fc7b98b75 100644 --- a/src/test/ui/consts/unwind-abort.rs +++ b/src/test/ui/consts/unwind-abort.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(c_unwind, const_panic, const_extern_fn)] +#![feature(c_unwind, const_extern_fn)] // We don't unwind in const-eval anyways. const extern "C" fn foo() { diff --git a/src/test/ui/enum-discriminant/niche.rs b/src/test/ui/enum-discriminant/niche.rs index b3694bb4216c6..8d30610504f7d 100644 --- a/src/test/ui/enum-discriminant/niche.rs +++ b/src/test/ui/enum-discriminant/niche.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(const_panic)] - //! Make sure that we read and write enum discriminants correctly for corner cases caused //! by layout optimizations. diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs b/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs index 9a1b554f45f65..292017a1de24d 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop.rs @@ -3,7 +3,6 @@ #![feature(const_trait_impl)] #![feature(const_fn_trait_bound)] #![feature(const_mut_refs)] -#![feature(const_panic)] #![cfg_attr(precise, feature(const_precise_live_drops))] struct S<'a>(&'a mut u8);