]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/issue-14254.rs
Imported Upstream version 1.0.0~beta
[rustc.git] / src / test / compile-fail / issue-14254.rs
CommitLineData
1a4d82fc
JJ
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
11trait Foo {
12 fn bar(&self);
13 fn baz(&self) { }
14 fn bah(_: Option<Self>) { }
15}
16
17struct BarTy {
18 x : isize,
19 y : f64,
20}
21
22impl BarTy {
23 fn a() {}
24 fn b(&self) {}
25}
26
27impl Foo for *const BarTy {
28 fn bar(&self) {
29 baz();
30 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
31 a;
c34b1796 32 //~^ ERROR: unresolved name `a`
1a4d82fc
JJ
33 }
34}
35
36impl<'a> Foo for &'a BarTy {
37 fn bar(&self) {
38 baz();
39 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
40 x;
41 //~^ ERROR: unresolved name `x`. Did you mean `self.x`?
42 y;
43 //~^ ERROR: unresolved name `y`. Did you mean `self.y`?
44 a;
c34b1796 45 //~^ ERROR: unresolved name `a`
1a4d82fc
JJ
46 bah;
47 //~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
48 b;
c34b1796 49 //~^ ERROR: unresolved name `b`
1a4d82fc
JJ
50 }
51}
52
53impl<'a> Foo for &'a mut BarTy {
54 fn bar(&self) {
55 baz();
56 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
57 x;
58 //~^ ERROR: unresolved name `x`. Did you mean `self.x`?
59 y;
60 //~^ ERROR: unresolved name `y`. Did you mean `self.y`?
61 a;
c34b1796 62 //~^ ERROR: unresolved name `a`
1a4d82fc
JJ
63 bah;
64 //~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
65 b;
c34b1796 66 //~^ ERROR: unresolved name `b`
1a4d82fc
JJ
67 }
68}
69
70impl Foo for Box<BarTy> {
71 fn bar(&self) {
72 baz();
73 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
74 bah;
75 //~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
76 }
77}
78
79impl Foo for *const isize {
80 fn bar(&self) {
81 baz();
82 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
83 bah;
84 //~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
85 }
86}
87
88impl<'a> Foo for &'a isize {
89 fn bar(&self) {
90 baz();
91 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
92 bah;
93 //~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
94 }
95}
96
97impl<'a> Foo for &'a mut isize {
98 fn bar(&self) {
99 baz();
100 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
101 bah;
102 //~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
103 }
104}
105
106impl Foo for Box<isize> {
107 fn bar(&self) {
108 baz();
109 //~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
110 bah;
111 //~^ ERROR: unresolved name `bah`. Did you mean to call `Foo::bah`?
112 }
113}