From 46d09f7a4b2fe6675f06394a187cef46728412d3 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 19 Apr 2021 14:17:07 +0200 Subject: [PATCH] remove E0723 error code --- compiler/rustc_error_codes/src/error_codes.rs | 2 +- .../src/error_codes/E0723.md | 20 ------------------- .../src/transform/check_consts/validation.rs | 14 ++++++------- .../stability.stderr | 3 +-- 4 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 compiler/rustc_error_codes/src/error_codes/E0723.md diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index 4b529734328c7..41a1fa488d31b 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -416,7 +416,6 @@ E0716: include_str!("./error_codes/E0716.md"), E0718: include_str!("./error_codes/E0718.md"), E0719: include_str!("./error_codes/E0719.md"), E0720: include_str!("./error_codes/E0720.md"), -E0723: include_str!("./error_codes/E0723.md"), E0724: include_str!("./error_codes/E0724.md"), E0725: include_str!("./error_codes/E0725.md"), E0727: include_str!("./error_codes/E0727.md"), @@ -636,6 +635,7 @@ E0781: include_str!("./error_codes/E0781.md"), E0717, // rustc_promotable without stability attribute // E0721, // `await` keyword E0722, // Malformed `#[optimize]` attribute +// E0723, unstable feature in `const` context E0726, // non-explicit (not `'_`) elided lifetime in unsupported position // E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`. E0757, // `#[ffi_const]` functions cannot be `#[ffi_pure]` diff --git a/compiler/rustc_error_codes/src/error_codes/E0723.md b/compiler/rustc_error_codes/src/error_codes/E0723.md deleted file mode 100644 index bc2244219156c..0000000000000 --- a/compiler/rustc_error_codes/src/error_codes/E0723.md +++ /dev/null @@ -1,20 +0,0 @@ -An unstable feature in `const` contexts was used. - -Erroneous code example: - -```compile_fail,E0723 -const fn foo(_: T) { // error! - // ... -} -``` - -To enable this feature on a nightly version of rustc, add the `const_fn` -feature flag: - -``` -#![feature(const_fn)] - -const fn foo(_: T) { // ok! - // ... -} -``` diff --git a/compiler/rustc_mir/src/transform/check_consts/validation.rs b/compiler/rustc_mir/src/transform/check_consts/validation.rs index ce5e41d3e7c86..cf7d404a07789 100644 --- a/compiler/rustc_mir/src/transform/check_consts/validation.rs +++ b/compiler/rustc_mir/src/transform/check_consts/validation.rs @@ -1,6 +1,6 @@ //! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations. -use rustc_errors::{struct_span_err, Applicability, Diagnostic, ErrorReported}; +use rustc_errors::{Applicability, Diagnostic, ErrorReported}; use rustc_hir::def_id::DefId; use rustc_hir::{self as hir, HirId, LangItem}; use rustc_index::bit_set::BitSet; @@ -234,13 +234,11 @@ impl Validator<'mir, 'tcx> { if self.is_const_stable_const_fn() { let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); if crate::const_eval::is_parent_const_impl_raw(tcx, hir_id) { - struct_span_err!( - self.ccx.tcx.sess, - self.span, - E0723, - "trait methods cannot be stable const fn" - ) - .emit(); + self.ccx + .tcx + .sess + .struct_span_err(self.span, "trait methods cannot be stable const fn") + .emit(); } } diff --git a/src/test/ui/rfc-2632-const-trait-impl/stability.stderr b/src/test/ui/rfc-2632-const-trait-impl/stability.stderr index 54d7cfd5d7973..5b2ebccef1c6d 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/stability.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/stability.stderr @@ -1,4 +1,4 @@ -error[E0723]: trait methods cannot be stable const fn +error: trait methods cannot be stable const fn --> $DIR/stability.rs:14:5 | LL | / fn sub(self, rhs: Self) -> Self { @@ -17,4 +17,3 @@ LL | Int(1i32) + Int(2i32) error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0723`.