Auto merge of #134627 - estebank:issue-133252, r=jackh726
Avoid ICE in borrowck Provide a fallback in `best_blame_constraint` when `find_constraint_paths_between_regions` doesn't have a result. This code is due a rework to avoid the letf-over `unwrap()`, but avoids the ICE caused by the repro. Fix #133252.
This commit is contained in:
commit
fd19773d2f
3 changed files with 47 additions and 3 deletions
|
@ -1950,8 +1950,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
target_test: impl Fn(RegionVid) -> bool,
|
||||
) -> (BlameConstraint<'tcx>, Vec<ExtraConstraintInfo>) {
|
||||
// Find all paths
|
||||
let (path, target_region) =
|
||||
self.find_constraint_paths_between_regions(from_region, target_test).unwrap();
|
||||
let (path, target_region) = self
|
||||
.find_constraint_paths_between_regions(from_region, target_test)
|
||||
.or_else(|| {
|
||||
self.find_constraint_paths_between_regions(from_region, |r| {
|
||||
self.cannot_name_placeholder(from_region, r)
|
||||
})
|
||||
})
|
||||
.unwrap();
|
||||
debug!(
|
||||
"path={:#?}",
|
||||
path.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue