提交 104aaa44 编写于 作者: A Alex Crichton

rustc: Relax restriction on privacy for fields

This is a necessary change in preparation for switching the defaults as part
of #8122.

RFC: 0004-private-fields
上级 1f5571ab
......@@ -1001,10 +1001,6 @@ fn check_sane_privacy(&self, item: &ast::Item) {
};
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");
......
......@@ -25,7 +25,7 @@ struct A {
pub struct B {
a: int,
priv b: int,
pub c: int, //~ ERROR: unnecessary `pub` visibility
pub c: int,
}
}
......
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[feature(struct_variant)];
pub enum Foo {
Bar {
pub x: int, //~ ERROR unnecessary `pub` visibility
y: int,
priv z: int
}
}
fn main() {}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册