Skip to content

Commit

Permalink
rustc: don't ICE when using Rvalue::Discriminant on a non-ADT.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Feb 8, 2018
1 parent 4f93357 commit 4aa66db
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustc/mir/tcx.rs
Expand Up @@ -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),
Expand Down

0 comments on commit 4aa66db

Please sign in to comment.