about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-12-16 16:24:25 +0100
committerRalf Jung <post@ralfj.de>2024-01-22 09:28:00 +0100
commit2f1a8e2d7a641a398e9e02c8c99e80f6e44dce87 (patch)
treee8e044a80ab5b723153703589e31aa24308e2a6e /compiler/rustc_middle/src
parenta58ec8ff03b3269b20104eb7eae407be48ab95a7 (diff)
downloadrust-2f1a8e2d7a641a398e9e02c8c99e80f6e44dce87.tar.gz
rust-2f1a8e2d7a641a398e9e02c8c99e80f6e44dce87.zip
const-eval interner: from-scratch rewrite using mutability information from provenance rather than types
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/mir/interpret/error.rs4
-rw-r--r--compiler/rustc_middle/src/mir/interpret/pointer.rs6
2 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs
index 1b4e9c28635..1c9b4e558f0 100644
--- a/compiler/rustc_middle/src/mir/interpret/error.rs
+++ b/compiler/rustc_middle/src/mir/interpret/error.rs
@@ -416,14 +416,14 @@ pub enum ValidationErrorKind<'tcx> {
     PartialPointer,
     PtrToUninhabited { ptr_kind: PointerKind, ty: Ty<'tcx> },
     PtrToStatic { ptr_kind: PointerKind },
-    PtrToMut { ptr_kind: PointerKind },
     MutableRefInConst,
+    MutableRefToImmutable,
+    UnsafeCellInImmutable,
     NullFnPtr,
     NeverVal,
     NullablePtrOutOfRange { range: WrappingRange, max_value: u128 },
     PtrOutOfRange { range: WrappingRange, max_value: u128 },
     OutOfRange { value: String, range: WrappingRange, max_value: u128 },
-    UnsafeCell,
     UninhabitedVal { ty: Ty<'tcx> },
     InvalidEnumTag { value: String },
     UninhabitedEnumVariant,
diff --git a/compiler/rustc_middle/src/mir/interpret/pointer.rs b/compiler/rustc_middle/src/mir/interpret/pointer.rs
index 6893387736a..dabf6297aa9 100644
--- a/compiler/rustc_middle/src/mir/interpret/pointer.rs
+++ b/compiler/rustc_middle/src/mir/interpret/pointer.rs
@@ -277,6 +277,12 @@ impl From<AllocId> for Pointer {
         Pointer::new(alloc_id.into(), Size::ZERO)
     }
 }
+impl From<CtfeProvenance> for Pointer {
+    #[inline(always)]
+    fn from(prov: CtfeProvenance) -> Self {
+        Pointer::new(prov, Size::ZERO)
+    }
+}
 
 impl<Prov> From<Pointer<Prov>> for Pointer<Option<Prov>> {
     #[inline(always)]