Skip to content

Commit 17726f6

Browse files
committed
Rename Lit.node to Lit.kind
1 parent ce6aabb commit 17726f6

File tree

17 files changed

+25
-25
lines changed

17 files changed

+25
-25
lines changed

src/librustc/hir/lowering/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl LoweringContext<'_> {
5454
let ohs = P(self.lower_expr(ohs));
5555
hir::ExprKind::Unary(op, ohs)
5656
}
57-
ExprKind::Lit(ref l) => hir::ExprKind::Lit(respan(l.span, l.node.clone())),
57+
ExprKind::Lit(ref l) => hir::ExprKind::Lit(respan(l.span, l.kind.clone())),
5858
ExprKind::Cast(ref expr, ref ty) => {
5959
let expr = P(self.lower_expr(expr));
6060
hir::ExprKind::Cast(expr, self.lower_ty(ty, ImplTraitContext::disallowed()))

src/librustc/ich/impls_syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl_stable_hash_for!(enum ::syntax::ast::LitIntType {
142142
});
143143

144144
impl_stable_hash_for!(struct ::syntax::ast::Lit {
145-
node,
145+
kind,
146146
token,
147147
span
148148
});

src/librustc/lint/levels.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl<'a> LintLevelsBuilder<'a> {
226226
metas = &metas[0..metas.len()-1];
227227
// FIXME (#55112): issue unused-attributes lint if we thereby
228228
// don't have any lint names (`#[level(reason = "foo")]`)
229-
if let ast::LitKind::Str(rationale, _) = name_value.node {
229+
if let ast::LitKind::Str(rationale, _) = name_value.kind {
230230
if !self.sess.features_untracked().lint_reasons {
231231
feature_gate::emit_feature_err(
232232
&self.sess.parse_sess,

src/librustc/session/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
18831883
MetaItemKind::List(..) => {
18841884
error!(r#"expected `key` or `key="value"`"#);
18851885
}
1886-
MetaItemKind::NameValue(lit) if !lit.node.is_str() => {
1886+
MetaItemKind::NameValue(lit) if !lit.kind.is_str() => {
18871887
error!("argument value must be a string");
18881888
}
18891889
MetaItemKind::NameValue(..) | MetaItemKind::Word => {

src/librustc/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ impl<'tcx> TyCtxt<'tcx> {
11501150
None => return Bound::Unbounded,
11511151
};
11521152
for meta in attr.meta_item_list().expect("rustc_layout_scalar_valid_range takes args") {
1153-
match meta.literal().expect("attribute takes lit").node {
1153+
match meta.literal().expect("attribute takes lit").kind {
11541154
ast::LitKind::Int(a, _) => return Bound::Included(a),
11551155
_ => span_bug!(attr.span, "rustc_layout_scalar_valid_range expects int arg"),
11561156
}

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl EarlyLintPass for WhileTrue {
7777
fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
7878
if let ast::ExprKind::While(cond, ..) = &e.kind {
7979
if let ast::ExprKind::Lit(ref lit) = pierce_parens(cond).kind {
80-
if let ast::LitKind::Bool(true) = lit.node {
80+
if let ast::LitKind::Bool(true) = lit.kind {
8181
if !lit.span.from_expansion() {
8282
let msg = "denote infinite loops with `loop { ... }`";
8383
let condition_span = cx.sess.source_map().def_span(e.span);

src/librustc_lint/nonstandard_style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
258258
.and_then(|attr| attr.meta())
259259
.and_then(|meta| {
260260
meta.name_value_literal().and_then(|lit| {
261-
if let ast::LitKind::Str(name, ..) = lit.node {
261+
if let ast::LitKind::Str(name, ..) = lit.kind {
262262
// Discard the double quotes surrounding the literal.
263263
let sp = cx.sess().source_map().span_to_snippet(lit.span)
264264
.ok()

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ fn args_required_const(tcx: TyCtxt<'_>, def_id: DefId) -> Option<FxHashSet<usize
17681768
let attr = attrs.iter().find(|a| a.check_name(sym::rustc_args_required_const))?;
17691769
let mut ret = FxHashSet::default();
17701770
for meta in attr.meta_item_list()? {
1771-
match meta.literal()?.node {
1771+
match meta.literal()?.kind {
17721772
LitKind::Int(a, _) => { ret.insert(a as usize); }
17731773
_ => return None,
17741774
}

src/librustdoc/clean/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Cfg {
7070
};
7171
match cfg.node {
7272
MetaItemKind::Word => Ok(Cfg::Cfg(name, None)),
73-
MetaItemKind::NameValue(ref lit) => match lit.node {
73+
MetaItemKind::NameValue(ref lit) => match lit.kind {
7474
LitKind::Str(value, _) => Ok(Cfg::Cfg(name, Some(value))),
7575
_ => Err(InvalidCfgError {
7676
// FIXME: if the main #[cfg] syntax decided to support non-string literals,

src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ pub struct Lit {
13611361
/// The "semantic" representation of the literal lowered from the original tokens.
13621362
/// Strings are unescaped, hexadecimal forms are eliminated, etc.
13631363
/// FIXME: Remove this and only create the semantic representation during lowering to HIR.
1364-
pub node: LitKind,
1364+
pub kind: LitKind,
13651365
pub span: Span,
13661366
}
13671367

src/libsyntax/attr/builtin.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl AttributeTemplate {
3636
match meta_item_kind {
3737
ast::MetaItemKind::Word => self.word,
3838
ast::MetaItemKind::List(..) => self.list.is_some(),
39-
ast::MetaItemKind::NameValue(lit) if lit.node.is_str() => self.name_value_str.is_some(),
39+
ast::MetaItemKind::NameValue(lit) if lit.kind.is_str() => self.name_value_str.is_some(),
4040
ast::MetaItemKind::NameValue(..) => false,
4141
}
4242
}
@@ -538,13 +538,13 @@ pub fn cfg_matches(cfg: &ast::MetaItem, sess: &ParseSess, features: Option<&Feat
538538
MetaItemKind::List(..) => {
539539
error(cfg.span, "unexpected parentheses after `cfg` predicate key")
540540
}
541-
MetaItemKind::NameValue(lit) if !lit.node.is_str() => {
541+
MetaItemKind::NameValue(lit) if !lit.kind.is_str() => {
542542
handle_errors(
543543
sess,
544544
lit.span,
545545
AttrError::UnsupportedLiteral(
546546
"literal in `cfg` predicate value must be a string",
547-
lit.node.is_bytestr()
547+
lit.kind.is_bytestr()
548548
),
549549
);
550550
true
@@ -668,7 +668,7 @@ fn find_deprecation_generic<'a, I>(sess: &ParseSess,
668668
AttrError::UnsupportedLiteral(
669669
"literal in `deprecated` \
670670
value must be a string",
671-
lit.node.is_bytestr()
671+
lit.kind.is_bytestr()
672672
),
673673
);
674674
} else {
@@ -811,14 +811,14 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
811811
let mut literal_error = None;
812812
if name == sym::align {
813813
recognised = true;
814-
match parse_alignment(&value.node) {
814+
match parse_alignment(&value.kind) {
815815
Ok(literal) => acc.push(ReprAlign(literal)),
816816
Err(message) => literal_error = Some(message)
817817
};
818818
}
819819
else if name == sym::packed {
820820
recognised = true;
821-
match parse_alignment(&value.node) {
821+
match parse_alignment(&value.kind) {
822822
Ok(literal) => acc.push(ReprPacked(literal)),
823823
Err(message) => literal_error = Some(message)
824824
};
@@ -834,7 +834,7 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
834834
recognised = true;
835835
let mut err = struct_span_err!(diagnostic, item.span(), E0693,
836836
"incorrect `repr(align)` attribute format");
837-
match value.node {
837+
match value.kind {
838838
ast::LitKind::Int(int, ast::LitIntType::Unsuffixed) => {
839839
err.span_suggestion(
840840
item.span(),

src/libsyntax/attr/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl MetaItem {
219219
pub fn value_str(&self) -> Option<Symbol> {
220220
match self.node {
221221
MetaItemKind::NameValue(ref v) => {
222-
match v.node {
222+
match v.kind {
223223
LitKind::Str(ref s, _) => Some(*s),
224224
_ => None,
225225
}

src/libsyntax/ext/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ pub fn expr_to_spanned_string<'a>(
10991099
let expr = cx.expander().fully_expand_fragment(AstFragment::Expr(expr)).make_expr();
11001100

11011101
Err(match expr.kind {
1102-
ast::ExprKind::Lit(ref l) => match l.node {
1102+
ast::ExprKind::Lit(ref l) => match l.kind {
11031103
ast::LitKind::Str(s, style) => return Ok((s, style, expr.span)),
11041104
ast::LitKind::Err(_) => None,
11051105
_ => Some(cx.struct_span_err(l.span, err_msg))

src/libsyntax/ext/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
15041504
// Check if the user erroneously used `doc(include(...))` syntax.
15051505
let literal = it.meta_item_list().and_then(|list| {
15061506
if list.len() == 1 {
1507-
list[0].literal().map(|literal| &literal.node)
1507+
list[0].literal().map(|literal| &literal.kind)
15081508
} else {
15091509
None
15101510
}

src/libsyntax/parse/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl<'a> Parser<'a> {
249249
let lit = self.parse_lit()?;
250250
debug!("checking if {:?} is unusuffixed", lit);
251251

252-
if !lit.node.is_unsuffixed() {
252+
if !lit.kind.is_unsuffixed() {
253253
let msg = "suffixed literals are not allowed in attributes";
254254
self.diagnostic().struct_span_err(lit.span, msg)
255255
.help("instead of using a suffixed literal \

src/libsyntax/parse/literal.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ impl LitKind {
255255
impl Lit {
256256
/// Converts literal token into an AST literal.
257257
fn from_lit_token(token: token::Lit, span: Span) -> Result<Lit, LitError> {
258-
Ok(Lit { token, node: LitKind::from_lit_token(token)?, span })
258+
Ok(Lit { token, kind: LitKind::from_lit_token(token)?, span })
259259
}
260260

261261
/// Converts arbitrary token into an AST literal.
@@ -282,8 +282,8 @@ impl Lit {
282282
/// Attempts to recover an AST literal from semantic literal.
283283
/// This function is used when the original token doesn't exist (e.g. the literal is created
284284
/// by an AST-based macro) or unavailable (e.g. from HIR pretty-printing).
285-
pub fn from_lit_kind(node: LitKind, span: Span) -> Lit {
286-
Lit { token: node.to_lit_token(), node, span }
285+
pub fn from_lit_kind(kind: LitKind, span: Span) -> Lit {
286+
Lit { token: kind.to_lit_token(), kind, span }
287287
}
288288

289289
/// Losslessly convert an AST literal into a token stream.

src/libsyntax_ext/concat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn expand_concat(
1919
let mut has_errors = false;
2020
for e in es {
2121
match e.kind {
22-
ast::ExprKind::Lit(ref lit) => match lit.node {
22+
ast::ExprKind::Lit(ref lit) => match lit.kind {
2323
ast::LitKind::Str(ref s, _)
2424
| ast::LitKind::Float(ref s, _)
2525
| ast::LitKind::FloatUnsuffixed(ref s) => {

0 commit comments

Comments
 (0)