]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // Test unboxed closure sugar used in object types. | |
12 | ||
c34b1796 | 13 | |
1a4d82fc JJ |
14 | #![allow(dead_code)] |
15 | #![feature(unboxed_closures)] | |
16 | ||
17 | struct Foo<T,U> { | |
18 | t: T, u: U | |
19 | } | |
20 | ||
21 | trait Getter<A,R> { | |
22 | fn get(&self, arg: A) -> R; | |
23 | } | |
24 | ||
25 | struct Identity; | |
26 | impl<X> Getter<X,X> for Identity { | |
27 | fn get(&self, arg: X) -> X { | |
28 | arg | |
29 | } | |
30 | } | |
31 | ||
32 | fn main() { | |
85aaf69f | 33 | let x: &Getter<(i32,), (i32,)> = &Identity; |
1a4d82fc JJ |
34 | let (y,) = x.get((22,)); |
35 | assert_eq!(y, 22); | |
36 | } |