Skip to content

Commit 594e74d

Browse files
authored
Rollup merge of rust-lang#134553 - lcnr:member-constraints-comment, r=oli-obk
add member constraints comment r? `@oli-obk` i guess
2 parents 89ac4e0 + adf5498 commit 594e74d

File tree

1 file changed

+6
-3
lines changed
  • compiler/rustc_borrowck/src/region_infer

1 file changed

+6
-3
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
795795

796796
// If the member region lives in a higher universe, we currently choose
797797
// the most conservative option by leaving it unchanged.
798-
799798
if !self.constraint_sccs().annotation(scc).min_universe().is_root() {
800799
return;
801800
}
@@ -823,12 +822,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
823822
}
824823
debug!(?choice_regions, "after ub");
825824

826-
// At this point we can pick any member of `choice_regions`, but to avoid potential
827-
// non-determinism we will pick the *unique minimum* choice.
825+
// At this point we can pick any member of `choice_regions` and would like to choose
826+
// it to be a small as possible. To avoid potential non-determinism we will pick the
827+
// smallest such choice.
828828
//
829829
// Because universal regions are only partially ordered (i.e, not every two regions are
830830
// comparable), we will ignore any region that doesn't compare to all others when picking
831831
// the minimum choice.
832+
//
832833
// For example, consider `choice_regions = ['static, 'a, 'b, 'c, 'd, 'e]`, where
833834
// `'static: 'a, 'static: 'b, 'a: 'c, 'b: 'c, 'c: 'd, 'c: 'e`.
834835
// `['d, 'e]` are ignored because they do not compare - the same goes for `['a, 'b]`.
@@ -853,6 +854,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
853854
return;
854855
};
855856

857+
// As we require `'scc: 'min_choice`, we have definitely already computed
858+
// its `scc_values` at this point.
856859
let min_choice_scc = self.constraint_sccs.scc(min_choice);
857860
debug!(?min_choice, ?min_choice_scc);
858861
if self.scc_values.add_region(scc, min_choice_scc) {

0 commit comments

Comments
 (0)