blob: 19bb2ae1497230af55976f8991c6f0f0cb9c9fa5 (
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
|
// run-pass
// compile-flags: -Z trait-solver=chalk
trait Foo { }
trait Bar {
type Item: Foo;
}
impl Foo for i32 { }
impl Bar for i32 {
type Item = i32;
}
fn only_foo<T: Foo>() { }
fn only_bar<T: Bar>() {
// `T` implements `Bar` hence `<T as Bar>::Item` must also implement `Bar`
only_foo::<T::Item>()
}
fn main() {
only_bar::<i32>();
only_foo::<<i32 as Bar>::Item>();
}
|