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`.
This commit is contained in:
Trevor Gross 2025-06-24 04:33:58 -04:00
parent b9e9be38c0
commit cd5de49eaa
2 changed files with 3 additions and 3 deletions

View file

@ -444,7 +444,7 @@ pub(crate) struct InvalidFragmentSpecifier {
#[primary_span]
pub span: Span,
pub fragment: Ident,
pub help: String,
pub help: &'static str,
}
#[derive(Diagnostic)]

View file

@ -117,9 +117,9 @@ pub(super) fn parse(
sess.dcx().emit_err(errors::InvalidFragmentSpecifier {
span,
fragment,
help: VALID_FRAGMENT_NAMES_MSG.into(),
help: VALID_FRAGMENT_NAMES_MSG,
});
NonterminalKind::Ident
NonterminalKind::TT
});
result.push(TokenTree::MetaVarDecl { span, name: ident, kind });
} else {