From e24673502fbf4ae00b42362eed2cf915ba352325 Mon Sep 17 00:00:00 2001 From: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com> Date: Thu, 19 May 2022 13:51:53 -0500 Subject: [PATCH] Remove unneeded asserts --- compiler/rustc_const_eval/src/interpret/cast.rs | 3 --- compiler/rustc_const_eval/src/interpret/memory.rs | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs index 92eeafc5df098..7cd2ba34b04a7 100644 --- a/compiler/rustc_const_eval/src/interpret/cast.rs +++ b/compiler/rustc_const_eval/src/interpret/cast.rs @@ -225,9 +225,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let addr = u64::try_from(size.truncate(v)).unwrap(); let ptr = M::ptr_from_addr_cast(&self, addr); - if addr == 0 { - assert!(ptr.provenance.is_none(), "null pointer can never have an AllocId"); - } Scalar::from_maybe_pointer(ptr, self) } diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 33162a01ed201..5dba5e2d45e80 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -1144,11 +1144,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Err(ptr) => ptr.into(), Ok(bits) => { let addr = u64::try_from(bits).unwrap(); - let ptr = M::ptr_from_addr_transmute(&self, addr); - if addr == 0 { - assert!(ptr.provenance.is_none(), "null pointer can never have an AllocId"); - } - ptr + M::ptr_from_addr_transmute(&self, addr) } }, )