Skip to content

Commit

Permalink
downgrade some assertions to debug_ again
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 29, 2020
1 parent 6f568e7 commit 5982e9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 6 additions & 4 deletions src/librustc_mir/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 5982e9d

Please sign in to comment.