Skip to content

Commit 12f6a42

Browse files
authored
Rollup merge of rust-lang#55945 - oli-obk:static_assert_arg_type, r=michaelwoerister
Ensure that the argument to `static_assert` is a `bool` cc @eddyb
2 parents ef2cbec + 65e6fdb commit 12f6a42

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/librustc_data_structures/macros.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
/// A simple static assertion macro. The first argument should be a unique
1212
/// ALL_CAPS identifier that describes the condition.
1313
#[macro_export]
14+
#[allow_internal_unstable]
1415
macro_rules! static_assert {
1516
($name:ident: $test:expr) => {
1617
// Use the bool to access an array such that if the bool is false, the access
1718
// is out-of-bounds.
1819
#[allow(dead_code)]
19-
static $name: () = [()][!$test as usize];
20+
static $name: () = [()][!($test: bool) as usize];
2021
}
2122
}

0 commit comments

Comments
 (0)