@@ -4,8 +4,8 @@ use super::{MirPass, MirSource};
44use rustc_middle:: mir:: visit:: Visitor ;
55use rustc_middle:: {
66 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 ,
99 } ,
1010 ty:: {
1111 self ,
@@ -274,9 +274,33 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
274274 )
275275 }
276276 }
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+ }
277285 _ => { }
278286 }
279287 }
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+ }
280304 _ => { }
281305 }
282306 }
0 commit comments