Rollup merge of #55142 - RalfJung:miri-uninhabited-enum, r=oli-obk

miri: layout should not affect CTFE checks (outside of validation)

Either the enum has no valid discriminant, then the code later will catch that; or it does, then we shouldn't error out so early (absent enforcing validity).

Interestingly, the miri test suite still passes; my guess is we don't even get here for uninhabited types?

r? @oli-obk
This commit is contained in:
kennytm 2018-10-18 10:47:36 +08:00
commit 89b7ccf407
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C

View file

@ -688,9 +688,6 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
rval: OpTy<'tcx, M::PointerTag>,
) -> EvalResult<'tcx, (u128, usize)> {
trace!("read_discriminant_value {:#?}", rval.layout);
if rval.layout.abi.is_uninhabited() {
return err!(Unreachable);
}
match rval.layout.variants {
layout::Variants::Single { index } => {