]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/unboxed-closures-sugar-object.rs
Imported Upstream version 1.0.0~beta.3
[rustc.git] / src / test / run-pass / unboxed-closures-sugar-object.rs
CommitLineData
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
17struct Foo<T,U> {
18 t: T, u: U
19}
20
21trait Getter<A,R> {
22 fn get(&self, arg: A) -> R;
23}
24
25struct Identity;
26impl<X> Getter<X,X> for Identity {
27 fn get(&self, arg: X) -> X {
28 arg
29 }
30}
31
32fn main() {
85aaf69f 33 let x: &Getter<(i32,), (i32,)> = &Identity;
1a4d82fc
JJ
34 let (y,) = x.get((22,));
35 assert_eq!(y, 22);
36}