]> git.lizzy.rs Git - rust.git/blob - tests/ui/associated-types/issue-23208.rs
Rollup merge of #107306 - compiler-errors:correct-sugg-for-closure-arg-needs-borrow...
[rust.git] / tests / ui / associated-types / issue-23208.rs
1 // run-pass
2 trait TheTrait : TheSuperTrait<<Self as TheTrait>::Item> {
3     type Item;
4 }
5
6 trait TheSuperTrait<T> {
7     fn get(&self) -> T;
8 }
9
10 impl TheTrait for i32 {
11     type Item = u32;
12 }
13
14 impl TheSuperTrait<u32> for i32 {
15     fn get(&self) -> u32 {
16         *self as u32
17     }
18 }
19
20 fn foo<T:TheTrait<Item=u32>>(t: &T) -> u32 {
21     t.get()
22 }
23
24 fn main() {
25     foo::<i32>(&22);
26 }