diff options
| author | Oliver 'ker' Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-09 17:57:49 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-11 12:34:48 +0100 |
| commit | d844bfb1967b780ff6cc6e81644bf4b529dc0738 (patch) | |
| tree | c3eb4db434f5c328758aa63bac750dd7646f0d39 /src/libsyntax | |
| parent | dfe35da6b83f64bb7553b19649839512a3c301ce (diff) | |
| download | rust-d844bfb1967b780ff6cc6e81644bf4b529dc0738.tar.gz rust-d844bfb1967b780ff6cc6e81644bf4b529dc0738.zip | |
[breaking-change] don't glob export ast::Visibility variants
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/diagnostics/plugin.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 28 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/std_inject.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/test.rs | 18 |
10 files changed, 41 insertions, 42 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 796e5923578..79b465a02b8 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -17,7 +17,6 @@ pub use self::StructFieldKind::*; pub use self::TyParamBound::*; pub use self::UnsafeSource::*; pub use self::ViewPath_::*; -pub use self::Visibility::*; pub use self::PathParameters::*; use attr::ThinAttributes; @@ -1851,8 +1850,8 @@ pub enum Visibility { impl Visibility { pub fn inherit_from(&self, parent_visibility: Visibility) -> Visibility { match *self { - Inherited => parent_visibility, - Public => *self + Visibility::Inherited => parent_visibility, + Visibility::Public => *self } } } diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 2e343948c42..43b4a201afc 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -230,7 +230,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, ty, expr, ), - vis: ast::Public, + vis: ast::Visibility::Public, span: span, }) ])) diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index e32dcc99a0e..0f1f92f3fb8 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -962,7 +962,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { attrs: attrs, id: ast::DUMMY_NODE_ID, node: node, - vis: ast::Inherited, + vis: ast::Visibility::Inherited, span: span }) } @@ -1005,7 +1005,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let fields: Vec<_> = tys.into_iter().map(|ty| { Spanned { span: ty.span, node: ast::StructField_ { ty: ty, - kind: ast::UnnamedField(ast::Inherited), + kind: ast::UnnamedField(ast::Visibility::Inherited), attrs: Vec::new(), id: ast::DUMMY_NODE_ID, }} diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 8c86205fed4..d8099ff004b 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -906,7 +906,7 @@ fn expand_wrapper(cx: &ExtCtxt, let stmts = imports.iter().map(|path| { // make item: `use ...;` let path = path.iter().map(|s| s.to_string()).collect(); - cx.stmt_item(sp, cx.item_use_glob(sp, ast::Inherited, ids_ext(path))) + cx.stmt_item(sp, cx.item_use_glob(sp, ast::Visibility::Inherited, ids_ext(path))) }).chain(Some(stmt_let_ext_cx)).collect(); cx.expr_block(cx.block_all(sp, stmts, Some(expr))) diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 08b0c0c539f..7cbb3439551 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -1023,7 +1023,7 @@ pub fn noop_fold_crate<T: Folder>(Crate {module, attrs, config, mut exported_mac ident: token::special_idents::invalid, attrs: attrs, id: ast::DUMMY_NODE_ID, - vis: ast::Public, + vis: ast::Visibility::Public, span: span, node: ast::ItemKind::Mod(module), })).into_iter(); diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 850b4365256..f7060296f1a 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -983,7 +983,7 @@ mod tests { rules: ast::BlockCheckMode::Default, // no idea span: sp(15,21), })), - vis: ast::Inherited, + vis: ast::Visibility::Inherited, span: sp(0,21)}))); } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d8fab03d21a..a13c79bdda1 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -23,7 +23,7 @@ use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf}; use ast::{Expr, ExprKind}; use ast::{Field, FnDecl}; use ast::{ForeignItem, ForeignItemKind, FunctionRetTy}; -use ast::{Ident, Inherited, ImplItem, Item, ItemKind}; +use ast::{Ident, ImplItem, Item, ItemKind}; use ast::{Lit, LitKind, UintTy}; use ast::Local; use ast::MacStmtStyle; @@ -3631,8 +3631,8 @@ impl<'a> Parser<'a> { fn parse_name_and_ty(&mut self, pr: Visibility, attrs: Vec<Attribute> ) -> PResult<'a, StructField> { let lo = match pr { - Inherited => self.span.lo, - Public => self.last_span.lo, + Visibility::Inherited => self.span.lo, + Visibility::Public => self.last_span.lo, }; if !self.token.is_plain_ident() { return Err(self.fatal("expected ident")); @@ -3749,7 +3749,7 @@ impl<'a> Parser<'a> { lo, hi, id /*id is good here*/, ItemKind::Mac(spanned(lo, hi, Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT })), - Inherited, attrs)))), + Visibility::Inherited, attrs)))), ast::DUMMY_NODE_ID)) } } else { @@ -4686,7 +4686,7 @@ impl<'a> Parser<'a> { fn complain_if_pub_macro(&mut self, visa: Visibility, span: Span) { match visa { - Public => { + Visibility::Public => { let is_macro_rules: bool = match self.token { token::Ident(sid, _) => sid.name == intern("macro_rules"), _ => false, @@ -4704,7 +4704,7 @@ impl<'a> Parser<'a> { .emit(); } } - Inherited => (), + Visibility::Inherited => (), } } @@ -4974,7 +4974,7 @@ impl<'a> Parser<'a> { if parse_pub == ParsePub::Yes { try!(p.parse_visibility()) } else { - Inherited + Visibility::Inherited } ), id: ast::DUMMY_NODE_ID, @@ -5020,16 +5020,16 @@ impl<'a> Parser<'a> { let span = self.last_span; self.span_err(span, "`pub` is not allowed here"); } - return self.parse_single_struct_field(Public, attrs); + return self.parse_single_struct_field(Visibility::Public, attrs); } - return self.parse_single_struct_field(Inherited, attrs); + return self.parse_single_struct_field(Visibility::Inherited, attrs); } /// Parse visibility: PUB or nothing fn parse_visibility(&mut self) -> PResult<'a, Visibility> { - if self.eat_keyword(keywords::Pub) { Ok(Public) } - else { Ok(Inherited) } + if self.eat_keyword(keywords::Pub) { Ok(Visibility::Public) } + else { Ok(Visibility::Inherited) } } /// Given a termination token, parse all of the items in a module @@ -5304,7 +5304,7 @@ impl<'a> Parser<'a> { let last_span = self.last_span; - if visibility == ast::Public { + if visibility == ast::Visibility::Public { self.span_warn(mk_sp(lo, last_span.hi), "`pub extern crate` does not work as expected and should not be used. \ Likely to become an error. Prefer `extern crate` and `pub use`."); @@ -5819,8 +5819,8 @@ impl<'a> Parser<'a> { // FAILURE TO PARSE ITEM match visibility { - Inherited => {} - Public => { + Visibility::Inherited => {} + Visibility::Public => { let last_span = self.last_span; return Err(self.span_fatal(last_span, "unmatched visibility `pub`")); } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 6e8f0781b4e..78a4bbd962f 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -388,7 +388,7 @@ pub fn fun_to_string(decl: &ast::FnDecl, to_string(|s| { try!(s.head("")); try!(s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name), - generics, opt_explicit_self, ast::Inherited)); + generics, opt_explicit_self, ast::Visibility::Inherited)); try!(s.end()); // Close the head box s.end() // Close the outer box }) @@ -434,8 +434,8 @@ pub fn mac_to_string(arg: &ast::Mac) -> String { pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> String { match vis { - ast::Public => format!("pub {}", s), - ast::Inherited => s.to_string() + ast::Visibility::Public => format!("pub {}", s), + ast::Visibility::Inherited => s.to_string() } } @@ -1388,8 +1388,8 @@ impl<'a> State<'a> { pub fn print_visibility(&mut self, vis: ast::Visibility) -> io::Result<()> { match vis { - ast::Public => self.word_nbsp("pub"), - ast::Inherited => Ok(()) + ast::Visibility::Public => self.word_nbsp("pub"), + ast::Visibility::Inherited => Ok(()) } } @@ -1555,13 +1555,13 @@ impl<'a> State<'a> { ast::TraitItemKind::Const(ref ty, ref default) => { try!(self.print_associated_const(ti.ident, &ty, default.as_ref().map(|expr| &**expr), - ast::Inherited)); + ast::Visibility::Inherited)); } ast::TraitItemKind::Method(ref sig, ref body) => { if body.is_some() { try!(self.head("")); } - try!(self.print_method_sig(ti.ident, sig, ast::Inherited)); + try!(self.print_method_sig(ti.ident, sig, ast::Visibility::Inherited)); if let Some(ref body) = *body { try!(self.nbsp()); try!(self.print_block_with_attrs(body, &ti.attrs)); @@ -3030,7 +3030,7 @@ impl<'a> State<'a> { name, &generics, opt_explicit_self, - ast::Inherited)); + ast::Visibility::Inherited)); self.end() } diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index 996a2ee006e..9049b21d8b4 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -90,7 +90,7 @@ impl fold::Folder for CrateInjector { attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_word_item( InternedString::new("macro_use")))), node: ast::ItemKind::ExternCrate(Some(self.crate_name)), - vis: ast::Inherited, + vis: ast::Visibility::Inherited, span: DUMMY_SP })); @@ -162,7 +162,7 @@ impl fold::Folder for PreludeInjector { is_sugared_doc: false, }, }], - vis: ast::Inherited, + vis: ast::Visibility::Inherited, span: self.span, })); diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 92ecadd7ae8..6b4f9464190 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -147,7 +147,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> { // the module (note that the tests are re-exported and must // be made public themselves to avoid privacy errors). i.map(|mut i| { - i.vis = ast::Public; + i.vis = ast::Visibility::Public; i }) } @@ -245,11 +245,11 @@ fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>, let super_ = token::str_to_ident("super"); let items = tests.into_iter().map(|r| { - cx.ext_cx.item_use_simple(DUMMY_SP, ast::Public, + cx.ext_cx.item_use_simple(DUMMY_SP, ast::Visibility::Public, cx.ext_cx.path(DUMMY_SP, vec![super_, r])) }).chain(tested_submods.into_iter().map(|(r, sym)| { let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]); - cx.ext_cx.item_use_simple_(DUMMY_SP, ast::Public, r, path) + cx.ext_cx.item_use_simple_(DUMMY_SP, ast::Visibility::Public, r, path) })); let reexport_mod = ast::Mod { @@ -263,7 +263,7 @@ fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>, attrs: Vec::new(), id: ast::DUMMY_NODE_ID, node: ast::ItemKind::Mod(reexport_mod), - vis: ast::Public, + vis: ast::Visibility::Public, span: DUMMY_SP, }); @@ -456,9 +456,9 @@ fn mk_std(cx: &TestCtxt) -> P<ast::Item> { (ast::ItemKind::Use( P(nospan(ast::ViewPathSimple(id_test, path_node(vec!(id_test)))))), - ast::Public, token::special_idents::invalid) + ast::Visibility::Public, token::special_idents::invalid) } else { - (ast::ItemKind::ExternCrate(None), ast::Inherited, id_test) + (ast::ItemKind::ExternCrate(None), ast::Visibility::Inherited, id_test) }; P(ast::Item { id: ast::DUMMY_NODE_ID, @@ -505,7 +505,7 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> { attrs: vec![main_attr], id: ast::DUMMY_NODE_ID, node: main, - vis: ast::Public, + vis: ast::Visibility::Public, span: sp }); @@ -535,7 +535,7 @@ fn mk_test_module(cx: &mut TestCtxt) -> (P<ast::Item>, Option<P<ast::Item>>) { ident: mod_ident, attrs: vec![], node: item_, - vis: ast::Public, + vis: ast::Visibility::Public, span: DUMMY_SP, }); let reexport = cx.reexport_test_harness_main.as_ref().map(|s| { @@ -551,7 +551,7 @@ fn mk_test_module(cx: &mut TestCtxt) -> (P<ast::Item>, Option<P<ast::Item>>) { ident: token::special_idents::invalid, attrs: vec![], node: ast::ItemKind::Use(P(use_path)), - vis: ast::Inherited, + vis: ast::Visibility::Inherited, span: DUMMY_SP }) }); |
