Open
Description
This seems quite obvious, but fails;
#[test]
fn recursive_assoc_with_gat() {
test! {
program {
#[non_enumerable]
trait Foo {
type Assoc;
type Gat<T>: Foo<Assoc = T>;
}
}
goal {
forall<T> {
if (
T: Foo
) {
exists<U> {
<T as Foo>::Assoc = U
}
}
}
} yields {
expect![[r#"Unique; substitution [?0 := (Foo::Assoc)<!1_0>]"#]]
}
}
}
expected:
Ambiguous; no inference guidance
actual:
Unique; substitution [?0 := (Foo::Assoc)<!1_0>]
thread 'test::projection::foobar' panicked at tests/test_util.rs:52:9:
assertion failed: `(left == right)`
Diff < left / right > :
<Ambiguous;noinferenceguidance
>Unique;substitution[?0:=(Foo:
This causes rust-lang/rust-analyzer#17725 but next-gen trait solver compiles the code in this issue with no error.
I guess that this is because while next-gen solver has a branch that returns Err(NoSolution)
for some flounderings;
https://github.com/rust-lang/rust/blob/7e3a971870f23c94f7aceb53b490fb37333150ff/compiler/rustc_next_trait_solver/src/solve/mod.rs#L248-L262
but the chalk returns Ok(Solution::Ambig(Guidance::Unknown))
for every Flounder
;
chalk/chalk-recursive/src/solve.rs
Lines 129 to 151 in 5bcd611
like the relevant case for the above test case;
chalk/chalk-solve/src/clauses.rs
Lines 595 to 627 in 5bcd611
and this taints all the other
Unique
solutions along the wayMetadata
Metadata
Assignees
Labels
No labels