about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2022-06-28 22:25:58 +0200
committerRémy Rakic <remy.rakic+github@gmail.com>2022-06-29 02:05:02 +0200
commitd634f14f26dc6640a9b6cd8b5f896aaf1ecc3cb6 (patch)
treed5de56858962e04f5a3649d2995044ac6e971a71
parent6d03c8d751128ce064fac4f607e5478db41b04b5 (diff)
downloadrust-d634f14f26dc6640a9b6cd8b5f896aaf1ecc3cb6.tar.gz
rust-d634f14f26dc6640a9b6cd8b5f896aaf1ecc3cb6.zip
avoid walk when `get_ptr_alloc` returns no `AllocRef`
-rw-r--r--compiler/rustc_const_eval/src/interpret/intern.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs
index 2f384247caa..9997bb2c0fd 100644
--- a/compiler/rustc_const_eval/src/interpret/intern.rs
+++ b/compiler/rustc_const_eval/src/interpret/intern.rs
@@ -197,6 +197,9 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, const_eval::Memory
                     if !alloc.has_relocations() {
                         return Ok(false);
                     }
+                } else {
+                    // We're encountering a ZST here, and can avoid the walk as well.
+                    return Ok(false);
                 }
             }