Allow Unreachable
terminators unconditionally
This commit is contained in:
parent
d7afaa7247
commit
a1aff18689
1 changed files with 3 additions and 7 deletions
|
@ -344,7 +344,8 @@ fn check_terminator(
|
|||
| TerminatorKind::FalseUnwind { .. }
|
||||
| TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::Resume => Ok(()),
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::Unreachable => Ok(()),
|
||||
|
||||
TerminatorKind::Drop { location, .. } => check_place(tcx, *location, span, def_id, body),
|
||||
TerminatorKind::DropAndReplace { location, value, .. } => {
|
||||
|
@ -360,12 +361,7 @@ fn check_terminator(
|
|||
check_operand(tcx, discr, span, def_id, body)
|
||||
}
|
||||
|
||||
// FIXME(ecstaticmorse): We probably want to allow `Unreachable` unconditionally.
|
||||
TerminatorKind::Unreachable if feature_allowed(tcx, def_id, sym::const_if_match) => Ok(()),
|
||||
|
||||
TerminatorKind::Abort | TerminatorKind::Unreachable => {
|
||||
Err((span, "const fn with unreachable code is not stable".into()))
|
||||
}
|
||||
TerminatorKind::Abort => Err((span, "abort is not stable in const fn".into())),
|
||||
TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } => {
|
||||
Err((span, "const fn generators are unstable".into()))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue