blob: 7dc87daccd98b7296d7f0aa93a62e14ee4d8a32d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// [no_self_infer] check-pass
// compile-flags: -Znext-solver
// revisions: self_infer no_self_infer
// checks that the new solver is smart enough to infer `?0 = U` when solving:
// `normalizes-to(<Vec<?0> as Trait>::Assoc, u8)`
// with `normalizes-to(<Vec<U> as Trait>::Assoc, u8)` in the paramenv even when
// there is a separate `Vec<T>: Trait` bound in the paramenv.
//
// FIXME(-Znext-solver)
// This could also compile for `normalizes-to(<?0 as Trait>::Assoc, u8)` but
// we currently immediately consider a goal ambiguous if the self type is an
// inference variable.
trait Trait {
type Assoc;
}
fn foo<T: Trait<Assoc = u8>>(x: T) {}
#[cfg(self_infer)]
fn unconstrained<T>() -> T {
todo!()
}
#[cfg(no_self_infer)]
fn unconstrained<T>() -> Vec<T> {
todo!()
}
fn bar<T, U>()
where
Vec<T>: Trait,
Vec<U>: Trait<Assoc = u8>,
{
foo(unconstrained())
//[self_infer]~^ ERROR type annotations needed
}
fn main() {}
|