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``
This commit is contained in:
commit
2480e3bbc5
77 changed files with 152 additions and 159 deletions
|
@ -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}")?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue