about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-12 10:04:36 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-14 12:21:23 +0000
commit2e6c4900b63c401cea4e4b0492e075def65508dd (patch)
treef8f889600e24d63f2a3db7cabecacb6f961f8f6a /compiler/rustc_const_eval/src
parentcc7e0b22003defc5f99fe8048e09ad4f730768c4 (diff)
downloadrust-2e6c4900b63c401cea4e4b0492e075def65508dd.tar.gz
rust-2e6c4900b63c401cea4e4b0492e075def65508dd.zip
Move validation into eval_body_using_ecx
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/eval_queries.rs10
1 files changed, 4 insertions, 6 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 2608107826f..4f41c977f2e 100644
--- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
@@ -84,6 +84,9 @@ fn eval_body_using_ecx<'mir, 'tcx>(
     // Intern the result
     intern_const_alloc_recursive(ecx, intern_kind, &ret)?;
 
+    // Since evaluation had no errors, validate the resulting constant.
+    const_validate_mplace(&ecx, &ret, cid)?;
+
     Ok(ret)
 }
 
@@ -382,12 +385,7 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
                 },
             ))
         }
-        Ok(mplace) => {
-            // Since evaluation had no errors, validate the resulting constant.
-            const_validate_mplace(&ecx, &mplace, cid)?;
-
-            Ok(R::make_result(mplace, ecx))
-        }
+        Ok(mplace) => Ok(R::make_result(mplace, ecx)),
     }
 }