Closed
Description
Const generics, combined with the cfg!
macro gives an "unnecessary braces" warning. However, removing the braces results in a compilation failure.
Example:
https://rust.godbolt.org/z/Kv8Eq5hzn
I expect no warning to be emitted for the following code:
pub fn foo<const BAR: bool> () {}
pub fn main() {
// warning: unnecessary braces around const expression
foo::<{cfg!(feature = "foo")}>();
}
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Diagnostics: A diagnostic that is giving misleading or incorrect information.Relevant to the compiler team, which will review and decide on the PR/issue.