Do not ICE on deeply nested borrows.
This commit is contained in:
parent
19652377c3
commit
13fb0794ac
2 changed files with 17 additions and 2 deletions
|
@ -363,8 +363,10 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> {
|
|||
if let Some((&PlaceElem::Deref, rest)) = target.projection.split_last() {
|
||||
*place = Place::from(target.local).project_deeper(rest, self.tcx);
|
||||
self.any_replacement = true;
|
||||
} else if self.fully_replacable_locals.contains(place.local) {
|
||||
debuginfo.references += 1;
|
||||
} else if self.fully_replacable_locals.contains(place.local)
|
||||
&& let Some(references) = debuginfo.references.checked_add(1)
|
||||
{
|
||||
debuginfo.references = references;
|
||||
*place = target;
|
||||
self.any_replacement = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue