Skip to content

Commit 104aaa4

Browse files
committed
rustc: Relax restriction on privacy for fields
This is a necessary change in preparation for switching the defaults as part of rust-lang#8122. RFC: 0004-private-fields
1 parent 1f5571a commit 104aaa4

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed

src/librustc/middle/privacy.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1001,10 +1001,6 @@ impl<'a> SanePrivacyVisitor<'a> {
10011001
};
10021002
for f in def.fields.iter() {
10031003
match f.node.kind {
1004-
ast::NamedField(_, ast::Public) if public_def => {
1005-
tcx.sess.span_err(f.span, "unnecessary `pub` \
1006-
visibility");
1007-
}
10081004
ast::NamedField(_, ast::Private) if !public_def => {
10091005
tcx.sess.span_err(f.span, "unnecessary `priv` \
10101006
visibility");

src/test/compile-fail/struct-field-privacy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mod inner {
2525
pub struct B {
2626
a: int,
2727
priv b: int,
28-
pub c: int, //~ ERROR: unnecessary `pub` visibility
28+
pub c: int,
2929
}
3030
}
3131

src/test/compile-fail/struct-variant-privacy.rs

-20
This file was deleted.

0 commit comments

Comments
 (0)