@@ -194,8 +194,41 @@ note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
194194LL | trait PrivTr {}
195195 | ^^^^^^^^^^^^
196196
197+ error: trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
198+ --> $DIR/private-in-public-warn.rs:51:19
199+ |
200+ LL | fn g() -> impl PrivTr;
201+ | ^^^^^^^^^^^ opaque type `traits::Tr3::g::{anon_assoc#0}` is reachable at visibility `pub(crate)`
202+ |
203+ note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
204+ --> $DIR/private-in-public-warn.rs:37:5
205+ |
206+ LL | trait PrivTr {}
207+ | ^^^^^^^^^^^^
208+
209+ error[E0446]: private trait `traits::PrivTr` in public interface
210+ --> $DIR/private-in-public-warn.rs:53:19
211+ |
212+ LL | trait PrivTr {}
213+ | ------------ `traits::PrivTr` declared as private
214+ ...
215+ LL | fn h() -> impl PrivTr {}
216+ | ^^^^^^^^^^^ can't leak private trait
217+
218+ error: trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
219+ --> $DIR/private-in-public-warn.rs:53:19
220+ |
221+ LL | fn h() -> impl PrivTr {}
222+ | ^^^^^^^^^^^ opaque type `traits::Tr3::h::{anon_assoc#0}` is reachable at visibility `pub(crate)`
223+ |
224+ note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
225+ --> $DIR/private-in-public-warn.rs:37:5
226+ |
227+ LL | trait PrivTr {}
228+ | ^^^^^^^^^^^^
229+
197230error: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
198- --> $DIR/private-in-public-warn.rs:54 :5
231+ --> $DIR/private-in-public-warn.rs:57 :5
199232 |
200233LL | impl<T: PrivTr> Pub<T> {}
201234 | ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
@@ -207,103 +240,169 @@ LL | trait PrivTr {}
207240 | ^^^^^^^^^^^^
208241
209242error: trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
210- --> $DIR/private-in-public-warn.rs:63 :5
243+ --> $DIR/private-in-public-warn.rs:66 :5
211244 |
212245LL | pub type Alias<T> where T: PrivTr = T;
213246 | ^^^^^^^^^^^^^^^^^ type alias `traits_where::Alias` is reachable at visibility `pub(crate)`
214247 |
215248note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
216- --> $DIR/private-in-public-warn.rs:59 :5
249+ --> $DIR/private-in-public-warn.rs:62 :5
217250 |
218251LL | trait PrivTr {}
219252 | ^^^^^^^^^^^^
220253
221254error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
222- --> $DIR/private-in-public-warn.rs:66 :5
255+ --> $DIR/private-in-public-warn.rs:69 :5
223256 |
224257LL | pub trait Tr2<T> where T: PrivTr {}
225258 | ^^^^^^^^^^^^^^^^ trait `traits_where::Tr2` is reachable at visibility `pub(crate)`
226259 |
227260note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
228- --> $DIR/private-in-public-warn.rs:59 :5
261+ --> $DIR/private-in-public-warn.rs:62 :5
229262 |
230263LL | trait PrivTr {}
231264 | ^^^^^^^^^^^^
232265
233266error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
234- --> $DIR/private-in-public-warn.rs:69 :9
267+ --> $DIR/private-in-public-warn.rs:72 :9
235268 |
236269LL | fn f<T>(arg: T) where T: PrivTr {}
237270 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Tr3::f` is reachable at visibility `pub(crate)`
238271 |
239272note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
240- --> $DIR/private-in-public-warn.rs:59 :5
273+ --> $DIR/private-in-public-warn.rs:62 :5
241274 |
242275LL | trait PrivTr {}
243276 | ^^^^^^^^^^^^
244277
245278error: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
246- --> $DIR/private-in-public-warn.rs:72 :5
279+ --> $DIR/private-in-public-warn.rs:75 :5
247280 |
248281LL | impl<T> Pub<T> where T: PrivTr {}
249282 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
250283 |
251284note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
252- --> $DIR/private-in-public-warn.rs:59 :5
285+ --> $DIR/private-in-public-warn.rs:62 :5
253286 |
254287LL | trait PrivTr {}
255288 | ^^^^^^^^^^^^
256289
257290error: trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
258- --> $DIR/private-in-public-warn.rs:84 :5
291+ --> $DIR/private-in-public-warn.rs:87 :5
259292 |
260293LL | pub trait Tr1: PrivTr<Pub> {}
261294 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr1` is reachable at visibility `pub(crate)`
262295 |
263296note: but trait `generics::PrivTr<generics::Pub>` is only usable at visibility `pub(self)`
264- --> $DIR/private-in-public-warn.rs:80 :5
297+ --> $DIR/private-in-public-warn.rs:83 :5
265298 |
266299LL | trait PrivTr<T> {}
267300 | ^^^^^^^^^^^^^^^
268301
269302error: type `generics::Priv` is more private than the item `generics::Tr2`
270- --> $DIR/private-in-public-warn.rs:86 :5
303+ --> $DIR/private-in-public-warn.rs:89 :5
271304 |
272305LL | pub trait Tr2: PubTr<Priv> {}
273306 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr2` is reachable at visibility `pub(crate)`
274307 |
275308note: but type `generics::Priv` is only usable at visibility `pub(self)`
276- --> $DIR/private-in-public-warn.rs:78 :5
309+ --> $DIR/private-in-public-warn.rs:81 :5
277310 |
278311LL | struct Priv<T = u8>(T);
279312 | ^^^^^^^^^^^^^^^^^^^
280313
281314error: type `generics::Priv` is more private than the item `generics::Tr3`
282- --> $DIR/private-in-public-warn.rs:87 :5
315+ --> $DIR/private-in-public-warn.rs:90 :5
283316 |
284317LL | pub trait Tr3: PubTr<[Priv; 1]> {}
285318 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr3` is reachable at visibility `pub(crate)`
286319 |
287320note: but type `generics::Priv` is only usable at visibility `pub(self)`
288- --> $DIR/private-in-public-warn.rs:78 :5
321+ --> $DIR/private-in-public-warn.rs:81 :5
289322 |
290323LL | struct Priv<T = u8>(T);
291324 | ^^^^^^^^^^^^^^^^^^^
292325
293326error: type `generics::Priv` is more private than the item `Tr4`
294- --> $DIR/private-in-public-warn.rs:88 :5
327+ --> $DIR/private-in-public-warn.rs:91 :5
295328 |
296329LL | pub trait Tr4: PubTr<Pub<Priv>> {}
297330 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `Tr4` is reachable at visibility `pub(crate)`
298331 |
299332note: but type `generics::Priv` is only usable at visibility `pub(self)`
300- --> $DIR/private-in-public-warn.rs:78:5
333+ --> $DIR/private-in-public-warn.rs:81:5
334+ |
335+ LL | struct Priv<T = u8>(T);
336+ | ^^^^^^^^^^^^^^^^^^^
337+
338+ error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
339+ --> $DIR/private-in-public-warn.rs:94:26
340+ |
341+ LL | fn required() -> impl PrivTr<Priv<()>>;
342+ | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)`
343+ |
344+ note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)`
345+ --> $DIR/private-in-public-warn.rs:83:5
346+ |
347+ LL | trait PrivTr<T> {}
348+ | ^^^^^^^^^^^^^^^
349+
350+ error: type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
351+ --> $DIR/private-in-public-warn.rs:94:26
352+ |
353+ LL | fn required() -> impl PrivTr<Priv<()>>;
354+ | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)`
355+ |
356+ note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
357+ --> $DIR/private-in-public-warn.rs:81:5
358+ |
359+ LL | struct Priv<T = u8>(T);
360+ | ^^^^^^^^^^^^^^^^^^^
361+
362+ error[E0446]: private trait `generics::PrivTr<generics::Priv<()>>` in public interface
363+ --> $DIR/private-in-public-warn.rs:97:26
364+ |
365+ LL | trait PrivTr<T> {}
366+ | --------------- `generics::PrivTr<generics::Priv<()>>` declared as private
367+ ...
368+ LL | fn provided() -> impl PrivTr<Priv<()>> {}
369+ | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
370+
371+ error[E0446]: private type `generics::Priv<()>` in public interface
372+ --> $DIR/private-in-public-warn.rs:97:26
373+ |
374+ LL | struct Priv<T = u8>(T);
375+ | ------------------- `generics::Priv<()>` declared as private
376+ ...
377+ LL | fn provided() -> impl PrivTr<Priv<()>> {}
378+ | ^^^^^^^^^^^^^^^^^^^^^ can't leak private type
379+
380+ error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
381+ --> $DIR/private-in-public-warn.rs:97:26
382+ |
383+ LL | fn provided() -> impl PrivTr<Priv<()>> {}
384+ | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
385+ |
386+ note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)`
387+ --> $DIR/private-in-public-warn.rs:83:5
388+ |
389+ LL | trait PrivTr<T> {}
390+ | ^^^^^^^^^^^^^^^
391+
392+ error: type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
393+ --> $DIR/private-in-public-warn.rs:97:26
394+ |
395+ LL | fn provided() -> impl PrivTr<Priv<()>> {}
396+ | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
397+ |
398+ note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
399+ --> $DIR/private-in-public-warn.rs:81:5
301400 |
302401LL | struct Priv<T = u8>(T);
303402 | ^^^^^^^^^^^^^^^^^^^
304403
305404error[E0446]: private type `impls::Priv` in public interface
306- --> $DIR/private-in-public-warn.rs:119 :9
405+ --> $DIR/private-in-public-warn.rs:128 :9
307406 |
308407LL | struct Priv;
309408 | ----------- `impls::Priv` declared as private
@@ -312,19 +411,19 @@ LL | type Alias = Priv;
312411 | ^^^^^^^^^^ can't leak private type
313412
314413error: type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
315- --> $DIR/private-in-public-warn.rs:190 :9
414+ --> $DIR/private-in-public-warn.rs:199 :9
316415 |
317416LL | pub fn f(arg: Priv) {}
318417 | ^^^^^^^^^^^^^^^^^^^ associated function `aliases_pub::<impl Pub2>::f` is reachable at visibility `pub(crate)`
319418 |
320419note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
321- --> $DIR/private-in-public-warn.rs:163 :5
420+ --> $DIR/private-in-public-warn.rs:172 :5
322421 |
323422LL | struct Priv;
324423 | ^^^^^^^^^^^
325424
326425error[E0446]: private type `aliases_pub::Priv` in public interface
327- --> $DIR/private-in-public-warn.rs:193 :9
426+ --> $DIR/private-in-public-warn.rs:202 :9
328427 |
329428LL | struct Priv;
330429 | ----------- `aliases_pub::Priv` declared as private
@@ -333,7 +432,7 @@ LL | type Check = Priv;
333432 | ^^^^^^^^^^ can't leak private type
334433
335434error[E0446]: private type `aliases_pub::Priv` in public interface
336- --> $DIR/private-in-public-warn.rs:196 :9
435+ --> $DIR/private-in-public-warn.rs:205 :9
337436 |
338437LL | struct Priv;
339438 | ----------- `aliases_pub::Priv` declared as private
@@ -342,7 +441,7 @@ LL | type Check = Priv;
342441 | ^^^^^^^^^^ can't leak private type
343442
344443error[E0446]: private type `aliases_pub::Priv` in public interface
345- --> $DIR/private-in-public-warn.rs:199 :9
444+ --> $DIR/private-in-public-warn.rs:208 :9
346445 |
347446LL | struct Priv;
348447 | ----------- `aliases_pub::Priv` declared as private
@@ -351,7 +450,7 @@ LL | type Check = Priv;
351450 | ^^^^^^^^^^ can't leak private type
352451
353452error[E0446]: private type `aliases_pub::Priv` in public interface
354- --> $DIR/private-in-public-warn.rs:202 :9
453+ --> $DIR/private-in-public-warn.rs:211 :9
355454 |
356455LL | struct Priv;
357456 | ----------- `aliases_pub::Priv` declared as private
@@ -360,37 +459,37 @@ LL | type Check = Priv;
360459 | ^^^^^^^^^^ can't leak private type
361460
362461error: trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
363- --> $DIR/private-in-public-warn.rs:232 :5
462+ --> $DIR/private-in-public-warn.rs:241 :5
364463 |
365464LL | pub trait Tr1: PrivUseAliasTr {}
366465 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr1` is reachable at visibility `pub(crate)`
367466 |
368467note: but trait `PrivTr1` is only usable at visibility `pub(self)`
369- --> $DIR/private-in-public-warn.rs:218 :5
468+ --> $DIR/private-in-public-warn.rs:227 :5
370469 |
371470LL | trait PrivTr1<T = u8> {
372471 | ^^^^^^^^^^^^^^^^^^^^^
373472
374473error: trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
375- --> $DIR/private-in-public-warn.rs:234 :5
474+ --> $DIR/private-in-public-warn.rs:243 :5
376475 |
377476LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
378477 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
379478 |
380479note: but trait `PrivTr1<Priv2>` is only usable at visibility `pub(self)`
381- --> $DIR/private-in-public-warn.rs:218 :5
480+ --> $DIR/private-in-public-warn.rs:227 :5
382481 |
383482LL | trait PrivTr1<T = u8> {
384483 | ^^^^^^^^^^^^^^^^^^^^^
385484
386485error: type `Priv2` is more private than the item `aliases_priv::Tr2`
387- --> $DIR/private-in-public-warn.rs:234 :5
486+ --> $DIR/private-in-public-warn.rs:243 :5
388487 |
389488LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
390489 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
391490 |
392491note: but type `Priv2` is only usable at visibility `pub(self)`
393- --> $DIR/private-in-public-warn.rs:216 :5
492+ --> $DIR/private-in-public-warn.rs:225 :5
394493 |
395494LL | struct Priv2;
396495 | ^^^^^^^^^^^^
@@ -410,7 +509,7 @@ LL | pub type Alias<T: PrivTr> = T;
410509 = note: `#[warn(type_alias_bounds)]` on by default
411510
412511warning: where clauses on type aliases are not enforced
413- --> $DIR/private-in-public-warn.rs:63 :29
512+ --> $DIR/private-in-public-warn.rs:66 :29
414513 |
415514LL | pub type Alias<T> where T: PrivTr = T;
416515 | ------^^^^^^^^^
@@ -422,6 +521,6 @@ LL | pub type Alias<T> where T: PrivTr = T;
422521 see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
423522 = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics
424523
425- error: aborting due to 34 previous errors; 2 warnings emitted
524+ error: aborting due to 43 previous errors; 2 warnings emitted
426525
427526For more information about this error, try `rustc --explain E0446`.
0 commit comments