]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/unique-kinds.rs
New upstream version 1.19.0+dfsg1
[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
c34b1796 11
1a4d82fc
JJ
12#![allow(unknown_features)]
13#![feature(box_syntax)]
14
15use std::cmp::PartialEq;
62682a34 16use std::fmt::Debug;
223e47cc
LB
17
18fn sendable() {
19
62682a34
SL
20 fn f<T:Send + PartialEq + Debug>(i: T, j: T) {
21 assert_eq!(i, j);
223e47cc
LB
22 }
23
1a4d82fc 24 fn g<T:Send + PartialEq>(i: T, j: T) {
223e47cc
LB
25 assert!(i != j);
26 }
27
c34b1796
AL
28 let i: Box<_> = box 100;
29 let j: Box<_> = box 100;
223e47cc 30 f(i, j);
c34b1796
AL
31 let i: Box<_> = box 100;
32 let j: Box<_> = box 101;
223e47cc
LB
33 g(i, j);
34}
35
36fn copyable() {
37
62682a34
SL
38 fn f<T:PartialEq + Debug>(i: T, j: T) {
39 assert_eq!(i, j);
223e47cc
LB
40 }
41
1a4d82fc 42 fn g<T:PartialEq>(i: T, j: T) {
223e47cc
LB
43 assert!(i != j);
44 }
45
c34b1796
AL
46 let i: Box<_> = box 100;
47 let j: Box<_> = box 100;
223e47cc 48 f(i, j);
c34b1796
AL
49 let i: Box<_> = box 100;
50 let j: Box<_> = box 101;
223e47cc
LB
51 g(i, j);
52}
53
54fn noncopyable() {
55
62682a34
SL
56 fn f<T:PartialEq + Debug>(i: T, j: T) {
57 assert_eq!(i, j);
223e47cc
LB
58 }
59
1a4d82fc 60 fn g<T:PartialEq>(i: T, j: T) {
223e47cc
LB
61 assert!(i != j);
62 }
63
c34b1796
AL
64 let i: Box<_> = box 100;
65 let j: Box<_> = box 100;
223e47cc 66 f(i, j);
c34b1796
AL
67 let i: Box<_> = box 100;
68 let j: Box<_> = box 101;
223e47cc
LB
69 g(i, j);
70}
71
72pub fn main() {
73 sendable();
74 copyable();
75 noncopyable();
76}