Skip to content

Commit 407f9a4

Browse files
Ensure consts get compared at runtime
1 parent cbc14a2 commit 407f9a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/ui/consts/const-float-bits-conv.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1+
// -Zmir-opt-level=0
12
// run-pass
23

34
#![feature(const_panic)]
45
#![feature(const_if_match)]
56
#![feature(const_float_bits_conv)]
67

8+
// Don't promote
9+
const fn nop<T>(x: T) -> T { x }
10+
711
macro_rules! const_assert {
812
($a:expr) => {
913
{
1014
const _: () = assert!($a);
11-
assert!($a);
15+
assert!(nop($a));
1216
}
1317
};
1418
($a:expr, $b:expr) => {
1519
{
1620
const _: () = assert!($a == $b);
17-
assert_eq!($a, $b);
21+
assert_eq!(nop($a), nop($b));
1822
}
1923
};
2024
}

0 commit comments

Comments
 (0)