Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$($v: vis)? should get suggestion to become $v: vis #139480

Open
cyrgani opened this issue Apr 7, 2025 · 1 comment · May be fixed by #139628
Open

$($v: vis)? should get suggestion to become $v: vis #139480

cyrgani opened this issue Apr 7, 2025 · 1 comment · May be fixed by #139628
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cyrgani
Copy link
Contributor

cyrgani commented Apr 7, 2025

Code

macro_rules! make_static {
    ($($v: vis)? $name: ident) => {
        $($v)? static $name: u32 = 0;
    };
}

Current output

error: repetition matches empty token tree
 --> src/lib.rs:2:7
  |
2 |     ($($v: vis)? $name: ident) => {
  |       ^^^^^^^^^

Desired output

error: repetition matches empty token tree
 --> src/lib.rs:2:7
  |
2 |     ($($v: vis)? $name: ident) => {
  |       ^^^^^^^^^
note: a `vis` fragment can already be empty
help: remove the `$(` and `)?`

Rationale and extra context

The current error is not very helpful and had be confused for quite some time.
@rustbot label D-terse

Other cases

Rust Version

1.88.0-nightly

(2025-04-06 2fa8b11f0933dae9b4e5)

Anything else?

No response

@cyrgani cyrgani added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 7, 2025
@rustbot rustbot added the D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. label Apr 7, 2025
@makai410
Copy link
Contributor

@rustbot claim

@makai410 makai410 linked a pull request Apr 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants