Skip to content

Commit 65e6fdb

Browse files
committed
Ensure that the static_assert! argument is a bool
1 parent 6b9b97b commit 65e6fdb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/librustc_data_structures/macros.rs

Lines changed: 2 additions & 1 deletion
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)