rustc: don't ICE when using Rvalue::Discriminant on a non-ADT.

This commit is contained in:
Eduard-Mihai Burtescu 2018-02-08 17:15:41 +02:00
parent 4f93357d3b
commit 4aa66dbe01

View File

@ -182,9 +182,8 @@ impl<'tcx> Rvalue<'tcx> {
if let ty::TyAdt(adt_def, _) = ty.sty {
adt_def.repr.discr_type().to_ty(tcx)
} else {
// Undefined behaviour, bug for now; may want to return something for
// the `discriminant` intrinsic later.
bug!("Rvalue::Discriminant on Place of type {:?}", ty);
// This can only be `0`, for now, so `u8` will suffice.
tcx.types.u8
}
}
Rvalue::NullaryOp(NullOp::Box, t) => tcx.mk_box(t),