From d634f14f26dc6640a9b6cd8b5f896aaf1ecc3cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Tue, 28 Jun 2022 22:25:58 +0200 Subject: [PATCH] avoid walk when `get_ptr_alloc` returns no `AllocRef` --- compiler/rustc_const_eval/src/interpret/intern.rs | 3 +++ 1 file changed, 3 insertions(+) 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); } }