File tree 5 files changed +35
-6
lines changed
compiler/rustc_hir_analysis/src/collect
5 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -653,7 +653,7 @@ pub(super) fn implied_predicates_with_filter<'tcx>(
653
653
}
654
654
}
655
655
}
656
- PredicateFilter :: SelfAndAssociatedTypeBounds => {
656
+ PredicateFilter :: All | PredicateFilter :: SelfAndAssociatedTypeBounds => {
657
657
for & ( pred, span) in implied_bounds {
658
658
debug ! ( "superbound: {:?}" , pred) ;
659
659
if let ty:: ClauseKind :: Trait ( bound) = pred. kind ( ) . skip_binder ( )
Original file line number Diff line number Diff line change 1
1
#![ feature( trait_alias) ]
2
2
3
3
trait T1 = T2 ;
4
- //~^ ERROR cycle detected when computing the super predicates of `T1`
4
+ //~^ ERROR cycle detected when computing the implied predicates of `T1`
5
5
6
6
trait T2 = T3 ;
7
7
Original file line number Diff line number Diff line change 1
- error[E0391]: cycle detected when computing the super predicates of `T1`
1
+ error[E0391]: cycle detected when computing the implied predicates of `T1`
2
2
--> $DIR/infinite-trait-alias-recursion.rs:3:12
3
3
|
4
4
LL | trait T1 = T2;
5
5
| ^^
6
6
|
7
- note: ...which requires computing the super predicates of `T2`...
7
+ note: ...which requires computing the implied predicates of `T2`...
8
8
--> $DIR/infinite-trait-alias-recursion.rs:6:12
9
9
|
10
10
LL | trait T2 = T3;
11
11
| ^^
12
- note: ...which requires computing the super predicates of `T3`...
12
+ note: ...which requires computing the implied predicates of `T3`...
13
13
--> $DIR/infinite-trait-alias-recursion.rs:8:12
14
14
|
15
15
LL | trait T3 = T1 + T3;
16
16
| ^^
17
- = note: ...which again requires computing the super predicates of `T1`, completing the cycle
17
+ = note: ...which again requires computing the implied predicates of `T1`, completing the cycle
18
18
= note: trait aliases cannot be recursive
19
19
note: cycle used when checking that `T1` is well-formed
20
20
--> $DIR/infinite-trait-alias-recursion.rs:3:1
Original file line number Diff line number Diff line change
1
+ //! This test used to get stuck in an infinite
2
+ //! recursion during normalization.
3
+ //!
4
+ //! issue: https://github.com/rust-lang/rust/issues/133901
5
+
6
+ #![ feature( trait_alias) ]
7
+ fn foo < T : Baz < i32 > > ( ) { }
8
+ trait Baz < A > = Baz < Option <A > >;
9
+ //~^ ERROR: cycle detected when computing the implied predicates of `Baz`
10
+
11
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0391]: cycle detected when computing the implied predicates of `Baz`
2
+ --> $DIR/infinite_normalization.rs:8:16
3
+ |
4
+ LL | trait Baz<A> = Baz<Option<A>>;
5
+ | ^^^^^^^^^^^^^^
6
+ |
7
+ = note: ...which immediately requires computing the implied predicates of `Baz` again
8
+ = note: trait aliases cannot be recursive
9
+ note: cycle used when computing normalized predicates of `foo`
10
+ --> $DIR/infinite_normalization.rs:7:1
11
+ |
12
+ LL | fn foo<T: Baz<i32>>() {}
13
+ | ^^^^^^^^^^^^^^^^^^^^^
14
+ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
15
+
16
+ error: aborting due to 1 previous error
17
+
18
+ For more information about this error, try `rustc --explain E0391`.
You can’t perform that action at this time.
0 commit comments