diff options
| author | varkor <github@varkor.com> | 2019-09-26 17:51:36 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-09-26 18:21:48 +0100 |
| commit | 7bc94cc3c2ccef8b4d393910bb978a6487db1202 (patch) | |
| tree | 1c7a5175d795992497651e7dfa3e3a0f76f5815a /src/libsyntax | |
| parent | 21bf983acbb5d7ac8fb9462cbf2cc4c280abd857 (diff) | |
| download | rust-7bc94cc3c2ccef8b4d393910bb978a6487db1202.tar.gz rust-7bc94cc3c2ccef8b4d393910bb978a6487db1202.zip | |
Rename `Item.node` to `Item.kind`
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/entry.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/mbe/macro_rules.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/placeholders.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/proc_macro.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/check.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/mut_visit.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/diagnostics.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/item.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/tests.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 2 |
15 files changed, 28 insertions, 28 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 684a2f15c62..15b30352e46 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2269,7 +2269,7 @@ pub struct Item { pub ident: Ident, pub attrs: Vec<Attribute>, pub id: NodeId, - pub node: ItemKind, + pub kind: ItemKind, pub vis: Visibility, pub span: Span, diff --git a/src/libsyntax/entry.rs b/src/libsyntax/entry.rs index 0b6cf30bd27..34b5b1e5b5c 100644 --- a/src/libsyntax/entry.rs +++ b/src/libsyntax/entry.rs @@ -13,7 +13,7 @@ pub enum EntryPointType { // Beware, this is duplicated in librustc/middle/entry.rs, make sure to keep // them in sync. pub fn entry_point_type(item: &Item, depth: usize) -> EntryPointType { - match item.node { + match item.kind { ItemKind::Fn(..) => { if attr::contains_name(&item.attrs, sym::start) { EntryPointType::Start diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 692849eb8cf..54cfb80573e 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -222,7 +222,7 @@ impl Annotatable { pub fn derive_allowed(&self) -> bool { match *self { - Annotatable::Item(ref item) => match item.node { + Annotatable::Item(ref item) => match item.kind { ast::ItemKind::Struct(..) | ast::ItemKind::Enum(..) | ast::ItemKind::Union(..) => true, diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index a2a7571c440..6b93d045588 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -567,14 +567,14 @@ impl<'a> ExtCtxt<'a> { } pub fn item(&self, span: Span, name: Ident, - attrs: Vec<ast::Attribute>, node: ast::ItemKind) -> P<ast::Item> { + attrs: Vec<ast::Attribute>, kind: ast::ItemKind) -> P<ast::Item> { // FIXME: Would be nice if our generated code didn't violate // Rust coding conventions P(ast::Item { ident: name, attrs, id: ast::DUMMY_NODE_ID, - node, + kind, vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited), span, tokens: None, diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index d90839ac7fd..bc073a66795 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -293,7 +293,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let krate_item = AstFragment::Items(smallvec![P(ast::Item { attrs: krate.attrs, span: krate.span, - node: ast::ItemKind::Mod(krate.module), + kind: ast::ItemKind::Mod(krate.module), ident: Ident::invalid(), id: ast::DUMMY_NODE_ID, vis: respan(krate.span.shrink_to_lo(), ast::VisibilityKind::Public), @@ -301,7 +301,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { })]); match self.fully_expand_fragment(krate_item).make_items().pop().map(P::into_inner) { - Some(ast::Item { attrs, node: ast::ItemKind::Mod(module), .. }) => { + Some(ast::Item { attrs, kind: ast::ItemKind::Mod(module), .. }) => { krate.attrs = attrs; krate.module = module; }, @@ -689,7 +689,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { fn gate_proc_macro_attr_item(&self, span: Span, item: &Annotatable) { let (kind, gate) = match *item { Annotatable::Item(ref item) => { - match item.node { + match item.kind { ItemKind::Mod(_) if self.cx.ecfg.proc_macro_hygiene() => return, ItemKind::Mod(_) => ("modules", sym::proc_macro_hygiene), _ => return, @@ -737,7 +737,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { impl<'ast, 'a> Visitor<'ast> for DisallowMacros<'a> { fn visit_item(&mut self, i: &'ast ast::Item) { - if let ast::ItemKind::MacroDef(_) = i.node { + if let ast::ItemKind::MacroDef(_) = i.kind { emit_feature_err( self.parse_sess, sym::proc_macro_hygiene, @@ -1247,10 +1247,10 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { AstFragmentKind::Items, after_derive).make_items(); } - match item.node { + match item.kind { ast::ItemKind::Mac(..) => { self.check_attributes(&item.attrs); - item.and_then(|item| match item.node { + item.and_then(|item| match item.kind { ItemKind::Mac(mac) => self.collect( AstFragmentKind::Items, InvocationKind::Bang { mac, span: item.span } ).make_items(), diff --git a/src/libsyntax/ext/mbe/macro_rules.rs b/src/libsyntax/ext/mbe/macro_rules.rs index c24f6a66603..aec4a683141 100644 --- a/src/libsyntax/ext/mbe/macro_rules.rs +++ b/src/libsyntax/ext/mbe/macro_rules.rs @@ -302,7 +302,7 @@ pub fn compile_declarative_macro( let tt_spec = ast::Ident::new(sym::tt, def.span); // Parse the macro_rules! invocation - let body = match def.node { + let body = match def.kind { ast::ItemKind::MacroDef(ref body) => body, _ => unreachable!(), }; diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index cb4c685dabe..a06de0f5517 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -48,7 +48,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment { AstFragmentKind::OptExpr => AstFragment::OptExpr(Some(expr_placeholder())), AstFragmentKind::Items => AstFragment::Items(smallvec![P(ast::Item { id, span, ident, vis, attrs, - node: ast::ItemKind::Mac(mac_placeholder()), + kind: ast::ItemKind::Mac(mac_placeholder()), tokens: None, })]), AstFragmentKind::TraitItems => AstFragment::TraitItems(smallvec![ast::TraitItem { @@ -251,7 +251,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { } fn flat_map_item(&mut self, item: P<ast::Item>) -> SmallVec<[P<ast::Item>; 1]> { - match item.node { + match item.kind { ast::ItemKind::Mac(_) => return self.remove(item.id).make_items(), ast::ItemKind::MacroDef(_) => return smallvec![item], _ => {} @@ -337,7 +337,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { fn visit_mod(&mut self, module: &mut ast::Mod) { noop_visit_mod(module, self); - module.items.retain(|item| match item.node { + module.items.retain(|item| match item.kind { ast::ItemKind::Mac(_) if !self.cx.ecfg.keep_macs => false, // remove macro definitions _ => true, }); diff --git a/src/libsyntax/ext/proc_macro.rs b/src/libsyntax/ext/proc_macro.rs index 47b17ced816..e17bbf79fd5 100644 --- a/src/libsyntax/ext/proc_macro.rs +++ b/src/libsyntax/ext/proc_macro.rs @@ -107,7 +107,7 @@ impl MultiItemModifier for ProcMacroDerive { return Vec::new() } }; - match item.node { + match item.kind { ItemKind::Struct(..) | ItemKind::Enum(..) | ItemKind::Union(..) => {}, diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 1729ae7eae8..2ed4404fb3c 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -302,7 +302,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } fn visit_item(&mut self, i: &'a ast::Item) { - match i.node { + match i.kind { ast::ItemKind::ForeignMod(ref foreign_module) => { self.check_abi(foreign_module.abi, i.span); } diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 0a42fc0cdfd..c448aa980c6 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -994,7 +994,7 @@ pub fn noop_visit_crate<T: MutVisitor>(krate: &mut Crate, vis: &mut T) { id: DUMMY_NODE_ID, vis: respan(span.shrink_to_lo(), VisibilityKind::Public), span, - node: ItemKind::Mod(module), + kind: ItemKind::Mod(module), tokens: None, }); let items = vis.flat_map_item(item); @@ -1004,8 +1004,8 @@ pub fn noop_visit_crate<T: MutVisitor>(krate: &mut Crate, vis: &mut T) { let module = Mod { inner: span, items: vec![], inline: true }; Crate { module, attrs: vec![], span } } else if len == 1 { - let Item { attrs, span, node, .. } = items.into_iter().next().unwrap().into_inner(); - match node { + let Item { attrs, span, kind, .. } = items.into_iter().next().unwrap().into_inner(); + match kind { ItemKind::Mod(module) => Crate { module, attrs, span }, _ => panic!("visitor converted a module to not a module"), } @@ -1018,11 +1018,11 @@ pub fn noop_visit_crate<T: MutVisitor>(krate: &mut Crate, vis: &mut T) { // Mutates one item into possibly many items. pub fn noop_flat_map_item<T: MutVisitor>(mut item: P<Item>, visitor: &mut T) -> SmallVec<[P<Item>; 1]> { - let Item { ident, attrs, id, node, vis, span, tokens: _ } = item.deref_mut(); + let Item { ident, attrs, id, kind, vis, span, tokens: _ } = item.deref_mut(); visitor.visit_ident(ident); visit_attrs(attrs, visitor); visitor.visit_id(id); - visitor.visit_item_kind(node); + visitor.visit_item_kind(kind); visitor.visit_vis(vis); visitor.visit_span(span); diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index 62cb836e31e..ec5d00e0952 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -761,7 +761,7 @@ impl<'a> Parser<'a> { ); if !items.is_empty() { let previous_item = &items[items.len() - 1]; - let previous_item_kind_name = match previous_item.node { + let previous_item_kind_name = match previous_item.kind { // Say "braced struct" because tuple-structs and // braceless-empty-struct declarations do take a semicolon. ItemKind::Struct(..) => Some("braced struct"), diff --git a/src/libsyntax/parse/parser/item.rs b/src/libsyntax/parse/parser/item.rs index 27b0325db12..83721a2866a 100644 --- a/src/libsyntax/parse/parser/item.rs +++ b/src/libsyntax/parse/parser/item.rs @@ -1949,13 +1949,13 @@ impl<'a> Parser<'a> { } } - fn mk_item(&self, span: Span, ident: Ident, node: ItemKind, vis: Visibility, + fn mk_item(&self, span: Span, ident: Ident, kind: ItemKind, vis: Visibility, attrs: Vec<Attribute>) -> P<Item> { P(Item { ident, attrs, id: DUMMY_NODE_ID, - node, + kind, vis, span, tokens: None, diff --git a/src/libsyntax/parse/tests.rs b/src/libsyntax/parse/tests.rs index 7b714858850..3bdb9227b4e 100644 --- a/src/libsyntax/parse/tests.rs +++ b/src/libsyntax/parse/tests.rs @@ -299,7 +299,7 @@ fn out_of_line_mod() { &sess, ).unwrap().unwrap(); - if let ast::ItemKind::Mod(ref m) = item.node { + if let ast::ItemKind::Mod(ref m) = item.kind { assert!(m.items.len() == 2); } else { panic!(); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 5bf5842e3f7..675490552e5 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1142,7 +1142,7 @@ impl<'a> State<'a> { self.maybe_print_comment(item.span.lo()); self.print_outer_attributes(&item.attrs); self.ann.pre(self, AnnNode::Item(item)); - match item.node { + match item.kind { ast::ItemKind::ExternCrate(orig_name) => { self.head(visibility_qualified(&item.vis, "extern crate")); if let Some(orig_name) = orig_name { diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 477852e5df1..ea6d27d4f29 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -230,7 +230,7 @@ pub fn walk_trait_ref<'a, V: Visitor<'a>>(visitor: &mut V, trait_ref: &'a TraitR pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { visitor.visit_vis(&item.vis); visitor.visit_ident(item.ident); - match item.node { + match item.kind { ItemKind::ExternCrate(orig_name) => { if let Some(orig_name) = orig_name { visitor.visit_name(item.span, orig_name); |
