Skip to content

Commit cd5de49

Browse files
committed
mbe: Use TokenTree as the fallback for invalid fragment specifiers
`tt` should match more, so use this for both missing and invalid fragment specifiers. Also remove one unneeded instance of `String`.
1 parent b9e9be3 commit cd5de49

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/rustc_expand/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ pub(crate) struct InvalidFragmentSpecifier {
444444
#[primary_span]
445445
pub span: Span,
446446
pub fragment: Ident,
447-
pub help: String,
447+
pub help: &'static str,
448448
}
449449

450450
#[derive(Diagnostic)]

compiler/rustc_expand/src/mbe/quoted.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ pub(super) fn parse(
117117
sess.dcx().emit_err(errors::InvalidFragmentSpecifier {
118118
span,
119119
fragment,
120-
help: VALID_FRAGMENT_NAMES_MSG.into(),
120+
help: VALID_FRAGMENT_NAMES_MSG,
121121
});
122-
NonterminalKind::Ident
122+
NonterminalKind::TT
123123
});
124124
result.push(TokenTree::MetaVarDecl { span, name: ident, kind });
125125
} else {

0 commit comments

Comments
 (0)