Skip to content

Suggest parenthesising multiple arguments to dbg!() #59763

New issue

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

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

Already on GitHub? # to your account

Closed
varkor opened this issue Apr 6, 2019 · 1 comment · Fixed by #59826
Closed

Suggest parenthesising multiple arguments to dbg!() #59763

varkor opened this issue Apr 6, 2019 · 1 comment · Fixed by #59826
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`

Comments

@varkor
Copy link
Member

varkor commented Apr 6, 2019

fn main() {
    dbg!(5, 10); // error: no rules expected the token `,`
}

It would be nice if the compiler suggested the intended form: dbg!((5, 10)) as this seems like a reasonable mistake. This is specific to a particular macro, though, so I'm not sure how flexible we can be with diagnostics here.

@varkor varkor added A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Apr 6, 2019
@Centril
Copy link
Contributor

Centril commented Apr 7, 2019

Or we could just make the macro accept dbg!(5, 10)...

bors added a commit that referenced this issue Apr 20, 2019
allow multiple args to `dbg!(..)`

This closes #59763
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants