Skip to content

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

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

Closed
cyrgani opened this issue Apr 7, 2025 · 1 comment · Fixed by #139628
Closed

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

cyrgani opened this issue Apr 7, 2025 · 1 comment · 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

ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 13, 2025
…rrors

Suggest remove redundant `$()?` around `vis`

Resolves: rust-lang#139480 .
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 13, 2025
…rrors

Suggest remove redundant `$()?` around `vis`

Resolves: rust-lang#139480 .
jhpratt added a commit to jhpratt/rust that referenced this issue Apr 13, 2025
…rrors

Suggest remove redundant `$()?` around `vis`

Resolves: rust-lang#139480 .
@bors bors closed this as completed in a04a037 Apr 14, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 14, 2025
Rollup merge of rust-lang#139628 - makai410:suggest-vis, r=compiler-errors

Suggest remove redundant `$()?` around `vis`

Resolves: rust-lang#139480 .
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