Skip to content

Commit daec3fe

Browse files
committed
Always report PRIVATE_IN_PUBLIC violations as hard errors when
the feature `pub_restricted` is enabled.
1 parent 44c78ee commit daec3fe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_privacy/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,8 @@ impl<'a, 'tcx: 'a, 'v> Visitor<'v> for SearchInterfaceForPrivateItemsVisitor<'a,
10231023
self.min_visibility = vis;
10241024
}
10251025
if !vis.is_at_least(self.required_visibility, &self.tcx.map) {
1026-
if self.old_error_set.contains(&ty.id) {
1026+
if self.tcx.sess.features.borrow().pub_restricted ||
1027+
self.old_error_set.contains(&ty.id) {
10271028
span_err!(self.tcx.sess, ty.span, E0446,
10281029
"private type in public interface");
10291030
} else {
@@ -1053,7 +1054,8 @@ impl<'a, 'tcx: 'a, 'v> Visitor<'v> for SearchInterfaceForPrivateItemsVisitor<'a,
10531054
self.min_visibility = vis;
10541055
}
10551056
if !vis.is_at_least(self.required_visibility, &self.tcx.map) {
1056-
if self.old_error_set.contains(&trait_ref.ref_id) {
1057+
if self.tcx.sess.features.borrow().pub_restricted ||
1058+
self.old_error_set.contains(&trait_ref.ref_id) {
10571059
span_err!(self.tcx.sess, trait_ref.path.span, E0445,
10581060
"private trait in public interface");
10591061
} else {

0 commit comments

Comments
 (0)