Skip to content

Commit

Permalink
'Ref' can now be sure it gets a 'Pointer'
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 28, 2019
1 parent 74fbdb6 commit 647c0e0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/librustc_mir/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,12 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {

Ref(_, _, ref place) => {
let src = self.eval_place(place)?;
let val = self.force_allocation(src)?;
self.write_immediate(val.to_ref(), dest)?;
let place = self.force_allocation(src)?;
if place.layout.size.bytes() > 0 {
// definitely not a ZST
assert!(place.ptr.is_ptr(), "non-ZST places should be normalized to `Pointer`");
}
self.write_immediate(place.to_ref(), dest)?;
}

NullaryOp(mir::NullOp::Box, _) => {
Expand Down

0 comments on commit 647c0e0

Please sign in to comment.