File tree Expand file tree Collapse file tree 4 files changed +72
-1
lines changed
compiler/rustc_borrowck/src
tests/ui/nll/member-constraints Expand file tree Collapse file tree 4 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,10 @@ impl RegionTracker {
103
103
self . max_nameable_universe
104
104
}
105
105
106
+ pub ( crate ) fn max_placeholder_universe_reached ( self ) -> UniverseIndex {
107
+ self . max_placeholder_universe_reached
108
+ }
109
+
106
110
fn merge_min_max_seen ( & mut self , other : & Self ) {
107
111
self . max_placeholder_universe_reached = std:: cmp:: max (
108
112
self . max_placeholder_universe_reached ,
Original file line number Diff line number Diff line change @@ -713,7 +713,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
713
713
714
714
// If the member region lives in a higher universe, we currently choose
715
715
// the most conservative option by leaving it unchanged.
716
- if !self . max_nameable_universe ( scc) . is_root ( ) {
716
+ if !self . max_placeholder_universe_reached ( scc) . is_root ( ) {
717
717
return ;
718
718
}
719
719
@@ -1376,6 +1376,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1376
1376
self . scc_annotations [ scc] . max_nameable_universe ( )
1377
1377
}
1378
1378
1379
+ pub ( crate ) fn max_placeholder_universe_reached (
1380
+ & self ,
1381
+ scc : ConstraintSccIndex ,
1382
+ ) -> UniverseIndex {
1383
+ self . scc_annotations [ scc] . max_placeholder_universe_reached ( )
1384
+ }
1385
+
1379
1386
/// Checks the final value for the free region `fr` to see if it
1380
1387
/// grew too large. In particular, examine what `end(X)` points
1381
1388
/// wound up in `fr`'s final value; for each `end(X)` where `X !=
Original file line number Diff line number Diff line change
1
+ //@ check-pass
2
+ //@ revisions: current next
3
+ //@ ignore-compare-mode-next-solver (explicit revisions)
4
+ //@[next] compile-flags: -Znext-solver
5
+
6
+ trait Proj < ' a > {
7
+ type Assoc ;
8
+ }
9
+
10
+ impl < ' a , ' b , F : FnOnce ( ) -> & ' b ( ) > Proj < ' a > for F {
11
+ type Assoc = ( ) ;
12
+ }
13
+
14
+ fn is_proj < F : for < ' a > Proj < ' a > > ( f : F ) { }
15
+
16
+ fn define < ' a > ( ) -> impl Sized + use < ' a > {
17
+ // This defines the RPIT to `&'unconstrained_b ()`, an inference
18
+ // variable which is in a higher universe as gets created inside
19
+ // of the binder of `F: for<'a> Proj<'a>`. This previously caused
20
+ // us to not apply member constraints.
21
+ //
22
+ // This was unnecessary. It is totally acceptable for member regions
23
+ // to be able to name placeholders from higher universes, as long as
24
+ // they don't actually do so.
25
+ is_proj ( define :: < ' a > ) ;
26
+ & ( )
27
+ }
28
+
29
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ //@ check-pass
2
+
3
+ // Unlike `non-root-universe-existential-1.rs` this previously
4
+ // compiled as it simnply didn't define the hidden type of
5
+ // `impl Iterator` when projecting through it. We will do so
6
+ // with the new solver. Further minimizing this is challenging.
7
+
8
+ struct Type ( Vec < Type > ) ;
9
+ enum TypeTreeValueIter < ' a , T > {
10
+ Once ( T ) ,
11
+ Ref ( & ' a ( ) ) ,
12
+ }
13
+
14
+ impl < ' a , T > Iterator for TypeTreeValueIter < ' a , T > {
15
+ type Item = T ;
16
+
17
+ fn next ( & mut self ) -> Option < Self :: Item > {
18
+ loop { }
19
+ }
20
+ }
21
+
22
+ fn item < I : Iterator < Item : Iterator > > ( x : I ) -> <I :: Item as Iterator >:: Item {
23
+ loop { }
24
+ }
25
+
26
+ fn get_type_tree_values < ' a > ( ty : & ' a Type ) -> impl Iterator < Item = & ' a Type > {
27
+ let _: & ' a Type = item ( std:: iter:: once ( ty) . map ( get_type_tree_values) ) ;
28
+ TypeTreeValueIter :: < ' a , & ' a Type > :: Once ( ty)
29
+ }
30
+
31
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments