Skip to content

Commit e590002

Browse files
Exhaustively match on StatementKind during const checking
1 parent 65a985e commit e590002

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/librustc_mir/transform/check_consts/validation.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,15 +478,20 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
478478
StatementKind::Assign(..) | StatementKind::SetDiscriminant { .. } => {
479479
self.super_statement(statement, location);
480480
}
481-
StatementKind::FakeRead(FakeReadCause::ForMatchedPlace, _) => {
481+
482+
StatementKind::FakeRead(
483+
FakeReadCause::ForMatchedPlace
484+
| FakeReadCause::ForMatchGuard
485+
| FakeReadCause::ForGuardBinding,
486+
_,
487+
) => {
482488
self.check_op(ops::IfOrMatch);
483489
}
484490
StatementKind::LlvmInlineAsm { .. } => {
485491
self.check_op(ops::InlineAsm);
486492
}
487493

488-
// FIXME(eddyb) should these really do nothing?
489-
StatementKind::FakeRead(..)
494+
StatementKind::FakeRead(FakeReadCause::ForLet | FakeReadCause::ForIndex, _)
490495
| StatementKind::StorageLive(_)
491496
| StatementKind::StorageDead(_)
492497
| StatementKind::Retag { .. }

0 commit comments

Comments
 (0)