fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
14.7 KiB425 linesraw
1error: type `types::Priv` is more private than the item `types::Alias`
2  --> $DIR/private-in-public-warn.rs:15:5
3   |
4LL |     pub type Alias = Priv;
5   |     ^^^^^^^^^^^^^^ type alias `types::Alias` is reachable at visibility `pub(crate)`
6   |
7note: but type `types::Priv` is only usable at visibility `pub(self)`
8  --> $DIR/private-in-public-warn.rs:9:5
9   |
10LL |     struct Priv;
11   |     ^^^^^^^^^^^
12note: the lint level is defined here
13  --> $DIR/private-in-public-warn.rs:5:9
14   |
15LL | #![deny(private_interfaces, private_bounds)]
16   |         ^^^^^^^^^^^^^^^^^^
17
18error: type `types::Priv` is more private than the item `E::V1::0`
19  --> $DIR/private-in-public-warn.rs:17:12
20   |
21LL |         V1(Priv),
22   |            ^^^^ field `E::V1::0` is reachable at visibility `pub(crate)`
23   |
24note: but type `types::Priv` is only usable at visibility `pub(self)`
25  --> $DIR/private-in-public-warn.rs:9:5
26   |
27LL |     struct Priv;
28   |     ^^^^^^^^^^^
29
30error: type `types::Priv` is more private than the item `E::V2::field`
31  --> $DIR/private-in-public-warn.rs:18:14
32   |
33LL |         V2 { field: Priv },
34   |              ^^^^^^^^^^^ field `E::V2::field` is reachable at visibility `pub(crate)`
35   |
36note: but type `types::Priv` is only usable at visibility `pub(self)`
37  --> $DIR/private-in-public-warn.rs:9:5
38   |
39LL |     struct Priv;
40   |     ^^^^^^^^^^^
41
42error: type `types::Priv` is more private than the item `Tr::C`
43  --> $DIR/private-in-public-warn.rs:21:9
44   |
45LL |         const C: Priv = Priv;
46   |         ^^^^^^^^^^^^^ associated constant `Tr::C` is reachable at visibility `pub(crate)`
47   |
48note: but type `types::Priv` is only usable at visibility `pub(self)`
49  --> $DIR/private-in-public-warn.rs:9:5
50   |
51LL |     struct Priv;
52   |     ^^^^^^^^^^^
53
54error[E0446]: private type `types::Priv` in public interface
55  --> $DIR/private-in-public-warn.rs:22:9
56   |
57LL |     struct Priv;
58   |     ----------- `types::Priv` declared as private
59...
60LL |         type Alias = Priv;
61   |         ^^^^^^^^^^ can't leak private type
62
63error: type `types::Priv` is more private than the item `Tr::f1`
64  --> $DIR/private-in-public-warn.rs:23:9
65   |
66LL |         fn f1(arg: Priv) {}
67   |         ^^^^^^^^^^^^^^^^ associated function `Tr::f1` is reachable at visibility `pub(crate)`
68   |
69note: but type `types::Priv` is only usable at visibility `pub(self)`
70  --> $DIR/private-in-public-warn.rs:9:5
71   |
72LL |     struct Priv;
73   |     ^^^^^^^^^^^
74
75error: type `types::Priv` is more private than the item `Tr::f2`
76  --> $DIR/private-in-public-warn.rs:24:9
77   |
78LL |         fn f2() -> Priv { panic!() }
79   |         ^^^^^^^^^^^^^^^ associated function `Tr::f2` is reachable at visibility `pub(crate)`
80   |
81note: but type `types::Priv` is only usable at visibility `pub(self)`
82  --> $DIR/private-in-public-warn.rs:9:5
83   |
84LL |     struct Priv;
85   |     ^^^^^^^^^^^
86
87error: type `types::Priv` is more private than the item `types::ES`
88  --> $DIR/private-in-public-warn.rs:27:9
89   |
90LL |         pub static ES: Priv;
91   |         ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)`
92   |
93note: but type `types::Priv` is only usable at visibility `pub(self)`
94  --> $DIR/private-in-public-warn.rs:9:5
95   |
96LL |     struct Priv;
97   |     ^^^^^^^^^^^
98
99error: type `types::Priv` is more private than the item `types::ef1`
100  --> $DIR/private-in-public-warn.rs:28:9
101   |
102LL |         pub fn ef1(arg: Priv);
103   |         ^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)`
104   |
105note: but type `types::Priv` is only usable at visibility `pub(self)`
106  --> $DIR/private-in-public-warn.rs:9:5
107   |
108LL |     struct Priv;
109   |     ^^^^^^^^^^^
110
111error: type `types::Priv` is more private than the item `types::ef2`
112  --> $DIR/private-in-public-warn.rs:29:9
113   |
114LL |         pub fn ef2() -> Priv;
115   |         ^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)`
116   |
117note: but type `types::Priv` is only usable at visibility `pub(self)`
118  --> $DIR/private-in-public-warn.rs:9:5
119   |
120LL |     struct Priv;
121   |     ^^^^^^^^^^^
122
123error[E0446]: private type `types::Priv` in public interface
124  --> $DIR/private-in-public-warn.rs:32:9
125   |
126LL |     struct Priv;
127   |     ----------- `types::Priv` declared as private
128...
129LL |         type Alias = Priv;
130   |         ^^^^^^^^^^ can't leak private type
131
132error: trait `traits::PrivTr` is more private than the item `traits::Alias`
133  --> $DIR/private-in-public-warn.rs:41:5
134   |
135LL |     pub type Alias<T: PrivTr> = T;
136   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `traits::Alias` is reachable at visibility `pub(crate)`
137   |
138note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
139  --> $DIR/private-in-public-warn.rs:37:5
140   |
141LL |     trait PrivTr {}
142   |     ^^^^^^^^^^^^
143note: the lint level is defined here
144  --> $DIR/private-in-public-warn.rs:5:29
145   |
146LL | #![deny(private_interfaces, private_bounds)]
147   |                             ^^^^^^^^^^^^^^
148
149error: trait `traits::PrivTr` is more private than the item `traits::Tr1`
150  --> $DIR/private-in-public-warn.rs:43:5
151   |
152LL |     pub trait Tr1: PrivTr {}
153   |     ^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr1` is reachable at visibility `pub(crate)`
154   |
155note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
156  --> $DIR/private-in-public-warn.rs:37:5
157   |
158LL |     trait PrivTr {}
159   |     ^^^^^^^^^^^^
160
161error: trait `traits::PrivTr` is more private than the item `traits::Tr2`
162  --> $DIR/private-in-public-warn.rs:44:5
163   |
164LL |     pub trait Tr2<T: PrivTr> {}
165   |     ^^^^^^^^^^^^^^^^^^^^^^^^ trait `traits::Tr2` is reachable at visibility `pub(crate)`
166   |
167note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
168  --> $DIR/private-in-public-warn.rs:37:5
169   |
170LL |     trait PrivTr {}
171   |     ^^^^^^^^^^^^
172
173error: trait `traits::PrivTr` is more private than the item `traits::Tr3::Alias`
174  --> $DIR/private-in-public-warn.rs:46:9
175   |
176LL |         type Alias: PrivTr;
177   |         ^^^^^^^^^^^^^^^^^^ associated type `traits::Tr3::Alias` is reachable at visibility `pub(crate)`
178   |
179note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
180  --> $DIR/private-in-public-warn.rs:37:5
181   |
182LL |     trait PrivTr {}
183   |     ^^^^^^^^^^^^
184
185error: trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
186  --> $DIR/private-in-public-warn.rs:48:9
187   |
188LL |         fn f<T: PrivTr>(arg: T) {}
189   |         ^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits::Tr3::f` is reachable at visibility `pub(crate)`
190   |
191note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
192  --> $DIR/private-in-public-warn.rs:37:5
193   |
194LL |     trait PrivTr {}
195   |     ^^^^^^^^^^^^
196
197error: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
198  --> $DIR/private-in-public-warn.rs:50:5
199   |
200LL |     impl<T: PrivTr> Pub<T> {}
201   |     ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
202   |
203note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
204  --> $DIR/private-in-public-warn.rs:37:5
205   |
206LL |     trait PrivTr {}
207   |     ^^^^^^^^^^^^
208
209error: trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
210  --> $DIR/private-in-public-warn.rs:59:5
211   |
212LL |     pub type Alias<T> where T: PrivTr = T;
213   |     ^^^^^^^^^^^^^^^^^ type alias `traits_where::Alias` is reachable at visibility `pub(crate)`
214   |
215note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
216  --> $DIR/private-in-public-warn.rs:55:5
217   |
218LL |     trait PrivTr {}
219   |     ^^^^^^^^^^^^
220
221error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
222  --> $DIR/private-in-public-warn.rs:62:5
223   |
224LL |     pub trait Tr2<T> where T: PrivTr {}
225   |     ^^^^^^^^^^^^^^^^ trait `traits_where::Tr2` is reachable at visibility `pub(crate)`
226   |
227note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
228  --> $DIR/private-in-public-warn.rs:55:5
229   |
230LL |     trait PrivTr {}
231   |     ^^^^^^^^^^^^
232
233error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
234  --> $DIR/private-in-public-warn.rs:65:9
235   |
236LL |         fn f<T>(arg: T) where T: PrivTr {}
237   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Tr3::f` is reachable at visibility `pub(crate)`
238   |
239note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
240  --> $DIR/private-in-public-warn.rs:55:5
241   |
242LL |     trait PrivTr {}
243   |     ^^^^^^^^^^^^
244
245error: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
246  --> $DIR/private-in-public-warn.rs:68:5
247   |
248LL |     impl<T> Pub<T> where T: PrivTr {}
249   |     ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
250   |
251note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
252  --> $DIR/private-in-public-warn.rs:55:5
253   |
254LL |     trait PrivTr {}
255   |     ^^^^^^^^^^^^
256
257error: trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
258  --> $DIR/private-in-public-warn.rs:79:5
259   |
260LL |     pub trait Tr1: PrivTr<Pub> {}
261   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr1` is reachable at visibility `pub(crate)`
262   |
263note: but trait `generics::PrivTr<generics::Pub>` is only usable at visibility `pub(self)`
264  --> $DIR/private-in-public-warn.rs:76:5
265   |
266LL |     trait PrivTr<T> {}
267   |     ^^^^^^^^^^^^^^^
268
269error: type `generics::Priv` is more private than the item `generics::Tr2`
270  --> $DIR/private-in-public-warn.rs:81:5
271   |
272LL |     pub trait Tr2: PubTr<Priv> {}
273   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr2` is reachable at visibility `pub(crate)`
274   |
275note: but type `generics::Priv` is only usable at visibility `pub(self)`
276  --> $DIR/private-in-public-warn.rs:74:5
277   |
278LL |     struct Priv<T = u8>(T);
279   |     ^^^^^^^^^^^^^^^^^^^
280
281error: type `generics::Priv` is more private than the item `generics::Tr3`
282  --> $DIR/private-in-public-warn.rs:82:5
283   |
284LL |     pub trait Tr3: PubTr<[Priv; 1]> {}
285   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr3` is reachable at visibility `pub(crate)`
286   |
287note: but type `generics::Priv` is only usable at visibility `pub(self)`
288  --> $DIR/private-in-public-warn.rs:74:5
289   |
290LL |     struct Priv<T = u8>(T);
291   |     ^^^^^^^^^^^^^^^^^^^
292
293error: type `generics::Priv` is more private than the item `Tr4`
294  --> $DIR/private-in-public-warn.rs:83:5
295   |
296LL |     pub trait Tr4: PubTr<Pub<Priv>> {}
297   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `Tr4` is reachable at visibility `pub(crate)`
298   |
299note: but type `generics::Priv` is only usable at visibility `pub(self)`
300  --> $DIR/private-in-public-warn.rs:74:5
301   |
302LL |     struct Priv<T = u8>(T);
303   |     ^^^^^^^^^^^^^^^^^^^
304
305error[E0446]: private type `impls::Priv` in public interface
306  --> $DIR/private-in-public-warn.rs:109:9
307   |
308LL |     struct Priv;
309   |     ----------- `impls::Priv` declared as private
310...
311LL |         type Alias = Priv;
312   |         ^^^^^^^^^^ can't leak private type
313
314error: type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
315  --> $DIR/private-in-public-warn.rs:180:9
316   |
317LL |         pub fn f(arg: Priv) {}
318   |         ^^^^^^^^^^^^^^^^^^^ associated function `aliases_pub::<impl Pub2>::f` is reachable at visibility `pub(crate)`
319   |
320note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
321  --> $DIR/private-in-public-warn.rs:153:5
322   |
323LL |     struct Priv;
324   |     ^^^^^^^^^^^
325
326error[E0446]: private type `aliases_pub::Priv` in public interface
327  --> $DIR/private-in-public-warn.rs:183:9
328   |
329LL |     struct Priv;
330   |     ----------- `aliases_pub::Priv` declared as private
331...
332LL |         type Check = Priv;
333   |         ^^^^^^^^^^ can't leak private type
334
335error[E0446]: private type `aliases_pub::Priv` in public interface
336  --> $DIR/private-in-public-warn.rs:186:9
337   |
338LL |     struct Priv;
339   |     ----------- `aliases_pub::Priv` declared as private
340...
341LL |         type Check = Priv;
342   |         ^^^^^^^^^^ can't leak private type
343
344error[E0446]: private type `aliases_pub::Priv` in public interface
345  --> $DIR/private-in-public-warn.rs:189:9
346   |
347LL |     struct Priv;
348   |     ----------- `aliases_pub::Priv` declared as private
349...
350LL |         type Check = Priv;
351   |         ^^^^^^^^^^ can't leak private type
352
353error[E0446]: private type `aliases_pub::Priv` in public interface
354  --> $DIR/private-in-public-warn.rs:192:9
355   |
356LL |     struct Priv;
357   |     ----------- `aliases_pub::Priv` declared as private
358...
359LL |         type Check = Priv;
360   |         ^^^^^^^^^^ can't leak private type
361
362error: trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
363  --> $DIR/private-in-public-warn.rs:222:5
364   |
365LL |     pub trait Tr1: PrivUseAliasTr {}
366   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr1` is reachable at visibility `pub(crate)`
367   |
368note: but trait `PrivTr1` is only usable at visibility `pub(self)`
369  --> $DIR/private-in-public-warn.rs:208:5
370   |
371LL |     trait PrivTr1<T = u8> {
372   |     ^^^^^^^^^^^^^^^^^^^^^
373
374error: trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
375  --> $DIR/private-in-public-warn.rs:224:5
376   |
377LL |     pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
378   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
379   |
380note: but trait `PrivTr1<Priv2>` is only usable at visibility `pub(self)`
381  --> $DIR/private-in-public-warn.rs:208:5
382   |
383LL |     trait PrivTr1<T = u8> {
384   |     ^^^^^^^^^^^^^^^^^^^^^
385
386error: type `Priv2` is more private than the item `aliases_priv::Tr2`
387  --> $DIR/private-in-public-warn.rs:224:5
388   |
389LL |     pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
390   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
391   |
392note: but type `Priv2` is only usable at visibility `pub(self)`
393  --> $DIR/private-in-public-warn.rs:206:5
394   |
395LL |     struct Priv2;
396   |     ^^^^^^^^^^^^
397
398warning: bounds on generic parameters are not enforced in type aliases
399  --> $DIR/private-in-public-warn.rs:41:23
400   |
401LL |     pub type Alias<T: PrivTr> = T;
402   |                       ^^^^^^
403   |
404   = note: `#[warn(type_alias_bounds)]` on by default
405help: the bound will not be checked when the type alias is used, and should be removed
406   |
407LL -     pub type Alias<T: PrivTr> = T;
408LL +     pub type Alias<T> = T;
409   |
410
411warning: where clauses are not enforced in type aliases
412  --> $DIR/private-in-public-warn.rs:59:29
413   |
414LL |     pub type Alias<T> where T: PrivTr = T;
415   |                             ^^^^^^^^^
416   |
417help: the clause will not be checked when the type alias is used, and should be removed
418   |
419LL -     pub type Alias<T> where T: PrivTr = T;
420LL +     pub type Alias<T>  = T;
421   |
422
423error: aborting due to 34 previous errors; 2 warnings emitted
424
425For more information about this error, try `rustc --explain E0446`.