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