Remove NullOp::Box

This commit is contained in:
Gary Guo 2021-09-26 17:38:05 +01:00
parent 6162529a01
commit 1b7f5a3818
11 changed files with 2 additions and 92 deletions

View file

@ -267,10 +267,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.write_immediate(place.to_ref(self), &dest)?;
}
NullaryOp(mir::NullOp::Box, _) => {
M::box_alloc(self, &dest)?;
}
NullaryOp(null_op, ty) => {
let ty = self.subst_from_current_frame_and_normalize_erasing_regions(ty);
let layout = self.layout_of(ty)?;
@ -285,7 +281,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let val = match null_op {
mir::NullOp::SizeOf => layout.size.bytes(),
mir::NullOp::AlignOf => layout.align.abi.bytes(),
mir::NullOp::Box => unreachable!(),
};
self.write_scalar(Scalar::from_machine_usize(val, self), &dest)?;
}

View file

@ -680,7 +680,6 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
}
Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, _) => {}
Rvalue::NullaryOp(NullOp::Box, _) => self.check_op(ops::HeapAllocation),
Rvalue::ShallowInitBox(_, _) => {}
Rvalue::UnaryOp(_, ref operand) => {

View file

@ -517,7 +517,6 @@ impl<'tcx> Validator<'_, 'tcx> {
}
Rvalue::NullaryOp(op, _) => match op {
NullOp::Box => return Err(Unpromotable),
NullOp::SizeOf => {}
NullOp::AlignOf => {}
},