]> git.lizzy.rs Git - rust.git/blob - tests/ui/unboxed-closures/unboxed-closures-sugar-object.rs
Rollup merge of #106244 - atouchet:readme3, r=workingjubilee
[rust.git] / tests / ui / unboxed-closures / unboxed-closures-sugar-object.rs
1 // run-pass
2 // Test unboxed closure sugar used in object types.
3
4 #![allow(dead_code)]
5
6 struct Foo<T,U> {
7     t: T, u: U
8 }
9
10 trait Getter<A,R> {
11     fn get(&self, arg: A) -> R;
12 }
13
14 struct Identity;
15 impl<X> Getter<X,X> for Identity {
16     fn get(&self, arg: X) -> X {
17         arg
18     }
19 }
20
21 fn main() {
22     let x: &dyn Getter<(i32,), (i32,)> = &Identity;
23     let (y,) = x.get((22,));
24     assert_eq!(y, 22);
25 }