diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-30 06:40:36 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-30 06:40:36 +0100 | 
| commit | 2480e3bbc5c74717dbc9475edef58d492e443deb (patch) | |
| tree | 14ef7cffbba6c3c1feff479e1b2f85742271a2a9 /compiler/rustc_expand/src/mbe/macro_parser.rs | |
| parent | af33bc3ec05c84be1ab9b9114cf9d3ae589d60a1 (diff) | |
| parent | dd2b027d5d509dd95c5ef6f83ea6283f3e98d5ed (diff) | |
| download | rust-2480e3bbc5c74717dbc9475edef58d492e443deb.tar.gz rust-2480e3bbc5c74717dbc9475edef58d492e443deb.zip | |
Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebank
Use `token_descr` more in error messages This is the first two commits from #124141, put into their own PR to get things rolling. Commit messages have the details. r? ``@estebank`` cc ``@petrochenkov``
Diffstat (limited to 'compiler/rustc_expand/src/mbe/macro_parser.rs')
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_parser.rs | 5 | 
1 files changed, 2 insertions, 3 deletions
| diff --git a/compiler/rustc_expand/src/mbe/macro_parser.rs b/compiler/rustc_expand/src/mbe/macro_parser.rs index a08db612bbe..2a8dddc1e00 100644 --- a/compiler/rustc_expand/src/mbe/macro_parser.rs +++ b/compiler/rustc_expand/src/mbe/macro_parser.rs @@ -78,11 +78,10 @@ use std::rc::Rc; pub(crate) use NamedMatch::*; pub(crate) use ParseResult::*; use rustc_ast::token::{self, DocComment, NonterminalKind, Token}; -use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashMap; use rustc_errors::ErrorGuaranteed; use rustc_lint_defs::pluralize; -use rustc_parse::parser::{ParseNtResult, Parser}; +use rustc_parse::parser::{ParseNtResult, Parser, token_descr}; use rustc_span::Span; use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent}; @@ -150,7 +149,7 @@ impl Display for MatcherLoc { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { MatcherLoc::Token { token } | MatcherLoc::SequenceSep { separator: token } => { - write!(f, "`{}`", pprust::token_to_string(token)) + write!(f, "{}", token_descr(token)) } MatcherLoc::MetaVarDecl { bind, kind, .. } => { write!(f, "meta-variable `${bind}")?; | 
