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

[ER] Warn against unused braces for const value argument #83299

Open
leonardo-m opened this issue Mar 19, 2021 · 3 comments
Open

[ER] Warn against unused braces for const value argument #83299

leonardo-m opened this issue Mar 19, 2021 · 3 comments
Labels
A-const-generics Area: const generics (parameters and arguments) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@leonardo-m
Copy link

#![allow(dead_code)]
struct Foo<const N: usize> {
    data: [u32; N],
}
impl<const N: usize> Foo<{ N }> {
}
fn main() {}

Gives no warnings, but I expected a warning like:

warning: unnecessary braces around const value
 --> ...\test.rs:5:26
  |
5 | impl<const N: usize> Foo<{ N }> {
  |                          ^^^^^ help: remove these braces
  |
  = note: `#[warn(unused_braces)]` on by default
@osa1
Copy link
Contributor

osa1 commented Mar 19, 2021

Apparently this is a known issue:

// FIXME(const_generics): handle paths when #67075 is fixed.
blocked on #67075.

@leonardo-m
Copy link
Author

leonardo-m commented Mar 19, 2021

So do you suggest to close this issue down? Or do we keep this open to keep better memory of this little problem?

@osa1
Copy link
Contributor

osa1 commented Mar 20, 2021

I couldn't find an open issue for this FIXME so I think we can use this one as the tracking issue.

@JohnTitor JohnTitor added A-const-generics Area: const generics (parameters and arguments) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants