@@ -233,18 +233,6 @@ impl Validator<'a, 'mir, 'tcx> {
233
233
self . check_op_spanned ( ops:: StaticAccess , span)
234
234
}
235
235
}
236
-
237
- fn check_immutable_borrow_like ( & mut self , location : Location , place : & Place < ' tcx > ) {
238
- let borrowed_place_has_mut_interior = HasMutInterior :: in_place (
239
- & self . item ,
240
- & mut |local| self . qualifs . has_mut_interior ( local, location) ,
241
- place. as_ref ( ) ,
242
- ) ;
243
-
244
- if borrowed_place_has_mut_interior {
245
- self . check_op ( ops:: CellBorrow ) ;
246
- }
247
- }
248
236
}
249
237
250
238
impl Visitor < ' tcx > for Validator < ' _ , ' mir , ' tcx > {
@@ -350,12 +338,17 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
350
338
Rvalue :: AddressOf ( Mutability :: Mut , _) => self . check_op ( ops:: MutAddressOf ) ,
351
339
352
340
Rvalue :: Ref ( _, BorrowKind :: Shared , ref place)
353
- | Rvalue :: Ref ( _, BorrowKind :: Shallow , ref place) => {
354
- self . check_immutable_borrow_like ( location, place)
355
- }
356
-
357
- Rvalue :: AddressOf ( Mutability :: Not , ref place) => {
358
- self . check_immutable_borrow_like ( location, place)
341
+ | Rvalue :: Ref ( _, BorrowKind :: Shallow , ref place)
342
+ | Rvalue :: AddressOf ( Mutability :: Not , ref place) => {
343
+ let borrowed_place_has_mut_interior = HasMutInterior :: in_place (
344
+ & self . item ,
345
+ & mut |local| self . qualifs . has_mut_interior ( local, location) ,
346
+ place. as_ref ( ) ,
347
+ ) ;
348
+
349
+ if borrowed_place_has_mut_interior {
350
+ self . check_op ( ops:: CellBorrow ) ;
351
+ }
359
352
}
360
353
361
354
Rvalue :: Cast ( CastKind :: Misc , ref operand, cast_ty) => {
0 commit comments