about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/const_eval
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-03-09 19:13:18 +0100
committerRalf Jung <post@ralfj.de>2024-03-09 20:00:24 +0100
commitbf47df8b0be83dde623a1057e63fd728c0ae5dec (patch)
tree8d7da9198a8632a7e0a83534af4e5dd22903d73a /compiler/rustc_const_eval/src/const_eval
parentb054da815501bafb24a08284151d32862f7a3a13 (diff)
downloadrust-bf47df8b0be83dde623a1057e63fd728c0ae5dec.tar.gz
rust-bf47df8b0be83dde623a1057e63fd728c0ae5dec.zip
interpret: do not call machine read hooks during validation
Diffstat (limited to 'compiler/rustc_const_eval/src/const_eval')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/eval_queries.rs8
1 files changed, 2 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 9e4e7911c3a..6dd53151a4e 100644
--- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
@@ -380,16 +380,12 @@ pub fn eval_in_interpreter<'mir, 'tcx>(
         }
         Ok(mplace) => {
             // Since evaluation had no errors, validate the resulting constant.
-
-            // Temporarily allow access to the static_root_alloc_id for the purpose of validation.
-            let static_root_alloc_id = ecx.machine.static_root_alloc_id.take();
-            let validation = const_validate_mplace(&ecx, &mplace, cid);
-            ecx.machine.static_root_alloc_id = static_root_alloc_id;
+            let res = const_validate_mplace(&ecx, &mplace, cid);
 
             let alloc_id = mplace.ptr().provenance.unwrap().alloc_id();
 
             // Validation failed, report an error.
-            if let Err(error) = validation {
+            if let Err(error) = res {
                 Err(const_report_error(&ecx, error, alloc_id))
             } else {
                 // Convert to raw constant