Skip to content

Commit 89b7ccf

Browse files
committed
Rollup merge of rust-lang#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
2 parents 6f6878c + c31819b commit 89b7ccf

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

src/librustc_mir/interpret/operand.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,6 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
688688
rval: OpTy<'tcx, M::PointerTag>,
689689
) -> EvalResult<'tcx, (u128, usize)> {
690690
trace!("read_discriminant_value {:#?}", rval.layout);
691-
if rval.layout.abi.is_uninhabited() {
692-
return err!(Unreachable);
693-
}
694691

695692
match rval.layout.variants {
696693
layout::Variants::Single { index } => {

0 commit comments

Comments
 (0)