about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_mir/src/transform/check_consts/ops.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_mir/src/transform/check_consts/ops.rs b/compiler/rustc_mir/src/transform/check_consts/ops.rs
index e14dcf92b89..d978d927981 100644
--- a/compiler/rustc_mir/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_mir/src/transform/check_consts/ops.rs
@@ -535,6 +535,7 @@ impl NonConstOp for UnsizingCast {
     }
 }
 
+// Types that cannot appear in the signature or locals of a `const fn`.
 pub mod ty {
     use super::*;
 
@@ -548,7 +549,13 @@ pub mod ty {
         }
 
         fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
-            mcf_emit_error(ccx, span, "mutable references in const fn are unstable");
+            feature_err(
+                &ccx.tcx.sess.parse_sess,
+                sym::const_mut_refs,
+                span,
+                &format!("mutable references are not allowed in {}s", ccx.const_kind()),
+            )
+            .emit()
         }
     }