This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 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> {
363363 if let Some ( ( & PlaceElem :: Deref , rest) ) = target. projection . split_last ( ) {
364364 * place = Place :: from ( target. local ) . project_deeper ( rest, self . tcx ) ;
365365 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;
368370 * place = target;
369371 self . any_replacement = true ;
370372 }
Original file line number Diff line number Diff line change @@ -548,6 +548,18 @@ fn debuginfo() {
548548 }
549549}
550550
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+
551563fn main ( ) {
552564 let mut x = 5_usize ;
553565 let mut y = 7_usize ;
@@ -562,6 +574,7 @@ fn main() {
562574 mut_raw_then_mut_shr ( ) ;
563575 unique_with_copies ( ) ;
564576 debuginfo ( ) ;
577+ many_debuginfo ( ) ;
565578}
566579
567580// EMIT_MIR reference_prop.reference_propagation.ReferencePropagation.diff
You can’t perform that action at this time.
0 commit comments