Open
Description
Found in rust-analyzer#12897, the following test causes the recursive solver to loop:
#[test]
fn cyclic_traits() {
test! {
program {
trait Clone { }
trait A {
type X: B;
}
trait B {
type Y: A<X = Self>;
}
}
goal {
exists<T> {
if (<T as B>::Y: A) {
if (<<T as B>::Y as A>::X: Clone) {
T: A
}
}
}
} yields {
expect![["Ambiguous; no inference guidance"]]
}
}
}
Output:
comparing solvers:
expected: SLG { max_size: 10, expected_answers: None }
actual: Recursive { overflow_depth: 100, caching_enabled: true, max_size: 30 }
expected:
Ambiguous; no inference guidance
actual:
Ambiguous; definite substitution for<?U0> { [?0 := (B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<(B::Y)<(A::X)<^0.0>>>>>>>>>>>>>>>>>>>>>>>>>>>>] }
thread 'test::cycle::cyclic_traits' panicked at 'assertion failed: `(left == right)`
Metadata
Metadata
Assignees
Labels
No labels