privacy: Mark everything in a header of a reachable impl as reachable
This commit is contained in:
parent
67713f5b7f
commit
9503c56ff7
6 changed files with 36 additions and 9 deletions
|
|
@ -552,7 +552,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
|
|||
// Visit everything except for private impl items.
|
||||
hir::ItemKind::Impl(.., ref impl_item_refs) => {
|
||||
if item_level.is_some() {
|
||||
self.reach(item.id, item_level).generics().predicates();
|
||||
self.reach(item.id, item_level).generics().predicates().ty().trait_ref();
|
||||
|
||||
for impl_item_ref in impl_item_refs {
|
||||
let impl_item_level = self.get(impl_item_ref.id.node_id);
|
||||
|
|
@ -711,6 +711,13 @@ impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> {
|
|||
self.visit(self.ev.tcx.type_of(self.item_def_id));
|
||||
self
|
||||
}
|
||||
|
||||
fn trait_ref(&mut self) -> &mut Self {
|
||||
if let Some(trait_ref) = self.ev.tcx.impl_trait_ref(self.item_def_id) {
|
||||
self.visit_trait(trait_ref);
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> {
|
||||
|
|
|
|||
10
src/test/ui/privacy/auxiliary/issue-57264-2.rs
Normal file
10
src/test/ui/privacy/auxiliary/issue-57264-2.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
mod inner {
|
||||
pub struct PubUnnameable;
|
||||
|
||||
impl PubUnnameable {
|
||||
pub fn pub_method(self) {}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait PubTraitWithSingleImplementor {}
|
||||
impl PubTraitWithSingleImplementor for Option<inner::PubUnnameable> {}
|
||||
8
src/test/ui/privacy/issue-57264-1.rs
Normal file
8
src/test/ui/privacy/issue-57264-1.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// compile-pass
|
||||
// aux-build:issue-57264-1.rs
|
||||
|
||||
extern crate issue_57264_1;
|
||||
|
||||
fn main() {
|
||||
issue_57264_1::Pub::pub_method();
|
||||
}
|
||||
10
src/test/ui/privacy/issue-57264-2.rs
Normal file
10
src/test/ui/privacy/issue-57264-2.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// compile-pass
|
||||
// aux-build:issue-57264-2.rs
|
||||
|
||||
extern crate issue_57264_2;
|
||||
|
||||
fn infer<T: issue_57264_2::PubTraitWithSingleImplementor>(arg: T) -> T { arg }
|
||||
|
||||
fn main() {
|
||||
infer(None).unwrap().pub_method();
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// compile-pass
|
||||
// aux-build:issue-57264.rs
|
||||
|
||||
extern crate issue_57264;
|
||||
|
||||
fn main() {
|
||||
issue_57264::Pub::pub_method();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue