mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #113196 - Bryanskiy:assoc_item, r=petrochenkov
Fix associated items effective visibility calculation for type privacy lints Fixes https://github.com/rust-lang/rust/pull/113126#discussion_r1246555520.
This commit is contained in:
commit
bcd804ba52
@ -2135,16 +2135,18 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
|
|||||||
// lints shouldn't be emmited even if `from` effective visibility
|
// lints shouldn't be emmited even if `from` effective visibility
|
||||||
// is larger than `Priv` nominal visibility and if `Priv` can leak
|
// is larger than `Priv` nominal visibility and if `Priv` can leak
|
||||||
// in some scenarios due to type inference.
|
// in some scenarios due to type inference.
|
||||||
let impl_ev = Some(EffectiveVisibility::of_impl::<false>(
|
let impl_ev = EffectiveVisibility::of_impl::<false>(
|
||||||
item.owner_id.def_id,
|
item.owner_id.def_id,
|
||||||
tcx,
|
tcx,
|
||||||
self.effective_visibilities,
|
self.effective_visibilities,
|
||||||
));
|
);
|
||||||
|
|
||||||
// check that private components do not appear in the generics or predicates of inherent impls
|
// check that private components do not appear in the generics or predicates of inherent impls
|
||||||
// this check is intentionally NOT performed for impls of traits, per #90586
|
// this check is intentionally NOT performed for impls of traits, per #90586
|
||||||
if impl_.of_trait.is_none() {
|
if impl_.of_trait.is_none() {
|
||||||
self.check(item.owner_id.def_id, impl_vis, impl_ev).generics().predicates();
|
self.check(item.owner_id.def_id, impl_vis, Some(impl_ev))
|
||||||
|
.generics()
|
||||||
|
.predicates();
|
||||||
}
|
}
|
||||||
for impl_item_ref in impl_.items {
|
for impl_item_ref in impl_.items {
|
||||||
let impl_item_vis = if impl_.of_trait.is_none() {
|
let impl_item_vis = if impl_.of_trait.is_none() {
|
||||||
@ -2159,8 +2161,9 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
|
|||||||
|
|
||||||
let impl_item_ev = if impl_.of_trait.is_none() {
|
let impl_item_ev = if impl_.of_trait.is_none() {
|
||||||
self.get(impl_item_ref.id.owner_id.def_id)
|
self.get(impl_item_ref.id.owner_id.def_id)
|
||||||
|
.map(|ev| ev.min(impl_ev, self.tcx))
|
||||||
} else {
|
} else {
|
||||||
impl_ev
|
Some(impl_ev)
|
||||||
};
|
};
|
||||||
|
|
||||||
self.check_assoc_item(
|
self.check_assoc_item(
|
||||||
|
Loading…
Reference in New Issue
Block a user