Skip to content

Commit

Permalink
miri: ICE on invalid terminators
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Mar 8, 2020
1 parent f943349 commit 4897594
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/librustc_mir/interpret/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,12 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Unreachable => throw_ub!(Unreachable),

// These should never occur for MIR we actually run.
DropAndReplace { .. } | FalseEdges { .. } | FalseUnwind { .. } => {
bug!("{:#?} should have been eliminated by MIR pass", terminator.kind)
}

// These are not (yet) supported. It is unclear if they even can occur in
// MIR that we actually run.
Yield { .. } | GeneratorDrop | Abort => {
throw_unsup_format!("Unsupported terminator kind: {:#?}", terminator.kind)
}
DropAndReplace { .. }
| FalseEdges { .. }
| FalseUnwind { .. }
| Yield { .. }
| GeneratorDrop
| Abort => bug!("{:#?} should have been eliminated by MIR pass", terminator.kind),
}

Ok(())
Expand Down

0 comments on commit 4897594

Please sign in to comment.