diff --git a/compiler/rustc_mir/src/transform/check_consts/ops.rs b/compiler/rustc_mir/src/transform/check_consts/ops.rs index 25ed7859d2187..9ba5d11c2bb00 100644 --- a/compiler/rustc_mir/src/transform/check_consts/ops.rs +++ b/compiler/rustc_mir/src/transform/check_consts/ops.rs @@ -44,12 +44,14 @@ pub trait NonConstOp: std::fmt::Debug { #[derive(Debug)] pub struct Abort; impl NonConstOp for Abort { - fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status { - mcf_status_in_item(ccx) - } - fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> { - mcf_build_error(ccx, span, "abort is not stable in const fn") + struct_span_err!( + ccx.tcx.sess, + span, + E0723, + "unwind strategies besides the default are not allowed in {}s", + ccx.const_kind(), + ) } }