2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2014-11-03 20:52:52 -06:00
|
|
|
// Test unboxed closure sugar used in object types.
|
|
|
|
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
struct Foo<T,U> {
|
|
|
|
t: T, u: U
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Getter<A,R> {
|
|
|
|
fn get(&self, arg: A) -> R;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Identity;
|
|
|
|
impl<X> Getter<X,X> for Identity {
|
|
|
|
fn get(&self, arg: X) -> X {
|
|
|
|
arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2019-05-28 13:47:21 -05:00
|
|
|
let x: &dyn Getter<(i32,), (i32,)> = &Identity;
|
2014-11-03 20:52:52 -06:00
|
|
|
let (y,) = x.get((22,));
|
|
|
|
assert_eq!(y, 22);
|
|
|
|
}
|