pub variant_index: Option<VariantIdx>,
}
-static_assert!(PLACE_TY_IS_3_PTRS_LARGE:
- mem::size_of::<PlaceTy<'_>>() <= 24
-);
+// At least on 64 bit systems, `PlaceTy` should not be larger than two or three pointers.
+#[cfg(target_arch = "x86_64")]
+static_assert_size!(PlaceTy<'_>, 16);
impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> {
pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> {
}
Rvalue::Discriminant(ref place) => {
let ty = place.ty(local_decls, tcx).ty;
- if let ty::Adt(adt_def, _) = ty.sty {
- adt_def.repr.discr_type().to_ty(tcx)
- } else {
- // This can only be `0`, for now, so `u8` will suffice.
- tcx.types.u8
+ match ty.sty {
+ ty::Adt(adt_def, _) => adt_def.repr.discr_type().to_ty(tcx),
+ ty::Generator(_, substs, _) => substs.discr_ty(tcx),
+ _ => {
+ // This can only be `0`, for now, so `u8` will suffice.
+ tcx.types.u8
+ }
}
}
Rvalue::NullaryOp(NullOp::Box, t) => tcx.mk_box(t),