@@ -4,8 +4,8 @@ use super::{MirPass, MirSource};
4
4
use rustc_middle:: mir:: visit:: Visitor ;
5
5
use rustc_middle:: {
6
6
mir:: {
7
- AggregateKind , BasicBlock , Body , Location , MirPhase , Operand , Rvalue , Statement ,
8
- StatementKind , Terminator , TerminatorKind ,
7
+ AggregateKind , BasicBlock , Body , BorrowKind , Location , MirPhase , Operand , Rvalue ,
8
+ Statement , StatementKind , Terminator , TerminatorKind ,
9
9
} ,
10
10
ty:: {
11
11
self ,
@@ -274,9 +274,33 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
274
274
)
275
275
}
276
276
}
277
+ Rvalue :: Ref ( _, BorrowKind :: Shallow , _) => {
278
+ if self . mir_phase > MirPhase :: DropLowering {
279
+ self . fail (
280
+ location,
281
+ "`Assign` statement with a `Shallow` borrow should have been removed after drop lowering phase" ,
282
+ ) ;
283
+ }
284
+ }
277
285
_ => { }
278
286
}
279
287
}
288
+ StatementKind :: AscribeUserType ( ..) => {
289
+ if self . mir_phase > MirPhase :: DropLowering {
290
+ self . fail (
291
+ location,
292
+ "`AscribeUserType` should have been removed after drop lowering phase" ,
293
+ ) ;
294
+ }
295
+ }
296
+ StatementKind :: FakeRead ( ..) => {
297
+ if self . mir_phase > MirPhase :: DropLowering {
298
+ self . fail (
299
+ location,
300
+ "`FakeRead` should have been removed after drop lowering phase" ,
301
+ ) ;
302
+ }
303
+ }
280
304
_ => { }
281
305
}
282
306
}
0 commit comments