]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/unique-kinds.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[rust.git] / src / test / run-pass / unique-kinds.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 // pretty-expanded FIXME #23616
12
13 #![allow(unknown_features)]
14 #![feature(box_syntax)]
15
16 use std::cmp::PartialEq;
17
18 fn sendable() {
19
20     fn f<T:Send + PartialEq>(i: T, j: T) {
21         assert!(i == j);
22     }
23
24     fn g<T:Send + PartialEq>(i: T, j: T) {
25         assert!(i != j);
26     }
27
28     let i: Box<_> = box 100;
29     let j: Box<_> = box 100;
30     f(i, j);
31     let i: Box<_> = box 100;
32     let j: Box<_> = box 101;
33     g(i, j);
34 }
35
36 fn copyable() {
37
38     fn f<T:PartialEq>(i: T, j: T) {
39         assert!(i == j);
40     }
41
42     fn g<T:PartialEq>(i: T, j: T) {
43         assert!(i != j);
44     }
45
46     let i: Box<_> = box 100;
47     let j: Box<_> = box 100;
48     f(i, j);
49     let i: Box<_> = box 100;
50     let j: Box<_> = box 101;
51     g(i, j);
52 }
53
54 fn noncopyable() {
55
56     fn f<T:PartialEq>(i: T, j: T) {
57         assert!(i == j);
58     }
59
60     fn g<T:PartialEq>(i: T, j: T) {
61         assert!(i != j);
62     }
63
64     let i: Box<_> = box 100;
65     let j: Box<_> = box 100;
66     f(i, j);
67     let i: Box<_> = box 100;
68     let j: Box<_> = box 101;
69     g(i, j);
70 }
71
72 pub fn main() {
73     sendable();
74     copyable();
75     noncopyable();
76 }