]> git.lizzy.rs Git - rust.git/blob - src/test/ui/resolve/issue-14254.rs
Auto merge of #48709 - tinaun:issue48703, r=nikomatsakis
[rust.git] / src / test / ui / resolve / 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 : isize,
19     y : f64,
20 }
21
22 impl BarTy {
23     fn a() {}
24     fn b(&self) {}
25 }
26
27 impl Foo for *const BarTy {
28     fn bar(&self) {
29         baz();
30         //~^ ERROR cannot find function `baz`
31         a;
32         //~^ ERROR cannot find value `a`
33     }
34 }
35
36 impl<'a> Foo for &'a BarTy {
37     fn bar(&self) {
38         baz();
39         //~^ ERROR cannot find function `baz`
40         x;
41         //~^ ERROR cannot find value `x`
42         y;
43         //~^ ERROR cannot find value `y`
44         a;
45         //~^ ERROR cannot find value `a`
46         bah;
47         //~^ ERROR cannot find value `bah`
48         b;
49         //~^ ERROR cannot find value `b`
50     }
51 }
52
53 impl<'a> Foo for &'a mut BarTy {
54     fn bar(&self) {
55         baz();
56         //~^ ERROR cannot find function `baz`
57         x;
58         //~^ ERROR cannot find value `x`
59         y;
60         //~^ ERROR cannot find value `y`
61         a;
62         //~^ ERROR cannot find value `a`
63         bah;
64         //~^ ERROR cannot find value `bah`
65         b;
66         //~^ ERROR cannot find value `b`
67     }
68 }
69
70 impl Foo for Box<BarTy> {
71     fn bar(&self) {
72         baz();
73         //~^ ERROR cannot find function `baz`
74         bah;
75         //~^ ERROR cannot find value `bah`
76     }
77 }
78
79 impl Foo for *const isize {
80     fn bar(&self) {
81         baz();
82         //~^ ERROR cannot find function `baz`
83         bah;
84         //~^ ERROR cannot find value `bah`
85     }
86 }
87
88 impl<'a> Foo for &'a isize {
89     fn bar(&self) {
90         baz();
91         //~^ ERROR cannot find function `baz`
92         bah;
93         //~^ ERROR cannot find value `bah`
94     }
95 }
96
97 impl<'a> Foo for &'a mut isize {
98     fn bar(&self) {
99         baz();
100         //~^ ERROR cannot find function `baz`
101         bah;
102         //~^ ERROR cannot find value `bah`
103     }
104 }
105
106 impl Foo for Box<isize> {
107     fn bar(&self) {
108         baz();
109         //~^ ERROR cannot find function `baz`
110         bah;
111         //~^ ERROR cannot find value `bah`
112     }
113 }
114
115 fn main() {}