Skip to content

Commit 6369d43

Browse files
eddybMark-Simulacrum
authored andcommitted
rustc: don't ICE when using Rvalue::Discriminant on a non-ADT.
1 parent 23773b7 commit 6369d43

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/librustc/mir/tcx.rs

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

0 commit comments

Comments
 (0)