Skip to content

Commit 9883a7c

Browse files
committed
Remove suffix from MetaItemLit and StrLit
1 parent 7ee35b1 commit 9883a7c

File tree

6 files changed

+4
-13
lines changed

6 files changed

+4
-13
lines changed

compiler/rustc_ast/src/ast.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1760,8 +1760,6 @@ pub enum StrStyle {
17601760
pub struct MetaItemLit {
17611761
/// The original literal as written in the source code.
17621762
pub symbol: Symbol,
1763-
/// The original suffix as written in the source code.
1764-
pub suffix: Option<Symbol>,
17651763
/// The "semantic" representation of the literal lowered from the original tokens.
17661764
/// Strings are unescaped, hexadecimal forms are eliminated, etc.
17671765
pub kind: LitKind,
@@ -1773,8 +1771,6 @@ pub struct MetaItemLit {
17731771
pub struct StrLit {
17741772
/// The original literal as written in source code.
17751773
pub symbol: Symbol,
1776-
/// The original suffix as written in source code.
1777-
pub suffix: Option<Symbol>,
17781774
/// The semantic (unescaped) representation of the literal.
17791775
pub symbol_unescaped: Symbol,
17801776
pub style: StrStyle,
@@ -1787,7 +1783,7 @@ impl StrLit {
17871783
StrStyle::Cooked => token::Str,
17881784
StrStyle::Raw(n) => token::StrRaw(n),
17891785
};
1790-
token::Lit::new(token_kind, self.symbol, self.suffix)
1786+
token::Lit::new(token_kind, self.symbol, None)
17911787
}
17921788
}
17931789

@@ -3292,7 +3288,7 @@ mod size_asserts {
32923288
static_assert_size!(Block, 32);
32933289
static_assert_size!(Expr, 72);
32943290
static_assert_size!(ExprKind, 40);
3295-
static_assert_size!(Fn, 160);
3291+
static_assert_size!(Fn, 152);
32963292
static_assert_size!(ForeignItem, 96);
32973293
static_assert_size!(ForeignItemKind, 24);
32983294
static_assert_size!(GenericArg, 24);

compiler/rustc_ast/src/util/literal.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ impl MetaItemLit {
218218
pub fn from_token_lit(token_lit: token::Lit, span: Span) -> Result<MetaItemLit, LitError> {
219219
Ok(MetaItemLit {
220220
symbol: token_lit.symbol,
221-
suffix: token_lit.suffix,
222221
kind: LitKind::from_token_lit(token_lit)?,
223222
span,
224223
})
@@ -241,7 +240,7 @@ impl MetaItemLit {
241240
LitKind::Err => token::Err,
242241
};
243242

244-
token::Lit::new(kind, self.symbol, self.suffix)
243+
token::Lit::new(kind, self.symbol, self.kind.suffix())
245244
}
246245

247246
/// Converts an arbitrary token into meta item literal.

compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
968968
} else {
969969
MetaItemLit {
970970
symbol: kw::Empty,
971-
suffix: None,
972971
kind: LitKind::Err,
973972
span: DUMMY_SP,
974973
}

compiler/rustc_parse/src/parser/expr.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,6 @@ impl<'a> Parser<'a> {
20082008
ast::LitKind::Str(symbol_unescaped, style) => Ok(ast::StrLit {
20092009
style,
20102010
symbol: lit.symbol,
2011-
suffix: lit.suffix,
20122011
span: lit.span,
20132012
symbol_unescaped,
20142013
}),
@@ -2025,7 +2024,6 @@ impl<'a> Parser<'a> {
20252024
fn mk_meta_item_lit_char(name: Symbol, span: Span) -> MetaItemLit {
20262025
ast::MetaItemLit {
20272026
symbol: name,
2028-
suffix: None,
20292027
kind: ast::LitKind::Char(name.as_str().chars().next().unwrap_or('_')),
20302028
span,
20312029
}

compiler/rustc_parse/src/validate_attr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ pub fn parse_meta<'a>(sess: &'a ParseSess, attr: &Attribute) -> PResult<'a, Meta
7373
report_lit_error(sess, err, token_lit, expr.span);
7474
let lit = ast::MetaItemLit {
7575
symbol: token_lit.symbol,
76-
suffix: token_lit.suffix,
7776
kind: ast::LitKind::Err,
7877
span: expr.span,
7978
};

src/tools/clippy/clippy_utils/src/ast_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ pub fn eq_ext(l: &Extern, r: &Extern) -> bool {
723723
}
724724

725725
pub fn eq_str_lit(l: &StrLit, r: &StrLit) -> bool {
726-
l.style == r.style && l.symbol == r.symbol && l.suffix == r.suffix
726+
l.style == r.style && l.symbol == r.symbol
727727
}
728728

729729
pub fn eq_poly_ref_trait(l: &PolyTraitRef, r: &PolyTraitRef) -> bool {

0 commit comments

Comments
 (0)