rust/tests/ui/const-generics/unused_braces.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
286 B
Rust
Raw Normal View History

2020-03-27 20:56:58 +00:00
//@ check-pass
2020-07-02 05:32:12 +00:00
//@ run-rustfix
2020-03-27 20:56:58 +00:00
#![warn(unused_braces)]
macro_rules! make_1 {
() => {
1
}
}
2020-03-27 20:56:58 +00:00
struct A<const N: usize>;
fn main() {
let _: A<7>; // ok
let _: A<{ 7 }>; //~ WARN unnecessary braces
let _: A<{ 3 + 5 }>; // ok
let _: A<{make_1!()}>; // ok
2020-03-27 20:56:58 +00:00
}