]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/unique-kinds.rs
Imported Upstream version 0.7
[rustc.git] / src / test / run-pass / unique-kinds.rs
CommitLineData
223e47cc
LB
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
970d7e83 11use std::cmp::Eq;
223e47cc
LB
12
13fn sendable() {
14
970d7e83
LB
15 fn f<T:Send + Eq>(i: T, j: T) {
16 assert_eq!(i, j);
223e47cc
LB
17 }
18
970d7e83 19 fn g<T:Send + Eq>(i: T, j: T) {
223e47cc
LB
20 assert!(i != j);
21 }
22
23 let i = ~100;
24 let j = ~100;
25 f(i, j);
26 let i = ~100;
27 let j = ~101;
28 g(i, j);
29}
30
31fn copyable() {
32
33 fn f<T:Copy + Eq>(i: T, j: T) {
970d7e83 34 assert_eq!(i, j);
223e47cc
LB
35 }
36
37 fn g<T:Copy + Eq>(i: T, j: T) {
38 assert!(i != j);
39 }
40
41 let i = ~100;
42 let j = ~100;
43 f(i, j);
44 let i = ~100;
45 let j = ~101;
46 g(i, j);
47}
48
49fn noncopyable() {
50
51 fn f<T:Eq>(i: T, j: T) {
970d7e83 52 assert_eq!(i, j);
223e47cc
LB
53 }
54
55 fn g<T:Eq>(i: T, j: T) {
56 assert!(i != j);
57 }
58
59 let i = ~100;
60 let j = ~100;
61 f(i, j);
62 let i = ~100;
63 let j = ~101;
64 g(i, j);
65}
66
67pub fn main() {
68 sendable();
69 copyable();
70 noncopyable();
71}