about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/const_eval
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-11 12:33:09 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-14 11:40:30 +0000
commit93888cd0a401581bc46f4bd85a1bf33d8ac14c7f (patch)
tree6504406c48bad2810ab87ec5ce0698099c4cbd09 /compiler/rustc_const_eval/src/const_eval
parentd6c999754c5a4d6d2a1e264825e71c56b394cbb0 (diff)
downloadrust-93888cd0a401581bc46f4bd85a1bf33d8ac14c7f.tar.gz
rust-93888cd0a401581bc46f4bd85a1bf33d8ac14c7f.zip
Move only usage of `take_static_root_alloc` to its definition and inline it
Diffstat (limited to 'compiler/rustc_const_eval/src/const_eval')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/eval_queries.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
index 1b401cc5cc0..63b1d485a24 100644
--- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
@@ -18,9 +18,9 @@ use crate::errors;
 use crate::errors::ConstEvalError;
 use crate::interpret::eval_nullary_intrinsic;
 use crate::interpret::{
-    create_static_alloc, intern_const_alloc_recursive, take_static_root_alloc, CtfeValidationMode,
-    GlobalId, Immediate, InternKind, InterpCx, InterpError, InterpResult, MPlaceTy, MemoryKind,
-    OpTy, RefTracking, StackPopCleanup,
+    create_static_alloc, intern_const_alloc_recursive, CtfeValidationMode, GlobalId, Immediate,
+    InternKind, InterpCx, InterpError, InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking,
+    StackPopCleanup,
 };
 
 // Returns a pointer to where the result lives
@@ -293,7 +293,7 @@ pub fn eval_static_initializer_provider<'tcx>(
     eval_in_interpreter(&mut ecx, cid, true)
 }
 
-trait InterpretationResult<'tcx> {
+pub trait InterpretationResult<'tcx> {
     /// This function takes the place where the result of the evaluation is stored
     /// and prepares it for returning it in the appropriate format needed by the specific
     /// evaluation query.
@@ -303,16 +303,6 @@ trait InterpretationResult<'tcx> {
     ) -> Self;
 }
 
-impl<'tcx> InterpretationResult<'tcx> for mir::interpret::ConstAllocation<'tcx> {
-    fn make_result<'mir>(
-        mplace: MPlaceTy<'tcx>,
-        ecx: &mut InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>,
-    ) -> Self {
-        let alloc = take_static_root_alloc(ecx, mplace.ptr().provenance.unwrap().alloc_id());
-        ecx.tcx.mk_const_alloc(alloc)
-    }
-}
-
 impl<'tcx> InterpretationResult<'tcx> for ConstAlloc<'tcx> {
     fn make_result<'mir>(
         mplace: MPlaceTy<'tcx>,