@@ -276,7 +276,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
276276 PlaceContext :: MutatingUse ( MutatingUseContext :: Borrow )
277277 }
278278 } ;
279- self . visit_place_base ( & place. local , ctx, location) ;
279+ self . visit_local ( & place. local , ctx, location) ;
280280 self . visit_projection ( place. local , reborrowed_proj, ctx, location) ;
281281 return ;
282282 }
@@ -289,7 +289,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
289289 }
290290 Mutability :: Mut => PlaceContext :: MutatingUse ( MutatingUseContext :: AddressOf ) ,
291291 } ;
292- self . visit_place_base ( & place. local , ctx, location) ;
292+ self . visit_local ( & place. local , ctx, location) ;
293293 self . visit_projection ( place. local , reborrowed_proj, ctx, location) ;
294294 return ;
295295 }
@@ -386,14 +386,13 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
386386 }
387387 }
388388
389- fn visit_place_base ( & mut self , place_local : & Local , context : PlaceContext , location : Location ) {
389+ fn visit_local ( & mut self , place_local : & Local , context : PlaceContext , location : Location ) {
390390 trace ! (
391- "visit_place_base : place_local={:?} context={:?} location={:?}" ,
391+ "visit_local : place_local={:?} context={:?} location={:?}" ,
392392 place_local,
393393 context,
394394 location,
395395 ) ;
396- self . super_place_base ( place_local, context, location) ;
397396 }
398397
399398 fn visit_operand ( & mut self , op : & Operand < ' tcx > , location : Location ) {
@@ -478,14 +477,24 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
478477 StatementKind :: Assign ( ..) | StatementKind :: SetDiscriminant { .. } => {
479478 self . super_statement ( statement, location) ;
480479 }
481- StatementKind :: FakeRead ( FakeReadCause :: ForMatchedPlace , _) => {
480+
481+ StatementKind :: FakeRead (
482+ FakeReadCause :: ForMatchedPlace
483+ | FakeReadCause :: ForMatchGuard
484+ | FakeReadCause :: ForGuardBinding ,
485+ _,
486+ ) => {
487+ self . super_statement ( statement, location) ;
482488 self . check_op ( ops:: IfOrMatch ) ;
483489 }
484- // FIXME(eddyb) should these really do nothing?
485- StatementKind :: FakeRead ( ..)
490+ StatementKind :: LlvmInlineAsm { .. } => {
491+ self . super_statement ( statement, location) ;
492+ self . check_op ( ops:: InlineAsm ) ;
493+ }
494+
495+ StatementKind :: FakeRead ( FakeReadCause :: ForLet | FakeReadCause :: ForIndex , _)
486496 | StatementKind :: StorageLive ( _)
487497 | StatementKind :: StorageDead ( _)
488- | StatementKind :: LlvmInlineAsm { .. }
489498 | StatementKind :: Retag { .. }
490499 | StatementKind :: AscribeUserType ( ..)
491500 | StatementKind :: Nop => { }
@@ -572,7 +581,19 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
572581 }
573582 }
574583
575- _ => { }
584+ // FIXME: Some of these are only caught by `min_const_fn`, but should error here
585+ // instead.
586+ TerminatorKind :: Abort
587+ | TerminatorKind :: Assert { .. }
588+ | TerminatorKind :: FalseEdges { .. }
589+ | TerminatorKind :: FalseUnwind { .. }
590+ | TerminatorKind :: GeneratorDrop
591+ | TerminatorKind :: Goto { .. }
592+ | TerminatorKind :: Resume
593+ | TerminatorKind :: Return
594+ | TerminatorKind :: SwitchInt { .. }
595+ | TerminatorKind :: Unreachable
596+ | TerminatorKind :: Yield { .. } => { }
576597 }
577598 }
578599}
0 commit comments