diff options
| author | varkor <github@varkor.com> | 2019-09-26 16:56:53 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-09-26 18:21:09 +0100 |
| commit | 17726f6b52b68279384cfb13209f015ab491c1c0 (patch) | |
| tree | 84cc1132b9b4fbe07aee481fc026ea91e4f81683 | |
| parent | ce6aabbaa19378ac621c2971934383a146176fec (diff) | |
| download | rust-17726f6b52b68279384cfb13209f015ab491c1c0.tar.gz rust-17726f6b52b68279384cfb13209f015ab491c1c0.zip | |
Rename `Lit.node` to `Lit.kind`
| -rw-r--r-- | src/librustc/hir/lowering/expr.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ich/impls_syntax.rs | 2 | ||||
| -rw-r--r-- | src/librustc/lint/levels.rs | 2 | ||||
| -rw-r--r-- | src/librustc/session/config.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 2 | ||||
| -rw-r--r-- | src/librustc_lint/builtin.rs | 2 | ||||
| -rw-r--r-- | src/librustc_lint/nonstandard_style.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/transform/qualify_consts.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/clean/cfg.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/attr/builtin.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/attr/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/literal.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax_ext/concat.rs | 2 |
17 files changed, 25 insertions, 25 deletions
diff --git a/src/librustc/hir/lowering/expr.rs b/src/librustc/hir/lowering/expr.rs index ba6164b2a11..caecc162c78 100644 --- a/src/librustc/hir/lowering/expr.rs +++ b/src/librustc/hir/lowering/expr.rs @@ -54,7 +54,7 @@ impl LoweringContext<'_> { let ohs = P(self.lower_expr(ohs)); hir::ExprKind::Unary(op, ohs) } - ExprKind::Lit(ref l) => hir::ExprKind::Lit(respan(l.span, l.node.clone())), + ExprKind::Lit(ref l) => hir::ExprKind::Lit(respan(l.span, l.kind.clone())), ExprKind::Cast(ref expr, ref ty) => { let expr = P(self.lower_expr(expr)); hir::ExprKind::Cast(expr, self.lower_ty(ty, ImplTraitContext::disallowed())) diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index a33181e5925..281c6c6c1ec 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -142,7 +142,7 @@ impl_stable_hash_for!(enum ::syntax::ast::LitIntType { }); impl_stable_hash_for!(struct ::syntax::ast::Lit { - node, + kind, token, span }); diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index cbc6dbdba7e..9c70cae8477 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -226,7 +226,7 @@ impl<'a> LintLevelsBuilder<'a> { metas = &metas[0..metas.len()-1]; // FIXME (#55112): issue unused-attributes lint if we thereby // don't have any lint names (`#[level(reason = "foo")]`) - if let ast::LitKind::Str(rationale, _) = name_value.node { + if let ast::LitKind::Str(rationale, _) = name_value.kind { if !self.sess.features_untracked().lint_reasons { feature_gate::emit_feature_err( &self.sess.parse_sess, diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index a9a20a92434..d45479f9cca 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1883,7 +1883,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String MetaItemKind::List(..) => { error!(r#"expected `key` or `key="value"`"#); } - MetaItemKind::NameValue(lit) if !lit.node.is_str() => { + MetaItemKind::NameValue(lit) if !lit.kind.is_str() => { error!("argument value must be a string"); } MetaItemKind::NameValue(..) | MetaItemKind::Word => { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b587250bf7c..972eae45d18 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1150,7 +1150,7 @@ impl<'tcx> TyCtxt<'tcx> { None => return Bound::Unbounded, }; for meta in attr.meta_item_list().expect("rustc_layout_scalar_valid_range takes args") { - match meta.literal().expect("attribute takes lit").node { + match meta.literal().expect("attribute takes lit").kind { ast::LitKind::Int(a, _) => return Bound::Included(a), _ => span_bug!(attr.span, "rustc_layout_scalar_valid_range expects int arg"), } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index b0ad90c65e0..cb335889e44 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -77,7 +77,7 @@ impl EarlyLintPass for WhileTrue { fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) { if let ast::ExprKind::While(cond, ..) = &e.kind { if let ast::ExprKind::Lit(ref lit) = pierce_parens(cond).kind { - if let ast::LitKind::Bool(true) = lit.node { + if let ast::LitKind::Bool(true) = lit.kind { if !lit.span.from_expansion() { let msg = "denote infinite loops with `loop { ... }`"; let condition_span = cx.sess.source_map().def_span(e.span); diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index ec4201570b1..0135d9d7e76 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -258,7 +258,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase { .and_then(|attr| attr.meta()) .and_then(|meta| { meta.name_value_literal().and_then(|lit| { - if let ast::LitKind::Str(name, ..) = lit.node { + if let ast::LitKind::Str(name, ..) = lit.kind { // Discard the double quotes surrounding the literal. let sp = cx.sess().source_map().span_to_snippet(lit.span) .ok() diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index abe2d2f4a54..7423a668f94 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1768,7 +1768,7 @@ fn args_required_const(tcx: TyCtxt<'_>, def_id: DefId) -> Option<FxHashSet<usize let attr = attrs.iter().find(|a| a.check_name(sym::rustc_args_required_const))?; let mut ret = FxHashSet::default(); for meta in attr.meta_item_list()? { - match meta.literal()?.node { + match meta.literal()?.kind { LitKind::Int(a, _) => { ret.insert(a as usize); } _ => return None, } diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index c3092cea983..ac8fb1f9e95 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -70,7 +70,7 @@ impl Cfg { }; match cfg.node { MetaItemKind::Word => Ok(Cfg::Cfg(name, None)), - MetaItemKind::NameValue(ref lit) => match lit.node { + MetaItemKind::NameValue(ref lit) => match lit.kind { LitKind::Str(value, _) => Ok(Cfg::Cfg(name, Some(value))), _ => Err(InvalidCfgError { // FIXME: if the main #[cfg] syntax decided to support non-string literals, diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 08268aa418a..0f1598ba722 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1361,7 +1361,7 @@ pub struct Lit { /// The "semantic" representation of the literal lowered from the original tokens. /// Strings are unescaped, hexadecimal forms are eliminated, etc. /// FIXME: Remove this and only create the semantic representation during lowering to HIR. - pub node: LitKind, + pub kind: LitKind, pub span: Span, } diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index b5037b75f79..ca314642d62 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -36,7 +36,7 @@ impl AttributeTemplate { match meta_item_kind { ast::MetaItemKind::Word => self.word, ast::MetaItemKind::List(..) => self.list.is_some(), - ast::MetaItemKind::NameValue(lit) if lit.node.is_str() => self.name_value_str.is_some(), + ast::MetaItemKind::NameValue(lit) if lit.kind.is_str() => self.name_value_str.is_some(), ast::MetaItemKind::NameValue(..) => false, } } @@ -538,13 +538,13 @@ pub fn cfg_matches(cfg: &ast::MetaItem, sess: &ParseSess, features: Option<&Feat MetaItemKind::List(..) => { error(cfg.span, "unexpected parentheses after `cfg` predicate key") } - MetaItemKind::NameValue(lit) if !lit.node.is_str() => { + MetaItemKind::NameValue(lit) if !lit.kind.is_str() => { handle_errors( sess, lit.span, AttrError::UnsupportedLiteral( "literal in `cfg` predicate value must be a string", - lit.node.is_bytestr() + lit.kind.is_bytestr() ), ); true @@ -668,7 +668,7 @@ fn find_deprecation_generic<'a, I>(sess: &ParseSess, AttrError::UnsupportedLiteral( "literal in `deprecated` \ value must be a string", - lit.node.is_bytestr() + lit.kind.is_bytestr() ), ); } else { @@ -811,14 +811,14 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> { let mut literal_error = None; if name == sym::align { recognised = true; - match parse_alignment(&value.node) { + match parse_alignment(&value.kind) { Ok(literal) => acc.push(ReprAlign(literal)), Err(message) => literal_error = Some(message) }; } else if name == sym::packed { recognised = true; - match parse_alignment(&value.node) { + match parse_alignment(&value.kind) { Ok(literal) => acc.push(ReprPacked(literal)), Err(message) => literal_error = Some(message) }; @@ -834,7 +834,7 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> { recognised = true; let mut err = struct_span_err!(diagnostic, item.span(), E0693, "incorrect `repr(align)` attribute format"); - match value.node { + match value.kind { ast::LitKind::Int(int, ast::LitIntType::Unsuffixed) => { err.span_suggestion( item.span(), diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 9d06b926f97..bba7532df2e 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -219,7 +219,7 @@ impl MetaItem { pub fn value_str(&self) -> Option<Symbol> { match self.node { MetaItemKind::NameValue(ref v) => { - match v.node { + match v.kind { LitKind::Str(ref s, _) => Some(*s), _ => None, } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 6af6027ba9d..22c07b2cf9c 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -1099,7 +1099,7 @@ pub fn expr_to_spanned_string<'a>( let expr = cx.expander().fully_expand_fragment(AstFragment::Expr(expr)).make_expr(); Err(match expr.kind { - ast::ExprKind::Lit(ref l) => match l.node { + ast::ExprKind::Lit(ref l) => match l.kind { ast::LitKind::Str(s, style) => return Ok((s, style, expr.span)), ast::LitKind::Err(_) => None, _ => Some(cx.struct_span_err(l.span, err_msg)) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ae342fef651..c538dc3f902 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1504,7 +1504,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { // Check if the user erroneously used `doc(include(...))` syntax. let literal = it.meta_item_list().and_then(|list| { if list.len() == 1 { - list[0].literal().map(|literal| &literal.node) + list[0].literal().map(|literal| &literal.kind) } else { None } diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index cf6151d17b1..4b2c329625b 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -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 \ diff --git a/src/libsyntax/parse/literal.rs b/src/libsyntax/parse/literal.rs index 973c54017b6..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. @@ -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_ext/concat.rs b/src/libsyntax_ext/concat.rs index ded8f2bc094..790fdad5b3f 100644 --- a/src/libsyntax_ext/concat.rs +++ b/src/libsyntax_ext/concat.rs @@ -19,7 +19,7 @@ pub fn expand_concat( let mut has_errors = false; for e in es { match e.kind { - ast::ExprKind::Lit(ref lit) => match lit.node { + ast::ExprKind::Lit(ref lit) => match lit.kind { ast::LitKind::Str(ref s, _) | ast::LitKind::Float(ref s, _) | ast::LitKind::FloatUnsuffixed(ref s) => { |
