privacy: Fix privacy lints in RPITITs

This commit is contained in:
Vadim Petrochenkov 2026-01-15 20:53:30 +03:00
parent 80b898258d
commit 989568a79f
5 changed files with 239 additions and 113 deletions

View file

@ -1,5 +1,6 @@
// tidy-alphabetical-start
#![feature(associated_type_defaults)]
#![feature(default_field_values)]
#![feature(try_blocks)]
// tidy-alphabetical-end
@ -29,8 +30,8 @@ use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility,
use rustc_middle::query::Providers;
use rustc_middle::ty::print::PrintTraitRefExt as _;
use rustc_middle::ty::{
self, Const, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable,
TypeVisitor,
self, AssocContainer, Const, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeSuperVisitable,
TypeVisitable, TypeVisitor,
};
use rustc_middle::{bug, span_bug};
use rustc_session::lint;
@ -1353,9 +1354,9 @@ struct SearchInterfaceForPrivateItemsVisitor<'tcx> {
/// The visitor checks that each component type is at least this visible.
required_visibility: ty::Visibility,
required_effective_vis: Option<EffectiveVisibility>,
in_assoc_ty: bool,
in_primary_interface: bool,
skip_assoc_tys: bool,
hard_error: bool = false,
in_primary_interface: bool = true,
skip_assoc_tys: bool = false,
}
impl SearchInterfaceForPrivateItemsVisitor<'_> {
@ -1427,7 +1428,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
};
let vis = self.tcx.local_visibility(local_def_id);
if self.in_assoc_ty && !vis.is_at_least(self.required_visibility, self.tcx) {
if self.hard_error && !vis.is_at_least(self.required_visibility, self.tcx) {
let vis_descr = match vis {
ty::Visibility::Public => "public",
ty::Visibility::Restricted(vis_def_id) => {
@ -1544,9 +1545,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> {
item_def_id: def_id,
required_visibility,
required_effective_vis,
in_assoc_ty: false,
in_primary_interface: true,
skip_assoc_tys: false,
..
}
}
@ -1589,11 +1588,15 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> {
ty::AssocKind::Type { .. } => (item.defaultness(self.tcx).has_value(), true),
};
check.in_assoc_ty = is_assoc_ty;
check.hard_error = is_assoc_ty && !item.is_impl_trait_in_trait();
check.generics().predicates();
if check_ty {
check.ty();
}
if is_assoc_ty && item.container == AssocContainer::Trait {
check.hard_error = false;
check.bounds();
}
}
fn get(&self, def_id: LocalDefId) -> Option<EffectiveVisibility> {
@ -1625,20 +1628,7 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> {
self.check(def_id, item_visibility, effective_vis).generics().predicates();
for assoc_item in tcx.associated_items(id.owner_id).in_definition_order() {
if assoc_item.is_impl_trait_in_trait() {
continue;
}
self.check_assoc_item(assoc_item, item_visibility, effective_vis);
if assoc_item.is_type() {
self.check(
assoc_item.def_id.expect_local(),
item_visibility,
effective_vis,
)
.bounds();
}
}
}
DefKind::TraitAlias => {
@ -1712,10 +1702,6 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> {
}
for assoc_item in tcx.associated_items(id.owner_id).in_definition_order() {
if assoc_item.is_impl_trait_in_trait() {
continue;
}
let impl_item_vis = if !of_trait {
min(tcx.local_visibility(assoc_item.def_id.expect_local()), impl_vis, tcx)
} else {

View file

@ -49,7 +49,10 @@ mod traits {
fn f<T: PrivTr>(arg: T) {}
//~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
fn g() -> impl PrivTr;
//~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
fn h() -> impl PrivTr {}
//~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
//~| ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
}
impl<T: PrivTr> Pub<T> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
impl<T: PrivTr> PubTr for Pub<T> {} // OK, trait impl predicates
@ -89,7 +92,13 @@ mod generics {
pub trait Tr5 {
fn required() -> impl PrivTr<Priv<()>>;
//~^ ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
//~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
fn provided() -> impl PrivTr<Priv<()>> {}
//~^ ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
//~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
//~| ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
//~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
}
}

View file

@ -194,8 +194,44 @@ note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:51:19
|
LL | fn g() -> impl PrivTr;
| ^^^^^^^^^^^ opaque type `traits::Tr3::g::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:37:5
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:53:19
|
LL | fn h() -> impl PrivTr {}
| ^^^^^^^^^^^ opaque type `traits::Tr3::h::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:37:5
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:53:19
|
LL | fn h() -> impl PrivTr {}
| ^^^^^^^^^^^ opaque type `traits::Tr3::h::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:37:5
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
--> $DIR/private-in-public-warn.rs:54:5
--> $DIR/private-in-public-warn.rs:57:5
|
LL | impl<T: PrivTr> Pub<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^ implementation `traits::Pub<T>` is reachable at visibility `pub(crate)`
@ -207,103 +243,175 @@ LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits_where::PrivTr` is more private than the item `traits_where::Alias`
--> $DIR/private-in-public-warn.rs:63:5
--> $DIR/private-in-public-warn.rs:66:5
|
LL | pub type Alias<T> where T: PrivTr = T;
| ^^^^^^^^^^^^^^^^^ type alias `traits_where::Alias` is reachable at visibility `pub(crate)`
|
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:59:5
--> $DIR/private-in-public-warn.rs:62:5
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr2`
--> $DIR/private-in-public-warn.rs:66:5
--> $DIR/private-in-public-warn.rs:69:5
|
LL | pub trait Tr2<T> where T: PrivTr {}
| ^^^^^^^^^^^^^^^^ trait `traits_where::Tr2` is reachable at visibility `pub(crate)`
|
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:59:5
--> $DIR/private-in-public-warn.rs:62:5
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits_where::PrivTr` is more private than the item `traits_where::Tr3::f`
--> $DIR/private-in-public-warn.rs:69:9
--> $DIR/private-in-public-warn.rs:72:9
|
LL | fn f<T>(arg: T) where T: PrivTr {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated function `traits_where::Tr3::f` is reachable at visibility `pub(crate)`
|
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:59:5
--> $DIR/private-in-public-warn.rs:62:5
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `traits_where::PrivTr` is more private than the item `traits_where::Pub<T>`
--> $DIR/private-in-public-warn.rs:72:5
--> $DIR/private-in-public-warn.rs:75:5
|
LL | impl<T> Pub<T> where T: PrivTr {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
|
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:59:5
--> $DIR/private-in-public-warn.rs:62:5
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
error: trait `generics::PrivTr<generics::Pub>` is more private than the item `generics::Tr1`
--> $DIR/private-in-public-warn.rs:84:5
--> $DIR/private-in-public-warn.rs:87:5
|
LL | pub trait Tr1: PrivTr<Pub> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr1` is reachable at visibility `pub(crate)`
|
note: but trait `generics::PrivTr<generics::Pub>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:80:5
--> $DIR/private-in-public-warn.rs:83:5
|
LL | trait PrivTr<T> {}
| ^^^^^^^^^^^^^^^
error: type `generics::Priv` is more private than the item `generics::Tr2`
--> $DIR/private-in-public-warn.rs:86:5
--> $DIR/private-in-public-warn.rs:89:5
|
LL | pub trait Tr2: PubTr<Priv> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr2` is reachable at visibility `pub(crate)`
|
note: but type `generics::Priv` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:78:5
--> $DIR/private-in-public-warn.rs:81:5
|
LL | struct Priv<T = u8>(T);
| ^^^^^^^^^^^^^^^^^^^
error: type `generics::Priv` is more private than the item `generics::Tr3`
--> $DIR/private-in-public-warn.rs:87:5
--> $DIR/private-in-public-warn.rs:90:5
|
LL | pub trait Tr3: PubTr<[Priv; 1]> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `generics::Tr3` is reachable at visibility `pub(crate)`
|
note: but type `generics::Priv` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:78:5
--> $DIR/private-in-public-warn.rs:81:5
|
LL | struct Priv<T = u8>(T);
| ^^^^^^^^^^^^^^^^^^^
error: type `generics::Priv` is more private than the item `Tr4`
--> $DIR/private-in-public-warn.rs:88:5
--> $DIR/private-in-public-warn.rs:91:5
|
LL | pub trait Tr4: PubTr<Pub<Priv>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `Tr4` is reachable at visibility `pub(crate)`
|
note: but type `generics::Priv` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:78:5
--> $DIR/private-in-public-warn.rs:81:5
|
LL | struct Priv<T = u8>(T);
| ^^^^^^^^^^^^^^^^^^^
error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:94:26
|
LL | fn required() -> impl PrivTr<Priv<()>>;
| ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:83:5
|
LL | trait PrivTr<T> {}
| ^^^^^^^^^^^^^^^
error: type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:94:26
|
LL | fn required() -> impl PrivTr<Priv<()>>;
| ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:81:5
|
LL | struct Priv<T = u8>(T);
| ^^^^^^^^^^^^^^^^^^^
error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:97:26
|
LL | fn provided() -> impl PrivTr<Priv<()>> {}
| ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:83:5
|
LL | trait PrivTr<T> {}
| ^^^^^^^^^^^^^^^
error: type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:97:26
|
LL | fn provided() -> impl PrivTr<Priv<()>> {}
| ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:81:5
|
LL | struct Priv<T = u8>(T);
| ^^^^^^^^^^^^^^^^^^^
error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:97:26
|
LL | fn provided() -> impl PrivTr<Priv<()>> {}
| ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:83:5
|
LL | trait PrivTr<T> {}
| ^^^^^^^^^^^^^^^
error: type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
--> $DIR/private-in-public-warn.rs:97:26
|
LL | fn provided() -> impl PrivTr<Priv<()>> {}
| ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
|
note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:81:5
|
LL | struct Priv<T = u8>(T);
| ^^^^^^^^^^^^^^^^^^^
error[E0446]: private type `impls::Priv` in public interface
--> $DIR/private-in-public-warn.rs:119:9
--> $DIR/private-in-public-warn.rs:128:9
|
LL | struct Priv;
| ----------- `impls::Priv` declared as private
@ -312,44 +420,17 @@ LL | type Alias = Priv;
| ^^^^^^^^^^ can't leak private type
error: type `aliases_pub::Priv` is more private than the item `aliases_pub::<impl Pub2>::f`
--> $DIR/private-in-public-warn.rs:190:9
--> $DIR/private-in-public-warn.rs:199:9
|
LL | pub fn f(arg: Priv) {}
| ^^^^^^^^^^^^^^^^^^^ associated function `aliases_pub::<impl Pub2>::f` is reachable at visibility `pub(crate)`
|
note: but type `aliases_pub::Priv` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:163:5
--> $DIR/private-in-public-warn.rs:172:5
|
LL | struct Priv;
| ^^^^^^^^^^^
error[E0446]: private type `aliases_pub::Priv` in public interface
--> $DIR/private-in-public-warn.rs:193:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
...
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
--> $DIR/private-in-public-warn.rs:196:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
...
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
--> $DIR/private-in-public-warn.rs:199:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
...
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
--> $DIR/private-in-public-warn.rs:202:9
|
@ -359,38 +440,65 @@ LL | struct Priv;
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
--> $DIR/private-in-public-warn.rs:205:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
...
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
--> $DIR/private-in-public-warn.rs:208:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
...
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error[E0446]: private type `aliases_pub::Priv` in public interface
--> $DIR/private-in-public-warn.rs:211:9
|
LL | struct Priv;
| ----------- `aliases_pub::Priv` declared as private
...
LL | type Check = Priv;
| ^^^^^^^^^^ can't leak private type
error: trait `PrivTr1` is more private than the item `aliases_priv::Tr1`
--> $DIR/private-in-public-warn.rs:232:5
--> $DIR/private-in-public-warn.rs:241:5
|
LL | pub trait Tr1: PrivUseAliasTr {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr1` is reachable at visibility `pub(crate)`
|
note: but trait `PrivTr1` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:218:5
--> $DIR/private-in-public-warn.rs:227:5
|
LL | trait PrivTr1<T = u8> {
| ^^^^^^^^^^^^^^^^^^^^^
error: trait `PrivTr1<Priv2>` is more private than the item `aliases_priv::Tr2`
--> $DIR/private-in-public-warn.rs:234:5
--> $DIR/private-in-public-warn.rs:243:5
|
LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
|
note: but trait `PrivTr1<Priv2>` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:218:5
--> $DIR/private-in-public-warn.rs:227:5
|
LL | trait PrivTr1<T = u8> {
| ^^^^^^^^^^^^^^^^^^^^^
error: type `Priv2` is more private than the item `aliases_priv::Tr2`
--> $DIR/private-in-public-warn.rs:234:5
--> $DIR/private-in-public-warn.rs:243:5
|
LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait `aliases_priv::Tr2` is reachable at visibility `pub(crate)`
|
note: but type `Priv2` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:216:5
--> $DIR/private-in-public-warn.rs:225:5
|
LL | struct Priv2;
| ^^^^^^^^^^^^
@ -410,7 +518,7 @@ LL | pub type Alias<T: PrivTr> = T;
= note: `#[warn(type_alias_bounds)]` on by default
warning: where clauses on type aliases are not enforced
--> $DIR/private-in-public-warn.rs:63:29
--> $DIR/private-in-public-warn.rs:66:29
|
LL | pub type Alias<T> where T: PrivTr = T;
| ------^^^^^^^^^
@ -422,6 +530,6 @@ LL | pub type Alias<T> where T: PrivTr = T;
see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
= help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics
error: aborting due to 34 previous errors; 2 warnings emitted
error: aborting due to 43 previous errors; 2 warnings emitted
For more information about this error, try `rustc --explain E0446`.

View file

@ -74,8 +74,11 @@ pub trait MyPubTrait {
//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
fn required_impl_trait() -> impl OtherTrait;
//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
fn provided_impl_trait() -> impl OtherTrait { OtherType }
//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
//~| ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
fn required_concrete() -> OtherType;
//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface

View file

@ -11,55 +11,55 @@ LL | #![deny(exported_private_dependencies)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: macro `m` from private dependency 'priv_dep' is re-exported
--> $DIR/pub-priv1.rs:156:9
--> $DIR/pub-priv1.rs:159:9
|
LL | pub use priv_dep::m;
| ^^^^^^^^^^^
error: macro `fn_like` from private dependency 'pm' is re-exported
--> $DIR/pub-priv1.rs:158:9
--> $DIR/pub-priv1.rs:161:9
|
LL | pub use pm::fn_like;
| ^^^^^^^^^^^
error: derive macro `PmDerive` from private dependency 'pm' is re-exported
--> $DIR/pub-priv1.rs:160:9
--> $DIR/pub-priv1.rs:163:9
|
LL | pub use pm::PmDerive;
| ^^^^^^^^^^^^
error: attribute macro `pm_attr` from private dependency 'pm' is re-exported
--> $DIR/pub-priv1.rs:162:9
--> $DIR/pub-priv1.rs:165:9
|
LL | pub use pm::pm_attr;
| ^^^^^^^^^^^
error: variant `V1` from private dependency 'priv_dep' is re-exported
--> $DIR/pub-priv1.rs:165:9
--> $DIR/pub-priv1.rs:168:9
|
LL | pub use priv_dep::E::V1;
| ^^^^^^^^^^^^^^^
error: type alias `Unit` from private dependency 'priv_dep' is re-exported
--> $DIR/pub-priv1.rs:168:9
--> $DIR/pub-priv1.rs:171:9
|
LL | pub use priv_dep::Unit;
| ^^^^^^^^^^^^^^
error: type alias `PubPub` from private dependency 'priv_dep' is re-exported
--> $DIR/pub-priv1.rs:170:9
--> $DIR/pub-priv1.rs:173:9
|
LL | pub use priv_dep::PubPub;
| ^^^^^^^^^^^^^^^^
error: type alias `PubPriv` from private dependency 'priv_dep' is re-exported
--> $DIR/pub-priv1.rs:172:9
--> $DIR/pub-priv1.rs:175:9
|
LL | pub use priv_dep::PubPriv;
| ^^^^^^^^^^^^^^^^^
error: struct `Renamed` from private dependency 'priv_dep' is re-exported
--> $DIR/pub-priv1.rs:174:9
--> $DIR/pub-priv1.rs:177:9
|
LL | pub use priv_dep::OtherType as Renamed;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -124,92 +124,112 @@ error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
LL | type Foo: OtherTrait;
| ^^^^^^^^^^^^^^^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:76:33
|
LL | fn required_impl_trait() -> impl OtherTrait;
| ^^^^^^^^^^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:79:33
|
LL | fn provided_impl_trait() -> impl OtherTrait { OtherType }
| ^^^^^^^^^^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:79:33
|
LL | fn provided_impl_trait() -> impl OtherTrait { OtherType }
| ^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:80:5
--> $DIR/pub-priv1.rs:83:5
|
LL | fn required_concrete() -> OtherType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:83:5
--> $DIR/pub-priv1.rs:86:5
|
LL | fn provided_concrete() -> OtherType { OtherType }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:87:1
--> $DIR/pub-priv1.rs:90:1
|
LL | pub trait WithSuperTrait: OtherTrait {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:96:5
--> $DIR/pub-priv1.rs:99:5
|
LL | type X = OtherType;
| ^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:100:1
--> $DIR/pub-priv1.rs:103:1
|
LL | pub fn in_bounds<T: OtherTrait>(x: T) { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:103:1
--> $DIR/pub-priv1.rs:106:1
|
LL | pub fn private_return_impl_trait() -> impl OtherTrait { OtherType }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:106:1
--> $DIR/pub-priv1.rs:109:1
|
LL | pub fn private_return() -> OtherType { OtherType }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:109:1
--> $DIR/pub-priv1.rs:112:1
|
LL | pub fn private_in_generic() -> std::num::Saturating<OtherType> { unimplemented!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:112:1
--> $DIR/pub-priv1.rs:115:1
|
LL | pub static STATIC: OtherType = OtherType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:115:1
--> $DIR/pub-priv1.rs:118:1
|
LL | pub const CONST: OtherType = OtherType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:118:1
--> $DIR/pub-priv1.rs:121:1
|
LL | pub type Alias = OtherType;
| ^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:121:1
--> $DIR/pub-priv1.rs:124:1
|
LL | pub type AliasOfAlias = priv_dep::PubPub;
| ^^^^^^^^^^^^^^^^^^^^^
error: trait `OtherTrait` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:126:1
--> $DIR/pub-priv1.rs:129:1
|
LL | impl OtherTrait for PublicWithPrivateImpl {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:131:1
--> $DIR/pub-priv1.rs:134:1
|
LL | impl PubTraitOnPrivate for OtherType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:131:1
--> $DIR/pub-priv1.rs:134:1
|
LL | impl PubTraitOnPrivate for OtherType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -217,25 +237,25 @@ LL | impl PubTraitOnPrivate for OtherType {}
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:137:1
--> $DIR/pub-priv1.rs:140:1
|
LL | impl From<OtherType> for PublicWithStdImpl {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:139:5
--> $DIR/pub-priv1.rs:142:5
|
LL | fn from(val: OtherType) -> Self { Self }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:143:1
--> $DIR/pub-priv1.rs:146:1
|
LL | impl From<PublicWithStdImpl> for OtherType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:143:1
--> $DIR/pub-priv1.rs:146:1
|
LL | impl From<PublicWithStdImpl> for OtherType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -243,18 +263,18 @@ LL | impl From<PublicWithStdImpl> for OtherType {
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:146:5
--> $DIR/pub-priv1.rs:149:5
|
LL | fn from(val: PublicWithStdImpl) -> Self { Self }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: type `OtherType` from private dependency 'priv_dep' in public interface
--> $DIR/pub-priv1.rs:146:5
--> $DIR/pub-priv1.rs:149:5
|
LL | fn from(val: PublicWithStdImpl) -> Self { Self }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 41 previous errors
error: aborting due to 44 previous errors