]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-14254.rs
cleanup: s/impl Copy/#[derive(Copy)]/g
[rust.git] / src / test / run-pass / issue-14254.rs
1 // Copyright 2014 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 trait Foo {
12     fn bar(&self);
13     fn baz(&self) { }
14     fn bah(_: Option<Self>) { }
15 }
16
17 struct BarTy {
18     x : int,
19     y : f64,
20 }
21
22 impl BarTy {
23     fn a() {}
24     fn b(&self) {}
25 }
26
27 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
28 impl Foo for *const BarTy {
29     fn bar(&self) {
30         self.baz();
31         BarTy::a();
32         Foo::bah(None::<*const BarTy>);
33     }
34 }
35
36 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
37 impl<'a> Foo for &'a BarTy {
38     fn bar(&self) {
39         self.baz();
40         self.x;
41         self.y;
42         BarTy::a();
43         Foo::bah(None::<&BarTy>);
44         self.b();
45     }
46 }
47
48 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
49 impl<'a> Foo for &'a mut BarTy {
50     fn bar(&self) {
51         self.baz();
52         self.x;
53         self.y;
54         BarTy::a();
55         Foo::bah(None::<&mut BarTy>);
56         self.b();
57     }
58 }
59
60 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
61 impl Foo for Box<BarTy> {
62     fn bar(&self) {
63         self.baz();
64         Foo::bah(None::<Box<BarTy>>);
65     }
66 }
67
68 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
69 impl Foo for *const int {
70     fn bar(&self) {
71         self.baz();
72         Foo::bah(None::<*const int>);
73     }
74 }
75
76 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
77 impl<'a> Foo for &'a int {
78     fn bar(&self) {
79         self.baz();
80         Foo::bah(None::<&int>);
81     }
82 }
83
84 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
85 impl<'a> Foo for &'a mut int {
86     fn bar(&self) {
87         self.baz();
88         Foo::bah(None::<&mut int>);
89     }
90 }
91
92 // If these fail, it's necessary to update rustc_resolve and the cfail tests.
93 impl Foo for Box<int> {
94     fn bar(&self) {
95         self.baz();
96         Foo::bah(None::<Box<int>>);
97     }
98 }
99
100 fn main() {}