Auto merge of #104765 - chenyukang:yukang-fix-104639-lifetime-check, r=oli-obk
Find the right lower bound region in the scenario of partial order relations Fixes #104639
This commit is contained in:
commit
939a3ddf94
2 changed files with 17 additions and 20 deletions
|
@ -747,27 +747,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
// Otherwise, we need to find the minimum remaining choice, if
|
||||
// any, and take that.
|
||||
debug!("choice_regions remaining are {:#?}", choice_regions);
|
||||
let min = |r1: ty::RegionVid, r2: ty::RegionVid| -> Option<ty::RegionVid> {
|
||||
let r1_outlives_r2 = self.universal_region_relations.outlives(r1, r2);
|
||||
let r2_outlives_r1 = self.universal_region_relations.outlives(r2, r1);
|
||||
match (r1_outlives_r2, r2_outlives_r1) {
|
||||
(true, true) => Some(r1.min(r2)),
|
||||
(true, false) => Some(r2),
|
||||
(false, true) => Some(r1),
|
||||
(false, false) => None,
|
||||
}
|
||||
let Some(&min_choice) = choice_regions.iter().find(|&r1| {
|
||||
choice_regions.iter().all(|&r2| {
|
||||
self.universal_region_relations.outlives(r2, *r1)
|
||||
})
|
||||
}) else {
|
||||
debug!("no choice region outlived by all others");
|
||||
return false;
|
||||
};
|
||||
let mut min_choice = choice_regions[0];
|
||||
for &other_option in &choice_regions[1..] {
|
||||
debug!(?min_choice, ?other_option,);
|
||||
match min(min_choice, other_option) {
|
||||
Some(m) => min_choice = m,
|
||||
None => {
|
||||
debug!(?min_choice, ?other_option, "incomparable; no min choice",);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let min_choice_scc = self.constraint_sccs.scc(min_choice);
|
||||
debug!(?min_choice, ?min_choice_scc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue