parent
f09fb488f7
commit
3fb53c2c85
3 changed files with 82 additions and 4 deletions
|
@ -264,10 +264,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
NullaryOp(mir::NullOp::SizeOf, ty) => {
|
||||
let ty = self.subst_from_current_frame_and_normalize_erasing_regions(ty);
|
||||
let layout = self.layout_of(ty)?;
|
||||
assert!(
|
||||
!layout.is_unsized(),
|
||||
"SizeOf nullary MIR operator called for unsized type"
|
||||
);
|
||||
if layout.is_unsized() {
|
||||
// FIXME: This should be a span_bug (#80742)
|
||||
self.tcx.sess.delay_span_bug(
|
||||
self.frame().current_span(),
|
||||
&format!("SizeOf nullary MIR operator called for unsized type {}", ty),
|
||||
);
|
||||
}
|
||||
self.write_scalar(Scalar::from_machine_usize(layout.size.bytes(), self), dest)?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue