Skip to content

Commit 801e326

Browse files
authored
Rollup merge of #103315 - RalfJung:interpret-switchint-ice, r=bjorn3
interpret: remove an incorrect assertion This fixes an ICE in Miri, [reported](https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/SwitchInt.20with.20no.20targets.3F) by `@saethlin.` The faulty assertion was introduced by 432535d, when a previously correct assertion checking that the `otherwise` target exists got replaced by this assertion checking that at least one more target beyond `otherwise` exists. Sadly we don't have a small reproducer so I don't think we can easily add a testcase.
2 parents 01111d4 + bf14e31 commit 801e326

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

compiler/rustc_const_eval/src/interpret/terminator.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
3535
assert_eq!(discr.layout.ty, switch_ty);
3636

3737
// Branch to the `otherwise` case by default, if no match is found.
38-
assert!(!targets.iter().is_empty());
3938
let mut target_block = targets.otherwise();
4039

4140
for (const_int, target) in targets.iter() {

0 commit comments

Comments
 (0)