diff options
| author | bors <bors@rust-lang.org> | 2024-12-29 07:23:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-12-29 07:23:59 +0000 |
| commit | fd19773d2f8a070dc03f0072f9bc41a65fd04fed (patch) | |
| tree | 13357ef471bb5edba23b02120224a25a0ae209db /compiler/rustc_borrowck/src | |
| parent | 480eec0692f003c9d8bd477ee867f2f66643bc04 (diff) | |
| parent | 70fe5a150d2aa28e704a30a6ce8c2219e4b98583 (diff) | |
| download | rust-fd19773d2f8a070dc03f0072f9bc41a65fd04fed.tar.gz rust-fd19773d2f8a070dc03f0072f9bc41a65fd04fed.zip | |
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.
Diffstat (limited to 'compiler/rustc_borrowck/src')
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/mod.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index 907a3f16b06..a71508c84f6 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -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() |
