File tree 2 files changed +17
-2
lines changed
compiler/rustc_mir_transform/src
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -363,8 +363,10 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
363
363
if let Some ( ( & PlaceElem :: Deref , rest) ) = target. projection . split_last ( ) {
364
364
* place = Place :: from ( target. local ) . project_deeper ( rest, self . tcx ) ;
365
365
self . any_replacement = true ;
366
- } else if self . fully_replacable_locals . contains ( place. local ) {
367
- debuginfo. references += 1 ;
366
+ } else if self . fully_replacable_locals . contains ( place. local )
367
+ && let Some ( references) = debuginfo. references . checked_add ( 1 )
368
+ {
369
+ debuginfo. references = references;
368
370
* place = target;
369
371
self . any_replacement = true ;
370
372
}
Original file line number Diff line number Diff line change @@ -548,6 +548,18 @@ fn debuginfo() {
548
548
}
549
549
}
550
550
551
+ fn many_debuginfo ( ) {
552
+ let a = 0 ;
553
+
554
+ // Verify that we do not ICE on deeply nested borrows.
555
+ let many_borrow =
556
+ & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &
557
+ & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &
558
+ & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &
559
+ & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &
560
+ & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & a;
561
+ }
562
+
551
563
fn main ( ) {
552
564
let mut x = 5_usize ;
553
565
let mut y = 7_usize ;
@@ -562,6 +574,7 @@ fn main() {
562
574
mut_raw_then_mut_shr ( ) ;
563
575
unique_with_copies ( ) ;
564
576
debuginfo ( ) ;
577
+ many_debuginfo ( ) ;
565
578
}
566
579
567
580
// EMIT_MIR reference_prop.reference_propagation.ReferencePropagation.diff
You can’t perform that action at this time.
0 commit comments