diff options
| author | bors <bors@rust-lang.org> | 2019-09-27 10:05:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-27 10:05:38 +0000 |
| commit | 590ae0ec4d0c782f7cf97cff7474dc4012c1b615 (patch) | |
| tree | 6599f55c2c1113952f9a1d369773392252304b6e /src/libsyntax_ext | |
| parent | 59367b074f1523353dddefa678ffe3cac9fd4e50 (diff) | |
| parent | 80b63ddca59b16ca503f2f8306e9200102745426 (diff) | |
| download | rust-590ae0ec4d0c782f7cf97cff7474dc4012c1b615.tar.gz rust-590ae0ec4d0c782f7cf97cff7474dc4012c1b615.zip | |
Auto merge of #64813 - varkor:node-to-kind, r=Centril
Rename `*.node` to `*.kind`, and `hair::Pattern*` to `hair::Pat*` In both `ast::Expr` and `hir::Expr`: - Rename `Expr.node` to `Expr.kind`. - Rename `Pat.node` to `Pat.kind`. - Rename `ImplItem.node` to `ImplItem.kind`. - Rename `Lit.node` to `Lit.kind`. - Rename `TraitItem.node` to `TraitItem.kind`. - Rename `Ty.node` to `Ty.kind`. - Rename `Stmt.node` to `Stmt.kind`. - Rename `Item.node` to `Item.kind`. - Rename `ForeignItem.node` to `ForeignItem.kind`. - Rename `MetaItem.node` to `MetaItem.kind`. Also: - Rename `hair::FieldPattern` to `hair::FieldPat`. - Rename `hair::PatternKind` to `hair::PatKind`. - Rename `hair::PatternRange` to `hair::PatRange`. - Rename `PatternContext` to `PatCtxt`. - Rename `PatternTypeProjection` to `PatTyProj`. - Rename `hair::Pattern` to `hair::Pat`. These two sets of changes are grouped together to aid with merging. The only changes are renamings. r? @petrochenkov
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/asm.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/concat.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax_ext/concat_idents.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/clone.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/debug.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/mod.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax_ext/global_allocator.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/global_asm.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/plugin_macro_defs.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/proc_macro_harness.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax_ext/test.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax_ext/test_harness.rs | 10 |
12 files changed, 28 insertions, 28 deletions
diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs index 75d727b9fb6..becbf6d60a0 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/libsyntax_ext/asm.rs @@ -61,7 +61,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt<'_>, MacEager::expr(P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::InlineAsm(P(inline_asm)), + kind: ast::ExprKind::InlineAsm(P(inline_asm)), span: cx.with_def_site_ctxt(sp), attrs: ThinVec::new(), })) diff --git a/src/libsyntax_ext/concat.rs b/src/libsyntax_ext/concat.rs index 16f016036ea..790fdad5b3f 100644 --- a/src/libsyntax_ext/concat.rs +++ b/src/libsyntax_ext/concat.rs @@ -18,8 +18,8 @@ pub fn expand_concat( let mut missing_literal = vec![]; let mut has_errors = false; for e in es { - match e.node { - ast::ExprKind::Lit(ref lit) => match lit.node { + match e.kind { + ast::ExprKind::Lit(ref lit) => match lit.kind { ast::LitKind::Str(ref s, _) | ast::LitKind::Float(ref s, _) | ast::LitKind::FloatUnsuffixed(ref s) => { diff --git a/src/libsyntax_ext/concat_idents.rs b/src/libsyntax_ext/concat_idents.rs index f344706d4eb..f6747658c07 100644 --- a/src/libsyntax_ext/concat_idents.rs +++ b/src/libsyntax_ext/concat_idents.rs @@ -47,7 +47,7 @@ pub fn expand_concat_idents<'cx>(cx: &'cx mut ExtCtxt<'_>, fn make_expr(self: Box<Self>) -> Option<P<ast::Expr>> { Some(P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Path(None, ast::Path::from_ident(self.ident)), + kind: ast::ExprKind::Path(None, ast::Path::from_ident(self.ident)), span: self.ident.span, attrs: ThinVec::new(), })) @@ -56,7 +56,7 @@ pub fn expand_concat_idents<'cx>(cx: &'cx mut ExtCtxt<'_>, fn make_ty(self: Box<Self>) -> Option<P<ast::Ty>> { Some(P(ast::Ty { id: ast::DUMMY_NODE_ID, - node: ast::TyKind::Path(None, ast::Path::from_ident(self.ident)), + kind: ast::TyKind::Path(None, ast::Path::from_ident(self.ident)), span: self.ident.span, })) } diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs index 9a4c540dc6f..9ef2c033b07 100644 --- a/src/libsyntax_ext/deriving/clone.rs +++ b/src/libsyntax_ext/deriving/clone.rs @@ -32,7 +32,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt<'_>, let is_shallow; match *item { Annotatable::Item(ref annitem) => { - match annitem.node { + match annitem.kind { ItemKind::Struct(_, Generics { ref params, .. }) | ItemKind::Enum(_, Generics { ref params, .. }) => { let container_id = cx.current_expansion.id.expn_data().parent; diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs index 088b61be8b8..003c2423576 100644 --- a/src/libsyntax_ext/deriving/debug.rs +++ b/src/libsyntax_ext/deriving/debug.rs @@ -131,7 +131,7 @@ fn stmt_let_undescore(cx: &mut ExtCtxt<'_>, sp: Span, expr: P<ast::Expr>) -> ast }); ast::Stmt { id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Local(local), + kind: ast::StmtKind::Local(local), span: sp, } } diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index fec035d331d..9f75f72e820 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -355,7 +355,7 @@ fn find_type_parameters( impl<'a, 'b> visit::Visitor<'a> for Visitor<'a, 'b> { fn visit_ty(&mut self, ty: &'a ast::Ty) { - if let ast::TyKind::Path(_, ref path) = ty.node { + if let ast::TyKind::Path(_, ref path) = ty.kind { if let Some(segment) = path.segments.first() { if self.ty_param_names.contains(&segment.ident.name) { self.types.push(P(ty.clone())); @@ -409,7 +409,7 @@ impl<'a> TraitDef<'a> { } false }); - let has_no_type_params = match item.node { + let has_no_type_params = match item.kind { ast::ItemKind::Struct(_, ref generics) | ast::ItemKind::Enum(_, ref generics) | ast::ItemKind::Union(_, ref generics) => { @@ -431,7 +431,7 @@ impl<'a> TraitDef<'a> { has_no_type_params; let use_temporaries = is_packed && is_always_copy; - let newitem = match item.node { + let newitem = match item.kind { ast::ItemKind::Struct(ref struct_def, ref generics) => { self.expand_struct_def(cx, &struct_def, item.ident, generics, from_scratch, use_temporaries) @@ -530,7 +530,7 @@ impl<'a> TraitDef<'a> { defaultness: ast::Defaultness::Final, attrs: Vec::new(), generics: Generics::default(), - node: ast::ImplItemKind::TyAlias( + kind: ast::ImplItemKind::TyAlias( type_def.to_ty(cx, self.span, type_ident, generics)), tokens: None, } @@ -612,7 +612,7 @@ impl<'a> TraitDef<'a> { for ty in tys { // if we have already handled this type, skip it - if let ast::TyKind::Path(_, ref p) = ty.node { + if let ast::TyKind::Path(_, ref p) = ty.kind { if p.segments.len() == 1 && ty_param_names.contains(&p.segments[0].ident.name) { continue; @@ -960,7 +960,7 @@ impl<'a> MethodDef<'a> { vis: respan(trait_.span.shrink_to_lo(), ast::VisibilityKind::Inherited), defaultness: ast::Defaultness::Final, ident: method_ident, - node: ast::ImplItemKind::Method(ast::MethodSig { + kind: ast::ImplItemKind::Method(ast::MethodSig { header: ast::FnHeader { unsafety, abi, ..ast::FnHeader::default() @@ -1780,7 +1780,7 @@ pub fn cs_fold1<F, B>(use_foldl: bool, /// (for an enum, no variant has any fields) pub fn is_type_without_fields(item: &Annotatable) -> bool { if let Annotatable::Item(ref item) = *item { - match item.node { + match item.kind { ast::ItemKind::Enum(ref enum_def, _) => { enum_def.variants.iter().all(|v| v.data.fields().is_empty()) } diff --git a/src/libsyntax_ext/global_allocator.rs b/src/libsyntax_ext/global_allocator.rs index 19a87e6dc6d..cd2a9b61a76 100644 --- a/src/libsyntax_ext/global_allocator.rs +++ b/src/libsyntax_ext/global_allocator.rs @@ -20,7 +20,7 @@ pub fn expand( vec![item] }; let item = match item { - Annotatable::Item(item) => match item.node { + Annotatable::Item(item) => match item.kind { ItemKind::Static(..) => item, _ => return not_static(Annotatable::Item(item)), } diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs index c56b3f3fc80..72fb5b47c21 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/libsyntax_ext/global_asm.rs @@ -28,7 +28,7 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt<'_>, ident: ast::Ident::invalid(), attrs: Vec::new(), id: ast::DUMMY_NODE_ID, - node: ast::ItemKind::GlobalAsm(P(global_asm)), + kind: ast::ItemKind::GlobalAsm(P(global_asm)), vis: respan(sp.shrink_to_lo(), ast::VisibilityKind::Inherited), span: cx.with_def_site_ctxt(sp), tokens: None, diff --git a/src/libsyntax_ext/plugin_macro_defs.rs b/src/libsyntax_ext/plugin_macro_defs.rs index ccdc5bd81a0..315babceae3 100644 --- a/src/libsyntax_ext/plugin_macro_defs.rs +++ b/src/libsyntax_ext/plugin_macro_defs.rs @@ -28,7 +28,7 @@ fn plugin_macro_def(name: Name, span: Span) -> P<Item> { ident: Ident::new(name, span), attrs: vec![rustc_builtin_macro], id: DUMMY_NODE_ID, - node: ItemKind::MacroDef(MacroDef { tokens: TokenStream::new(trees), legacy: true }), + kind: ItemKind::MacroDef(MacroDef { tokens: TokenStream::new(trees), legacy: true }), vis: respan(span, VisibilityKind::Inherited), span: span, tokens: None, diff --git a/src/libsyntax_ext/proc_macro_harness.rs b/src/libsyntax_ext/proc_macro_harness.rs index f33c813d86c..9b53bcb841c 100644 --- a/src/libsyntax_ext/proc_macro_harness.rs +++ b/src/libsyntax_ext/proc_macro_harness.rs @@ -226,7 +226,7 @@ impl<'a> CollectProcMacros<'a> { impl<'a> Visitor<'a> for CollectProcMacros<'a> { fn visit_item(&mut self, item: &'a ast::Item) { - if let ast::ItemKind::MacroDef(..) = item.node { + if let ast::ItemKind::MacroDef(..) = item.kind { if self.is_proc_macro_crate && attr::contains_name(&item.attrs, sym::macro_export) { let msg = "cannot export macro_rules! macros from a `proc-macro` crate type currently"; @@ -238,7 +238,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> { // we're just not interested in this item. // // If we find one, try to locate a `#[proc_macro_derive]` attribute on it. - let is_fn = match item.node { + let is_fn = match item.kind { ast::ItemKind::Fn(..) => true, _ => false, }; diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs index 6c7e3e3eb98..5d68a92579f 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/libsyntax_ext/test.rs @@ -78,7 +78,7 @@ pub fn expand_test_or_bench( "`#[test]` attribute is only allowed on non associated functions").raise(); }; - if let ast::ItemKind::Mac(_) = item.node { + if let ast::ItemKind::Mac(_) = item.kind { cx.parse_sess.span_diagnostic.span_warn(item.span, "`#[test]` attribute should not be used on macros. Use `#[cfg(test)]` instead."); return vec![Annotatable::Item(item)]; @@ -264,7 +264,7 @@ fn should_panic(cx: &ExtCtxt<'_>, i: &ast::Item) -> ShouldPanic { fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool { let has_should_panic_attr = attr::contains_name(&i.attrs, sym::should_panic); let ref sd = cx.parse_sess.span_diagnostic; - if let ast::ItemKind::Fn(ref decl, ref header, ref generics, _) = i.node { + if let ast::ItemKind::Fn(ref decl, ref header, ref generics, _) = i.kind { if header.unsafety == ast::Unsafety::Unsafe { sd.span_err( i.span, @@ -285,7 +285,7 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool { // type implements the `Termination` trait as `libtest` enforces that. let has_output = match decl.output { ast::FunctionRetTy::Default(..) => false, - ast::FunctionRetTy::Ty(ref t) if t.node.is_unit() => false, + ast::FunctionRetTy::Ty(ref t) if t.kind.is_unit() => false, _ => true }; @@ -315,7 +315,7 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool { } fn has_bench_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool { - let has_sig = if let ast::ItemKind::Fn(ref decl, _, _, _) = i.node { + let has_sig = if let ast::ItemKind::Fn(ref decl, _, _, _) = i.kind { // N.B., inadequate check, but we're running // well before resolve, can't get too deep. decl.inputs.len() == 1 diff --git a/src/libsyntax_ext/test_harness.rs b/src/libsyntax_ext/test_harness.rs index 56de0c97f81..fc1daa7d9b2 100644 --- a/src/libsyntax_ext/test_harness.rs +++ b/src/libsyntax_ext/test_harness.rs @@ -85,7 +85,7 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> { // We don't want to recurse into anything other than mods, since // mods or tests inside of functions will break things - if let ast::ItemKind::Mod(mut module) = item.node { + if let ast::ItemKind::Mod(mut module) = item.kind { let tests = mem::take(&mut self.tests); noop_visit_mod(&mut module, self); let mut tests = mem::replace(&mut self.tests, tests); @@ -111,7 +111,7 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> { } self.cx.test_cases.extend(tests); } - item.node = ast::ItemKind::Mod(module); + item.kind = ast::ItemKind::Mod(module); } smallvec![P(item)] } @@ -142,7 +142,7 @@ impl MutVisitor for EntryPointCleaner { EntryPointType::MainNamed | EntryPointType::MainAttr | EntryPointType::Start => - item.map(|ast::Item {id, ident, attrs, node, vis, span, tokens}| { + item.map(|ast::Item {id, ident, attrs, kind, vis, span, tokens}| { let allow_ident = Ident::new(sym::allow, self.def_site); let dc_nested = attr::mk_nested_word_item( Ident::from_str_and_span("dead_code", self.def_site), @@ -159,7 +159,7 @@ impl MutVisitor for EntryPointCleaner { }) .chain(iter::once(allow_dead_code)) .collect(), - node, + kind, vis, span, tokens, @@ -295,7 +295,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> { ident: main_id, attrs: vec![main_attr], id: ast::DUMMY_NODE_ID, - node: main, + kind: main, vis: respan(sp, ast::VisibilityKind::Public), span: sp, tokens: None, |
