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/parse | |
| 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/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/classify.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/diagnostics.rs | 30 | ||||
| -rw-r--r-- | src/libsyntax/parse/literal.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/expr.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/item.rs | 30 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/pat.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/path.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/stmt.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/ty.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/tests.rs | 6 |
12 files changed, 73 insertions, 73 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index cf6151d17b1..44688bd36b5 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -179,7 +179,7 @@ impl<'a> Parser<'a> { }; Ok(if let Some(meta) = meta { self.bump(); - (meta.path, meta.node.tokens(meta.span)) + (meta.path, meta.kind.tokens(meta.span)) } else { let path = self.parse_path(PathStyle::Mod)?; let tokens = if self.check(&token::OpenDelim(DelimToken::Paren)) || @@ -249,7 +249,7 @@ impl<'a> Parser<'a> { let lit = self.parse_lit()?; debug!("checking if {:?} is unusuffixed", lit); - if !lit.node.is_unsuffixed() { + if !lit.kind.is_unsuffixed() { let msg = "suffixed literals are not allowed in attributes"; self.diagnostic().struct_span_err(lit.span, msg) .help("instead of using a suffixed literal \ @@ -281,9 +281,9 @@ impl<'a> Parser<'a> { let lo = self.token.span; let path = self.parse_path(PathStyle::Mod)?; - let node = self.parse_meta_item_kind()?; + let kind = self.parse_meta_item_kind()?; let span = lo.to(self.prev_span); - Ok(ast::MetaItem { path, node, span }) + Ok(ast::MetaItem { path, kind, span }) } crate fn parse_meta_item_kind(&mut self) -> PResult<'a, ast::MetaItemKind> { diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index 6ebfab3a133..44560688750 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -12,7 +12,7 @@ use crate::ast; /// |x| 5 /// isn't parsed as (if true {...} else {...} | x) | 5 pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool { - match e.node { + match e.kind { ast::ExprKind::If(..) | ast::ExprKind::Match(..) | ast::ExprKind::Block(..) | diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index 59de5f14123..ec5d00e0952 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -21,11 +21,11 @@ use std::mem; crate fn dummy_arg(ident: Ident) -> Param { let pat = P(Pat { id: ast::DUMMY_NODE_ID, - node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None), + kind: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None), span: ident.span, }); let ty = Ty { - node: TyKind::Err, + kind: TyKind::Err, span: ident.span, id: ast::DUMMY_NODE_ID }; @@ -135,7 +135,7 @@ impl RecoverQPath for Ty { fn recovered(qself: Option<QSelf>, path: ast::Path) -> Self { Self { span: path.span, - node: TyKind::Path(qself, path), + kind: TyKind::Path(qself, path), id: ast::DUMMY_NODE_ID, } } @@ -148,7 +148,7 @@ impl RecoverQPath for Pat { fn recovered(qself: Option<QSelf>, path: ast::Path) -> Self { Self { span: path.span, - node: PatKind::Path(qself, path), + kind: PatKind::Path(qself, path), id: ast::DUMMY_NODE_ID, } } @@ -161,7 +161,7 @@ impl RecoverQPath for Expr { fn recovered(qself: Option<QSelf>, path: ast::Path) -> Self { Self { span: path.span, - node: ExprKind::Path(qself, path), + kind: ExprKind::Path(qself, path), attrs: ThinVec::new(), id: ast::DUMMY_NODE_ID, } @@ -549,7 +549,7 @@ impl<'a> Parser<'a> { debug_assert!(outer_op.is_comparison(), "check_no_chained_comparison: {:?} is not comparison", outer_op); - match lhs.node { + match lhs.kind { ExprKind::Binary(op, _, _) if op.node.is_comparison() => { // Respan to include both operators. let op_span = op.span.to(self.token.span); @@ -663,7 +663,7 @@ impl<'a> Parser<'a> { pprust::ty_to_string(ty) ); - match ty.node { + match ty.kind { TyKind::Rptr(ref lifetime, ref mut_ty) => { let sum_with_parens = pprust::to_string(|s| { s.s.word("&"); @@ -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"), @@ -915,7 +915,7 @@ impl<'a> Parser<'a> { .unwrap_or_else(|_| pprust::expr_to_string(&expr)); let suggestion = format!("{}.await{}", expr_str, if is_question { "?" } else { "" }); let sp = lo.to(hi); - let app = match expr.node { + let app = match expr.kind { ExprKind::Try(_) => Applicability::MaybeIncorrect, // `await <expr>?` _ => Applicability::MachineApplicable, }; @@ -978,7 +978,7 @@ impl<'a> Parser<'a> { .emit(); // Unwrap `(pat)` into `pat` to avoid the `unused_parens` lint. - pat.and_then(|pat| match pat.node { + pat.and_then(|pat| match pat.kind { PatKind::Paren(pat) => pat, _ => P(pat), }) @@ -1237,7 +1237,7 @@ impl<'a> Parser<'a> { Applicability::HasPlaceholders, ); return Some(ident); - } else if let PatKind::Ident(_, ident, _) = pat.node { + } else if let PatKind::Ident(_, ident, _) = pat.kind { if require_name && ( is_trait_item || self.token == token::Comma || @@ -1283,7 +1283,7 @@ impl<'a> Parser<'a> { // Pretend the pattern is `_`, to avoid duplicate errors from AST validation. let pat = P(Pat { - node: PatKind::Wild, + kind: PatKind::Wild, span: pat.span, id: ast::DUMMY_NODE_ID }); @@ -1296,7 +1296,7 @@ impl<'a> Parser<'a> { is_trait_item: bool, ) -> PResult<'a, ast::Param> { let sp = param.pat.span; - param.ty.node = TyKind::Err; + param.ty.kind = TyKind::Err; let mut err = self.struct_span_err(sp, "unexpected `self` parameter in function"); if is_trait_item { err.span_label(sp, "must be the first associated function parameter"); @@ -1360,7 +1360,7 @@ impl<'a> Parser<'a> { let mut seen_inputs = FxHashSet::default(); for input in fn_inputs.iter_mut() { let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) = ( - &input.pat.node, &input.ty.node, + &input.pat.kind, &input.ty.kind, ) { Some(*ident) } else { @@ -1368,7 +1368,7 @@ impl<'a> Parser<'a> { }; if let Some(ident) = opt_ident { if seen_inputs.contains(&ident) { - input.pat.node = PatKind::Wild; + input.pat.kind = PatKind::Wild; } seen_inputs.insert(ident); } diff --git a/src/libsyntax/parse/literal.rs b/src/libsyntax/parse/literal.rs index 36233de3cfb..fcd5b2782fd 100644 --- a/src/libsyntax/parse/literal.rs +++ b/src/libsyntax/parse/literal.rs @@ -255,7 +255,7 @@ impl LitKind { impl Lit { /// Converts literal token into an AST literal. fn from_lit_token(token: token::Lit, span: Span) -> Result<Lit, LitError> { - Ok(Lit { token, node: LitKind::from_lit_token(token)?, span }) + Ok(Lit { token, kind: LitKind::from_lit_token(token)?, span }) } /// Converts arbitrary token into an AST literal. @@ -267,7 +267,7 @@ impl Lit { lit, token::Interpolated(ref nt) => { if let token::NtExpr(expr) | token::NtLiteral(expr) = &**nt { - if let ast::ExprKind::Lit(lit) = &expr.node { + if let ast::ExprKind::Lit(lit) = &expr.kind { return Ok(lit.clone()); } } @@ -282,8 +282,8 @@ impl Lit { /// Attempts to recover an AST literal from semantic literal. /// This function is used when the original token doesn't exist (e.g. the literal is created /// by an AST-based macro) or unavailable (e.g. from HIR pretty-printing). - pub fn from_lit_kind(node: LitKind, span: Span) -> Lit { - Lit { token: node.to_lit_token(), node, span } + pub fn from_lit_kind(kind: LitKind, span: Span) -> Lit { + Lit { token: kind.to_lit_token(), kind, span } } /// Losslessly convert an AST literal into a token stream. diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b2b6504919e..cc582819b6b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1212,7 +1212,7 @@ impl<'a> Parser<'a> { do_not_enforce_named_arguments_for_c_variadic ) { Ok(param) => { - if let TyKind::CVarArgs = param.ty.node { + if let TyKind::CVarArgs = param.ty.kind { c_variadic = true; if p.token != token::CloseDelim(token::Paren) { let span = p.token.span; diff --git a/src/libsyntax/parse/parser/expr.rs b/src/libsyntax/parse/parser/expr.rs index d0c865a7b8e..c776704b285 100644 --- a/src/libsyntax/parse/parser/expr.rs +++ b/src/libsyntax/parse/parser/expr.rs @@ -210,7 +210,7 @@ impl<'a> Parser<'a> { // it refers to. Interpolated identifiers are unwrapped early and never show up here // as `PrevTokenKind::Interpolated` so if LHS is a single identifier we always process // it as "interpolated", it doesn't change the answer for non-interpolated idents. - let lhs_span = match (self.prev_token_kind, &lhs.node) { + let lhs_span = match (self.prev_token_kind, &lhs.kind) { (PrevTokenKind::Interpolated, _) => self.prev_span, (PrevTokenKind::Ident, &ExprKind::Path(None, ref path)) if path.segments.len() == 1 => self.prev_span, @@ -245,7 +245,7 @@ impl<'a> Parser<'a> { lhs = self.parse_assoc_op_cast(lhs, lhs_span, ExprKind::Cast)?; continue } else if op == AssocOp::Colon { - let maybe_path = self.could_ascription_be_path(&lhs.node); + let maybe_path = self.could_ascription_be_path(&lhs.kind); self.last_type_ascription = Some((self.prev_span, maybe_path)); lhs = self.parse_assoc_op_cast(lhs, lhs_span, ExprKind::Type)?; @@ -555,7 +555,7 @@ impl<'a> Parser<'a> { let span_after_type = parser_snapshot_after_type.token.span; let expr = mk_expr(self, P(Ty { span: path.span, - node: TyKind::Path(None, path), + kind: TyKind::Path(None, path), id: DUMMY_NODE_ID, })); @@ -614,7 +614,7 @@ impl<'a> Parser<'a> { expr.map(|mut expr| { attrs.extend::<Vec<_>>(expr.attrs.into()); expr.attrs = attrs; - match expr.node { + match expr.kind { ExprKind::If(..) if !expr.attrs.is_empty() => { // Just point to the first attribute in there... let span = expr.attrs[0].span; @@ -1190,7 +1190,7 @@ impl<'a> Parser<'a> { } else { P(Ty { id: DUMMY_NODE_ID, - node: TyKind::Infer, + kind: TyKind::Infer, span: self.prev_span, }) }; @@ -1242,7 +1242,7 @@ impl<'a> Parser<'a> { fn parse_cond_expr(&mut self) -> PResult<'a, P<Expr>> { let cond = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; - if let ExprKind::Let(..) = cond.node { + if let ExprKind::Let(..) = cond.kind { // Remove the last feature gating of a `let` expression since it's stable. let last = self.sess.gated_spans.let_chains.borrow_mut().pop(); debug_assert_eq!(cond.span, last.unwrap()); @@ -1779,7 +1779,7 @@ impl<'a> Parser<'a> { Ok(await_expr) } - crate fn mk_expr(&self, span: Span, node: ExprKind, attrs: ThinVec<Attribute>) -> P<Expr> { - P(Expr { node, span, attrs, id: DUMMY_NODE_ID }) + crate fn mk_expr(&self, span: Span, kind: ExprKind, attrs: ThinVec<Attribute>) -> P<Expr> { + P(Expr { kind, span, attrs, id: DUMMY_NODE_ID }) } } diff --git a/src/libsyntax/parse/parser/item.rs b/src/libsyntax/parse/parser/item.rs index 0d073f0cc97..370030d02c7 100644 --- a/src/libsyntax/parse/parser/item.rs +++ b/src/libsyntax/parse/parser/item.rs @@ -678,7 +678,7 @@ impl<'a> Parser<'a> { self.look_ahead(1, |t| t != &token::Lt) { let span = self.prev_span.between(self.token.span); self.struct_span_err(span, "missing trait in a trait impl").emit(); - P(Ty { node: TyKind::Path(None, err_path(span)), span, id: DUMMY_NODE_ID }) + P(Ty { kind: TyKind::Path(None, err_path(span)), span, id: DUMMY_NODE_ID }) } else { self.parse_ty()? }; @@ -715,7 +715,7 @@ impl<'a> Parser<'a> { } let ty_first = ty_first.into_inner(); - let path = match ty_first.node { + let path = match ty_first.kind { // This notably includes paths passed through `ty` macro fragments (#46438). TyKind::Path(None, path) => path, _ => { @@ -783,7 +783,7 @@ impl<'a> Parser<'a> { let lo = self.token.span; let vis = self.parse_visibility(false)?; let defaultness = self.parse_defaultness(); - let (name, node, generics) = if let Some(type_) = self.eat_type() { + let (name, kind, generics) = if let Some(type_) = self.eat_type() { let (name, alias, generics) = type_?; let kind = match alias { AliasKind::Weak(typ) => ast::ImplItemKind::TyAlias(typ), @@ -802,9 +802,9 @@ impl<'a> Parser<'a> { self.expect(&token::Semi)?; (name, ast::ImplItemKind::Const(typ, expr), Generics::default()) } else { - let (name, inner_attrs, generics, node) = self.parse_impl_method(&vis, at_end)?; + let (name, inner_attrs, generics, kind) = self.parse_impl_method(&vis, at_end)?; attrs.extend(inner_attrs); - (name, node, generics) + (name, kind, generics) }; Ok(ImplItem { @@ -815,7 +815,7 @@ impl<'a> Parser<'a> { defaultness, attrs, generics, - node, + kind, tokens: None, }) } @@ -1009,7 +1009,7 @@ impl<'a> Parser<'a> { mut attrs: Vec<Attribute>) -> PResult<'a, TraitItem> { let lo = self.token.span; self.eat_bad_pub(); - let (name, node, generics) = if self.eat_keyword(kw::Type) { + let (name, kind, generics) = if self.eat_keyword(kw::Type) { self.parse_trait_item_assoc_ty()? } else if self.is_const_item() { self.expect_keyword(kw::Const)?; @@ -1094,7 +1094,7 @@ impl<'a> Parser<'a> { ident: name, attrs, generics, - node, + kind, span: lo.to(self.prev_span), tokens: None, }) @@ -1383,7 +1383,7 @@ impl<'a> Parser<'a> { id: DUMMY_NODE_ID, attrs, vis: visibility, - node: ForeignItemKind::Macro(mac), + kind: ForeignItemKind::Macro(mac), } ) } @@ -1415,7 +1415,7 @@ impl<'a> Parser<'a> { Ok(ast::ForeignItem { ident, attrs, - node: ForeignItemKind::Fn(decl, generics), + kind: ForeignItemKind::Fn(decl, generics), id: DUMMY_NODE_ID, span: lo.to(hi), vis, @@ -1435,7 +1435,7 @@ impl<'a> Parser<'a> { Ok(ForeignItem { ident, attrs, - node: ForeignItemKind::Static(ty, mutbl), + kind: ForeignItemKind::Static(ty, mutbl), id: DUMMY_NODE_ID, span: lo.to(hi), vis, @@ -1453,7 +1453,7 @@ impl<'a> Parser<'a> { Ok(ast::ForeignItem { ident, attrs, - node: ForeignItemKind::Ty, + kind: ForeignItemKind::Ty, id: DUMMY_NODE_ID, span: lo.to(hi), vis @@ -1526,7 +1526,7 @@ impl<'a> Parser<'a> { // The user intended that the type be inferred, // so treat this as if the user wrote e.g. `const A: _ = expr;`. P(Ty { - node: TyKind::Infer, + kind: TyKind::Infer, span: id.span, id: ast::DUMMY_NODE_ID, }) @@ -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/parser/pat.rs b/src/libsyntax/parse/parser/pat.rs index 3c624959ead..de72f1c4d49 100644 --- a/src/libsyntax/parse/parser/pat.rs +++ b/src/libsyntax/parse/parser/pat.rs @@ -66,7 +66,7 @@ impl<'a> Parser<'a> { self.recover_leading_vert("not allowed in a parameter pattern"); let pat = self.parse_pat_with_or(PARAM_EXPECTED, GateOr::No, RecoverComma::No)?; - if let PatKind::Or(..) = &pat.node { + if let PatKind::Or(..) = &pat.kind { self.ban_illegal_fn_param_or_pat(&pat); } @@ -324,7 +324,7 @@ impl<'a> Parser<'a> { /// Ban a range pattern if it has an ambiguous interpretation. fn ban_pat_range_if_ambiguous(&self, pat: &Pat) -> PResult<'a, ()> { - match pat.node { + match pat.kind { PatKind::Range( .., Spanned { node: RangeEnd::Included(RangeSyntax::DotDotDot), .. } ) => return Ok(()), @@ -399,12 +399,12 @@ impl<'a> Parser<'a> { // Unwrap; If we don't have `mut $ident`, error. let pat = pat.into_inner(); - match &pat.node { + match &pat.kind { PatKind::Ident(..) => {} _ => self.ban_mut_general_pat(mut_span, &pat, changed_any_binding), } - Ok(pat.node) + Ok(pat.kind) } /// Recover on `mut ref? ident @ pat` and suggest @@ -430,7 +430,7 @@ impl<'a> Parser<'a> { impl MutVisitor for AddMut { fn visit_pat(&mut self, pat: &mut P<Pat>) { if let PatKind::Ident(BindingMode::ByValue(ref mut m @ Mutability::Immutable), ..) - = pat.node + = pat.kind { *m = Mutability::Mutable; self.0 = true; @@ -890,7 +890,7 @@ impl<'a> Parser<'a> { self.mk_pat(span, PatKind::Ident(bm, ident, None)) } - fn mk_pat(&self, span: Span, node: PatKind) -> P<Pat> { - P(Pat { node, span, id: ast::DUMMY_NODE_ID }) + fn mk_pat(&self, span: Span, kind: PatKind) -> P<Pat> { + P(Pat { kind, span, id: ast::DUMMY_NODE_ID }) } } diff --git a/src/libsyntax/parse/parser/path.rs b/src/libsyntax/parse/parser/path.rs index 87839f8c70e..463ae9124ca 100644 --- a/src/libsyntax/parse/parser/path.rs +++ b/src/libsyntax/parse/parser/path.rs @@ -114,7 +114,7 @@ impl<'a> Parser<'a> { pub fn parse_path_allowing_meta(&mut self, style: PathStyle) -> PResult<'a, Path> { let meta_ident = match self.token.kind { token::Interpolated(ref nt) => match **nt { - token::NtMeta(ref meta) => match meta.node { + token::NtMeta(ref meta) => match meta.kind { ast::MetaItemKind::Word => Some(meta.path.clone()), _ => None, }, diff --git a/src/libsyntax/parse/parser/stmt.rs b/src/libsyntax/parse/parser/stmt.rs index 02da56f6e35..855b03ddd6f 100644 --- a/src/libsyntax/parse/parser/stmt.rs +++ b/src/libsyntax/parse/parser/stmt.rs @@ -44,7 +44,7 @@ impl<'a> Parser<'a> { Ok(Some(if self.eat_keyword(kw::Let) { Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Local(self.parse_local(attrs.into())?), + kind: StmtKind::Local(self.parse_local(attrs.into())?), span: lo.to(self.prev_span), } } else if let Some(macro_def) = self.eat_macro_def( @@ -54,7 +54,7 @@ impl<'a> Parser<'a> { )? { Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Item(macro_def), + kind: StmtKind::Item(macro_def), span: lo.to(self.prev_span), } // Starts like a simple path, being careful to avoid contextual keywords @@ -86,7 +86,7 @@ impl<'a> Parser<'a> { return Ok(Some(Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Expr(expr), + kind: StmtKind::Expr(expr), span: lo.to(self.prev_span), })); } @@ -107,7 +107,7 @@ impl<'a> Parser<'a> { span: lo.to(hi), prior_type_ascription: self.last_type_ascription, }; - let node = if delim == MacDelimiter::Brace || + let kind = if delim == MacDelimiter::Brace || self.token == token::Semi || self.token == token::Eof { StmtKind::Mac(P((mac, style, attrs.into()))) } @@ -137,7 +137,7 @@ impl<'a> Parser<'a> { Stmt { id: DUMMY_NODE_ID, span: lo.to(hi), - node, + kind, } } else { // FIXME: Bad copy of attrs @@ -150,7 +150,7 @@ impl<'a> Parser<'a> { Some(i) => Stmt { id: DUMMY_NODE_ID, span: lo.to(i.span), - node: StmtKind::Item(i), + kind: StmtKind::Item(i), }, None => { let unused_attrs = |attrs: &[Attribute], s: &mut Self| { @@ -180,7 +180,7 @@ impl<'a> Parser<'a> { return Ok(Some(Stmt { id: DUMMY_NODE_ID, span: lo.to(last_semi), - node: StmtKind::Semi(self.mk_expr(lo.to(last_semi), + kind: StmtKind::Semi(self.mk_expr(lo.to(last_semi), ExprKind::Tup(Vec::new()), ThinVec::new() )), @@ -198,7 +198,7 @@ impl<'a> Parser<'a> { Stmt { id: DUMMY_NODE_ID, span: lo.to(e.span), - node: StmtKind::Expr(e), + kind: StmtKind::Expr(e), } } } @@ -400,7 +400,7 @@ impl<'a> Parser<'a> { self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore); Some(Stmt { id: DUMMY_NODE_ID, - node: StmtKind::Expr(DummyResult::raw_expr(self.token.span, true)), + kind: StmtKind::Expr(DummyResult::raw_expr(self.token.span, true)), span: self.token.span, }) } @@ -431,7 +431,7 @@ impl<'a> Parser<'a> { None => return Ok(None), }; - match stmt.node { + match stmt.kind { StmtKind::Expr(ref expr) if self.token != token::Eof => { // expression without semicolon if classify::expr_requires_semi_to_be_stmt(expr) { @@ -443,7 +443,7 @@ impl<'a> Parser<'a> { self.recover_stmt(); // Don't complain about type errors in body tail after parse error (#57383). let sp = expr.span.to(self.prev_span); - stmt.node = StmtKind::Expr(DummyResult::raw_expr(sp, true)); + stmt.kind = StmtKind::Expr(DummyResult::raw_expr(sp, true)); } } } diff --git a/src/libsyntax/parse/parser/ty.rs b/src/libsyntax/parse/parser/ty.rs index 5697edd8e48..b4c006ca2b1 100644 --- a/src/libsyntax/parse/parser/ty.rs +++ b/src/libsyntax/parse/parser/ty.rs @@ -55,7 +55,7 @@ impl<'a> Parser<'a> { let lo = self.token.span; let mut impl_dyn_multi = false; - let node = if self.eat(&token::OpenDelim(token::Paren)) { + let kind = if self.eat(&token::OpenDelim(token::Paren)) { // `(TYPE)` is a parenthesized type. // `(TYPE,)` is a tuple with a single field of type TYPE. let mut ts = vec![]; @@ -75,7 +75,7 @@ impl<'a> Parser<'a> { if ts.len() == 1 && !last_comma { let ty = ts.into_iter().nth(0).unwrap().into_inner(); let maybe_bounds = allow_plus && self.token.is_like_plus(); - match ty.node { + match ty.kind { // `(TY_BOUND_NOPAREN) + BOUND + ...`. TyKind::Path(None, ref path) if maybe_bounds => { self.parse_remaining_bounds(Vec::new(), path.clone(), lo, true)? @@ -211,7 +211,7 @@ impl<'a> Parser<'a> { }; let span = lo.to(self.prev_span); - let ty = P(Ty { node, span, id: ast::DUMMY_NODE_ID }); + let ty = P(Ty { kind, span, id: ast::DUMMY_NODE_ID }); // Try to recover from use of `+` with incorrect priority. self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty); diff --git a/src/libsyntax/parse/tests.rs b/src/libsyntax/parse/tests.rs index 5cb59b3f827..3bdb9227b4e 100644 --- a/src/libsyntax/parse/tests.rs +++ b/src/libsyntax/parse/tests.rs @@ -171,7 +171,7 @@ fn get_spans_of_pat_idents(src: &str) -> Vec<Span> { } impl<'a> crate::visit::Visitor<'a> for PatIdentVisitor { fn visit_pat(&mut self, p: &'a ast::Pat) { - match p.node { + match p.kind { PatKind::Ident(_ , ref ident, _) => { self.spans.push(ident.span.clone()); } @@ -272,7 +272,7 @@ fn ttdelim_span() { let expr = parse_expr_from_source_str(PathBuf::from("foo").into(), "foo!( fn main() { body } )".to_string(), &sess).unwrap(); - let tts: Vec<_> = match expr.node { + let tts: Vec<_> = match expr.kind { ast::ExprKind::Mac(ref mac) => mac.stream().trees().collect(), _ => panic!("not a macro"), }; @@ -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!(); |
