about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2018-02-08 17:15:41 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-02-08 17:15:41 +0200
commit4aa66dbe01758740fe1e716771db9fdfe9a2e07b (patch)
tree8b0adf698d10f8c278014ac0d854ad7209c7a9c6
parent4f93357d3b8938dfe439329c43c1e4f919a70869 (diff)
rustc: don't ICE when using Rvalue::Discriminant on a non-ADT.
-rw-r--r--src/librustc/mir/tcx.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs
index 53607764b39..7c6e065d6a3 100644
--- a/src/librustc/mir/tcx.rs
+++ b/src/librustc/mir/tcx.rs
@@ -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),