about summary refs log tree commit diff
path: root/tests/ui/traits/item-privacy.stderr
blob: 58c558d66852f20f419c09d3dc5caf5ac8d7cc34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
error[E0599]: no method named `a` found for struct `S` in the current scope
  --> $DIR/item-privacy.rs:67:7
   |
LL | struct S;
   | -------- method `a` not found for this struct
...
LL |     S.a();
   |       ^
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = help: trait `method::A` which provides `a` is implemented but not reachable
help: there is a method `b` with a similar name
   |
LL |     S.b();
   |       ~

error[E0599]: no method named `b` found for struct `S` in the current scope
  --> $DIR/item-privacy.rs:68:7
   |
LL | struct S;
   | -------- method `b` not found for this struct
...
LL |         fn b(&self) { }
   |            - the method is available for `S` here
...
LL |     S.b();
   |       ^
   |
   = help: items from traits can only be used if the trait is in scope
help: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it
   |
LL + use method::B;
   |
help: there is a method `c` with a similar name
   |
LL |     S.c();
   |       ~

error[E0624]: method `a` is private
  --> $DIR/item-privacy.rs:72:7
   |
LL |         fn a(&self) { }
   |         ----------- private method defined here
...
LL |     c.a();
   |       ^ private method

error[E0599]: no function or associated item named `a` found for struct `S` in the current scope
  --> $DIR/item-privacy.rs:78:8
   |
LL | struct S;
   | -------- function or associated item `a` not found for this struct
...
LL |     S::a(&S);
   |        ^ function or associated item not found in `S`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = help: trait `method::A` which provides `a` is implemented but not reachable
help: there is an associated constant `B` with a similar name
  --> $DIR/item-privacy.rs:29:9
   |
LL |         const B: u8 = 0;
   |         ^^^^^^^^^^^

error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
  --> $DIR/item-privacy.rs:80:8
   |
LL | struct S;
   | -------- function or associated item `b` not found for this struct
...
LL |     S::b(&S);
   |        ^ function or associated item not found in `S`
   |
   = help: items from traits can only be used if the trait is in scope
help: there is an associated constant `B` with a similar name
  --> $DIR/item-privacy.rs:29:9
   |
LL |         const B: u8 = 0;
   |         ^^^^^^^^^^^
help: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it
   |
LL + use method::B;
   |

error[E0624]: method `a` is private
  --> $DIR/item-privacy.rs:84:14
   |
LL |         fn a(&self) { }
   |         ----------- private method defined here
...
LL |     <dyn C>::a(&S);
   |              ^ private method

error[E0599]: no associated item named `A` found for struct `S` in the current scope
  --> $DIR/item-privacy.rs:97:8
   |
LL | struct S;
   | -------- associated item `A` not found for this struct
...
LL |     S::A;
   |        ^ associated item not found in `S`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = help: trait `assoc_const::A` which provides `A` is implemented but not reachable
help: there is an associated constant `B` with a similar name
   |
LL |     S::B;
   |        ~

error[E0599]: no associated item named `B` found for struct `S` in the current scope
  --> $DIR/item-privacy.rs:98:8
   |
LL | struct S;
   | -------- associated item `B` not found for this struct
...
LL |     S::B;
   |        ^ associated item not found in `S`
   |
   = help: items from traits can only be used if the trait is in scope
help: there is a method `b` with a similar name
  --> $DIR/item-privacy.rs:11:9
   |
LL |         fn b(&self) { }
   |         ^^^^^^^^^^^
help: trait `B` which provides `B` is implemented but not in scope; perhaps you want to import it
   |
LL + use assoc_const::B;
   |

error[E0624]: associated constant `A` is private
  --> $DIR/item-privacy.rs:101:14
   |
LL |         const A: u8 = 0;
   |         ----------- private associated constant defined here
...
LL |     <dyn C>::A;
   |              ^ private associated constant

error[E0038]: the trait `assoc_const::C` is not dyn compatible
  --> $DIR/item-privacy.rs:101:6
   |
LL |     <dyn C>::A;
   |      ^^^^^ `assoc_const::C` is not dyn compatible
   |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
  --> $DIR/item-privacy.rs:25:15
   |
LL |         const A: u8 = 0;
   |               ^ ...because it contains this associated `const`
...
LL |         const B: u8 = 0;
   |               ^ ...because it contains this associated `const`
...
LL |     pub trait C: A + B {
   |               - this trait is not dyn compatible...
LL |         const C: u8 = 0;
   |               ^ ...because it contains this associated `const`
   = help: consider moving `C` to another trait
   = help: consider moving `A` to another trait
   = help: consider moving `B` to another trait
   = help: only type `S` implements `assoc_const::C`; consider using it directly instead.

error[E0223]: ambiguous associated type
  --> $DIR/item-privacy.rs:115:12
   |
LL |     let _: S::A;
   |            ^^^^
   |
help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path
   |
LL |     let _: <S as Example>::A;
   |            ~~~~~~~~~~~~~~~~~

error[E0223]: ambiguous associated type
  --> $DIR/item-privacy.rs:116:12
   |
LL |     let _: S::B;
   |            ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`

error[E0223]: ambiguous associated type
  --> $DIR/item-privacy.rs:117:12
   |
LL |     let _: S::C;
   |            ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`

error[E0624]: associated type `A` is private
  --> $DIR/item-privacy.rs:119:12
   |
LL |         type A = u8;
   |         ------ the associated type is defined here
...
LL |     let _: T::A;
   |            ^^^^ private associated type

error[E0624]: associated type `A` is private
  --> $DIR/item-privacy.rs:128:9
   |
LL |         type A = u8;
   |         ------ the associated type is defined here
...
LL |         A = u8,
   |         ^^^^^^ private associated type

error: aborting due to 15 previous errors

Some errors have detailed explanations: E0038, E0223, E0599, E0624.
For more information about an error, try `rustc --explain E0038`.