]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/type-param-constraints.rs
4d6efc9772ce096a49b10ce0586863fd5b29b794
[rust.git] / src / test / run-pass / type-param-constraints.rs
1 // Copyright 2012 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 // xfail-fast
12
13 fn p_foo<T>(_pinned: T) { }
14 fn s_foo<T>(_shared: T) { }
15 fn u_foo<T:Send>(_unique: T) { }
16
17 struct r {
18   i: int,
19 }
20
21 impl Drop for r {
22     fn drop(&self) {}
23 }
24
25 fn r(i:int) -> r {
26     r {
27         i: i
28     }
29 }
30
31 pub fn main() {
32     p_foo(r(10));
33     p_foo(@r(10));
34
35     p_foo(~r(10));
36     p_foo(@10);
37     p_foo(~10);
38     p_foo(10);
39
40     s_foo(@r(10));
41     s_foo(@10);
42     s_foo(~10);
43     s_foo(10);
44
45     u_foo(~10);
46     u_foo(10);
47 }