]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unique/unique-kinds.rs
Merge commit 'e329249b6a3a98830d860c74c8234a8dd9407436' into clippyup
[rust.git] / src / test / ui / unique / unique-kinds.rs
1 // run-pass
2
3 use std::cmp::PartialEq;
4 use std::fmt::Debug;
5
6 fn sendable() {
7
8     fn f<T:Send + PartialEq + Debug>(i: T, j: T) {
9         assert_eq!(i, j);
10     }
11
12     fn g<T:Send + PartialEq>(i: T, j: T) {
13         assert!(i != j);
14     }
15
16     let i: Box<_> = Box::new(100);
17     let j: Box<_> = Box::new(100);
18     f(i, j);
19     let i: Box<_> = Box::new(100);
20     let j: Box<_> = Box::new(101);
21     g(i, j);
22 }
23
24 fn copyable() {
25
26     fn f<T:PartialEq + Debug>(i: T, j: T) {
27         assert_eq!(i, j);
28     }
29
30     fn g<T:PartialEq>(i: T, j: T) {
31         assert!(i != j);
32     }
33
34     let i: Box<_> = Box::new(100);
35     let j: Box<_> = Box::new(100);
36     f(i, j);
37     let i: Box<_> = Box::new(100);
38     let j: Box<_> = Box::new(101);
39     g(i, j);
40 }
41
42 fn noncopyable() {
43
44     fn f<T:PartialEq + Debug>(i: T, j: T) {
45         assert_eq!(i, j);
46     }
47
48     fn g<T:PartialEq>(i: T, j: T) {
49         assert!(i != j);
50     }
51
52     let i: Box<_> = Box::new(100);
53     let j: Box<_> = Box::new(100);
54     f(i, j);
55     let i: Box<_> = Box::new(100);
56     let j: Box<_> = Box::new(101);
57     g(i, j);
58 }
59
60 pub fn main() {
61     sendable();
62     copyable();
63     noncopyable();
64 }