]> git.lizzy.rs Git - rust.git/blob - tests/ui/chalkify/projection.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / ui / chalkify / projection.rs
1 // run-pass
2 // compile-flags: -Z trait-solver=chalk
3
4 trait Foo { }
5
6 trait Bar {
7     type Item: Foo;
8 }
9
10 impl Foo for i32 { }
11 impl Bar for i32 {
12     type Item = i32;
13 }
14
15 fn only_foo<T: Foo>() { }
16
17 fn only_bar<T: Bar>() {
18     // `T` implements `Bar` hence `<T as Bar>::Item` must also implement `Bar`
19     only_foo::<T::Item>()
20 }
21
22 fn main() {
23     only_bar::<i32>();
24     only_foo::<<i32 as Bar>::Item>();
25 }