summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2024-03-08 11:24:48 -0500
committerFelix S. Klock II <pnkfelix@pnkfx.org>2024-03-13 10:32:39 -0400
commita8549b4152566d8fbd34c097236df1db3d9afd3c (patch)
tree3b28f9b575405d5e415d60b63236ffa1bf519930 /compiler/rustc_const_eval/src/interpret
parent9ce37dc7290e60bd0dfc7a5d4fcdbbd836f989f0 (diff)
downloadrust-a8549b4152566d8fbd34c097236df1db3d9afd3c.tar.gz
rust-a8549b4152566d8fbd34c097236df1db3d9afd3c.zip
downgrade mutable-ptr-in-final-value from hard-error to future-incompat lint to address issue 121610.
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
-rw-r--r--compiler/rustc_const_eval/src/interpret/intern.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs
index 55d4b9edd59..0994ace814c 100644
--- a/compiler/rustc_const_eval/src/interpret/intern.rs
+++ b/compiler/rustc_const_eval/src/interpret/intern.rs
@@ -23,6 +23,7 @@ use rustc_middle::query::TyCtxtAt;
 use rustc_middle::ty::layout::TyAndLayout;
 use rustc_span::def_id::LocalDefId;
 use rustc_span::sym;
+use rustc_session::lint;
 
 use super::{AllocId, Allocation, InterpCx, MPlaceTy, Machine, MemoryKind, PlaceTy};
 use crate::const_eval;
@@ -262,10 +263,13 @@ pub fn intern_const_alloc_recursive<
         })?);
     }
     if found_bad_mutable_pointer {
-        return Err(ecx
-            .tcx
-            .dcx()
-            .emit_err(MutablePtrInFinal { span: ecx.tcx.span, kind: intern_kind }));
+        let err_diag = MutablePtrInFinal { span: ecx.tcx.span, kind: intern_kind };
+        ecx.tcx.emit_node_span_lint(
+            lint::builtin::CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE,
+            ecx.best_lint_scope(),
+            err_diag.span,
+            err_diag,
+        )
     }
 
     Ok(())