Skip to content

Commit cb0ce69

Browse files
committed
Revert "Remove unnecessary trait accessibility check."
This reverts commit f4f95eb.
1 parent 0cfdb33 commit cb0ce69

File tree

2 files changed

+6
-29
lines changed

2 files changed

+6
-29
lines changed

src/librustc_privacy/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,12 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
852852
ty::ImplContainer(_) => {
853853
self.check_static_method(span, method_def_id, name)
854854
}
855-
// Trait methods are always accessible if the trait is in scope.
856-
ty::TraitContainer(_) => {}
855+
// Trait methods are always all public. The only controlling factor
856+
// is whether the trait itself is accessible or not.
857+
ty::TraitContainer(trait_def_id) => {
858+
self.report_error(self.ensure_public(span, trait_def_id,
859+
None, "source trait"));
860+
}
857861
}
858862
}
859863
}

src/test/run-pass/issue-16264.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)