downgrade some assertions to debug_ again

This commit is contained in:
Ralf Jung 2020-02-29 10:25:57 +01:00
parent 6f568e72f3
commit 5982e9d3ca
2 changed files with 7 additions and 5 deletions

View File

@ -195,7 +195,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
kind: MemoryKind<M::MemoryKinds>,
) -> Pointer<M::PointerTag> {
let id = self.tcx.alloc_map.lock().reserve();
assert_ne!(
debug_assert_ne!(
Some(kind),
M::STATIC_KIND.map(MemoryKind::Machine),
"dynamically allocating static memory"

View File

@ -1130,10 +1130,12 @@ where
let layout = self.layout_of(ty)?;
// More sanity checks
let (size, align) = self.read_size_and_align_from_vtable(vtable)?;
assert_eq!(size, layout.size);
// only ABI alignment is preserved
assert_eq!(align, layout.align.abi);
if cfg!(debug_assertions) {
let (size, align) = self.read_size_and_align_from_vtable(vtable)?;
assert_eq!(size, layout.size);
// only ABI alignment is preserved
assert_eq!(align, layout.align.abi);
}
let mplace = MPlaceTy { mplace: MemPlace { meta: MemPlaceMeta::None, ..*mplace }, layout };
Ok((instance, mplace))