Suggest : when ; is used before a macro_rules! fragment specifier#153843
Suggest : when ; is used before a macro_rules! fragment specifier#153843ozankenangungor wants to merge 3 commits intorust-lang:mainfrom
: when ; is used before a macro_rules! fragment specifier#153843Conversation
|
r? @adwinwhite rustbot has assigned @adwinwhite. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
Could you update the PR description to reflect the latest changes? |
|
Updated the PR description to reflect the latest changes. |
| && let Some((fragment, _)) = frag_token.ident() | ||
| { | ||
| let span = frag_token.span.with_lo(start_sp.lo()); | ||
| let edition = || { |
There was a problem hiding this comment.
Could you move this closure upwards and reuse it for both branches?
| LL | ($x;ty) => {}; | ||
| | ^^ | ||
| | | ||
| = note: fragment specifiers must be provided |
There was a problem hiding this comment.
Give that we already check that a valid fragment specifier is provided, do you think it's better to use a separate independent diagnostics than MissingFragmentSpecifier?
We probably only need the typo help here.
|
Reminder, once the PR becomes ready for a review, use |
Closes #153320
Add a suggestion for the case where
;is written instead of:before a validmacro_rules!fragment specifier.For that semicolon typo case, this also removes the generic “try adding a specifier here” help and keeps the parsed fragment kind during recovery, so
$x;tyrecovers as$x:ty.