about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
diff options
context:
space:
mode:
authorcarbotaniuman <41451839+carbotaniuman@users.noreply.github.com>2022-05-19 13:51:53 -0500
committercarbotaniuman <41451839+carbotaniuman@users.noreply.github.com>2022-05-19 13:51:53 -0500
commite24673502fbf4ae00b42362eed2cf915ba352325 (patch)
treed997227511c53a11c6c56a6dda23872082608a2c /compiler/rustc_const_eval/src/interpret
parent10d9ecda48f828e174d7a863fc43a155ad086efd (diff)
downloadrust-e24673502fbf4ae00b42362eed2cf915ba352325.tar.gz
rust-e24673502fbf4ae00b42362eed2cf915ba352325.zip
Remove unneeded asserts
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
-rw-r--r--compiler/rustc_const_eval/src/interpret/cast.rs3
-rw-r--r--compiler/rustc_const_eval/src/interpret/memory.rs6
2 files changed, 1 insertions, 8 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs
index 92eeafc5df0..7cd2ba34b04 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 33162a01ed2..5dba5e2d45e 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)
                 }
             },
         )