diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-06-24 04:33:58 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-06-24 04:37:54 -0400 |
| commit | cd5de49eaa522ee10c0e8a6b36a067791270dca2 (patch) | |
| tree | 0830a387e09bd481d69405596bb260ea58d8cfac /compiler/rustc_expand/src | |
| parent | b9e9be38c01104dd7e1a23995ef89995357bd35b (diff) | |
| download | rust-cd5de49eaa522ee10c0e8a6b36a067791270dca2.tar.gz rust-cd5de49eaa522ee10c0e8a6b36a067791270dca2.zip | |
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`.
Diffstat (limited to 'compiler/rustc_expand/src')
| -rw-r--r-- | compiler/rustc_expand/src/errors.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/mbe/quoted.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs index ec0af67c046..b697f2049bd 100644 --- a/compiler/rustc_expand/src/errors.rs +++ b/compiler/rustc_expand/src/errors.rs @@ -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)] diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs index 871b3e5e4de..2daa4e71558 100644 --- a/compiler/rustc_expand/src/mbe/quoted.rs +++ b/compiler/rustc_expand/src/mbe/quoted.rs @@ -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 { |
