This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +35
-6
lines changed
compiler/rustc_hir_analysis/src/collect Expand file tree Collapse file tree 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>(
653653 }
654654 }
655655 }
656- PredicateFilter :: SelfAndAssociatedTypeBounds => {
656+ PredicateFilter :: All | PredicateFilter :: SelfAndAssociatedTypeBounds => {
657657 for & ( pred, span) in implied_bounds {
658658 debug ! ( "superbound: {:?}" , pred) ;
659659 if let ty:: ClauseKind :: Trait ( bound) = pred. kind ( ) . skip_binder ( )
Original file line number Diff line number Diff line change 11#![ feature( trait_alias) ]
22
33trait T1 = T2 ;
4- //~^ ERROR cycle detected when computing the super predicates of `T1`
4+ //~^ ERROR cycle detected when computing the implied predicates of `T1`
55
66trait T2 = T3 ;
77
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`
22 --> $DIR/infinite-trait-alias-recursion.rs:3:12
33 |
44LL | trait T1 = T2;
55 | ^^
66 |
7- note: ...which requires computing the super predicates of `T2`...
7+ note: ...which requires computing the implied predicates of `T2`...
88 --> $DIR/infinite-trait-alias-recursion.rs:6:12
99 |
1010LL | trait T2 = T3;
1111 | ^^
12- note: ...which requires computing the super predicates of `T3`...
12+ note: ...which requires computing the implied predicates of `T3`...
1313 --> $DIR/infinite-trait-alias-recursion.rs:8:12
1414 |
1515LL | trait T3 = T1 + T3;
1616 | ^^
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
1818 = note: trait aliases cannot be recursive
1919note: cycle used when checking that `T1` is well-formed
2020 --> $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