1
Fork 0

mir: Improve size_of handling when arg is unsized

This commit is contained in:
Ömer Sinan Ağacan 2021-01-21 20:10:40 +03:00
parent a243ad280a
commit e3faeb486a
3 changed files with 35 additions and 3 deletions

View file

@ -270,6 +270,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.frame().current_span(),
&format!("SizeOf nullary MIR operator called for unsized type {}", ty),
);
throw_inval!(SizeOfUnsizedType(ty));
}
self.write_scalar(Scalar::from_machine_usize(layout.size.bytes(), self), dest)?;
}