Skip to content

Commit

Permalink
rustc: Relax restriction on privacy for fields
Browse files Browse the repository at this point in the history
This is a necessary change in preparation for switching the defaults as part
of rust-lang#8122.

RFC: 0004-private-fields
  • Loading branch information
alexcrichton committed Mar 26, 2014
1 parent 1f5571a commit 104aaa4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
4 changes: 0 additions & 4 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,6 @@ impl<'a> SanePrivacyVisitor<'a> {
};
for f in def.fields.iter() {
match f.node.kind {
ast::NamedField(_, ast::Public) if public_def => {
tcx.sess.span_err(f.span, "unnecessary `pub` \
visibility");
}
ast::NamedField(_, ast::Private) if !public_def => {
tcx.sess.span_err(f.span, "unnecessary `priv` \
visibility");
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/struct-field-privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod inner {
pub struct B {
a: int,
priv b: int,
pub c: int, //~ ERROR: unnecessary `pub` visibility
pub c: int,
}
}

Expand Down
20 changes: 0 additions & 20 deletions src/test/compile-fail/struct-variant-privacy.rs

This file was deleted.

0 comments on commit 104aaa4

Please sign in to comment.