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