@@ -456,27 +456,25 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
456
456
return ; // we have already visited everything by now
457
457
}
458
458
}
459
- ExprKind :: Borrow { borrow_kind, arg } => match borrow_kind {
460
- BorrowKind :: Shallow | BorrowKind :: Shared | BorrowKind :: Unique => {
461
- if !self . thir [ arg]
462
- . ty
463
- . is_freeze ( self . tcx . at ( self . thir [ arg] . span ) , self . param_env )
464
- {
465
- let mut visitor = LayoutConstrainedPlaceVisitor :: new ( self . thir , self . tcx ) ;
466
- visit:: walk_expr ( & mut visitor, expr) ;
467
- if visitor. found {
468
- self . requires_unsafe ( expr. span , BorrowOfLayoutConstrainedField ) ;
459
+ ExprKind :: Borrow { borrow_kind, arg } => {
460
+ let mut visitor = LayoutConstrainedPlaceVisitor :: new ( self . thir , self . tcx ) ;
461
+ visit:: walk_expr ( & mut visitor, expr) ;
462
+ if visitor. found {
463
+ match borrow_kind {
464
+ BorrowKind :: Shallow | BorrowKind :: Shared | BorrowKind :: Unique
465
+ if !self . thir [ arg]
466
+ . ty
467
+ . is_freeze ( self . tcx . at ( self . thir [ arg] . span ) , self . param_env ) =>
468
+ {
469
+ self . requires_unsafe ( expr. span , BorrowOfLayoutConstrainedField )
469
470
}
471
+ BorrowKind :: Mut { .. } => {
472
+ self . requires_unsafe ( expr. span , MutationOfLayoutConstrainedField )
473
+ }
474
+ BorrowKind :: Shallow | BorrowKind :: Shared | BorrowKind :: Unique => { }
470
475
}
471
476
}
472
- BorrowKind :: Mut { .. } => {
473
- let mut visitor = LayoutConstrainedPlaceVisitor :: new ( self . thir , self . tcx ) ;
474
- visit:: walk_expr ( & mut visitor, expr) ;
475
- if visitor. found {
476
- self . requires_unsafe ( expr. span , MutationOfLayoutConstrainedField ) ;
477
- }
478
- }
479
- } ,
477
+ }
480
478
_ => { }
481
479
}
482
480
visit:: walk_expr ( self , expr) ;
0 commit comments