diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-11-29 13:36:00 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-12-02 13:49:19 +1100 |
| commit | 2fd364acff5f962b0ce4f4dffb5ae085d5f2b67a (patch) | |
| tree | 041c2e45d4449c44f874c737a3dcdbcaa8895c9f /compiler/rustc_parse/src/parser/pat.rs | |
| parent | a7f35c42d474f893c56b6e0f7df3f8bb965f2650 (diff) | |
| download | rust-2fd364acff5f962b0ce4f4dffb5ae085d5f2b67a.tar.gz rust-2fd364acff5f962b0ce4f4dffb5ae085d5f2b67a.zip | |
Remove `token::Lit` from `ast::MetaItemLit`.
`token::Lit` contains a `kind` field that indicates what kind of literal it is. `ast::MetaItemLit` currently wraps a `token::Lit` but also has its own `kind` field. This means that `ast::MetaItemLit` encodes the literal kind in two different ways. This commit changes `ast::MetaItemLit` so it no longer wraps `token::Lit`. It now contains the `symbol` and `suffix` fields from `token::Lit`, but not the `kind` field, eliminating the redundancy.
Diffstat (limited to 'compiler/rustc_parse/src/parser/pat.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index cbeec951e2d..b5147158f70 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -420,7 +420,7 @@ impl<'a> Parser<'a> { err.span_label(self_.token.span, format!("expected {}", expected)); err }); - PatKind::Lit(self.mk_expr(lo, ExprKind::Lit(lit.token_lit))) + PatKind::Lit(self.mk_expr(lo, ExprKind::Lit(lit.as_token_lit()))) } else { // Try to parse everything else as literal with optional minus match self.parse_literal_maybe_minus() { |
