add uitest for issue 12816

This commit is contained in:
Lzu Tao 2024-05-24 10:37:19 +07:00
parent 2c61b45576
commit e18b27aa2a
2 changed files with 23 additions and 1 deletions

View File

@ -53,3 +53,9 @@ fn main() {
const N: usize = 1024;
const _: () = assert!(N.is_power_of_two());
}
#[allow(clippy::eq_op)]
const _: () = {
assert!(true);
assert!(8 == (7 + 1));
};

View File

@ -80,5 +80,21 @@ LL | const _: () = assert!(true);
|
= help: remove it
error: aborting due to 10 previous errors
error: `assert!(true)` will be optimized out by the compiler
--> tests/ui/assertions_on_constants.rs:59:5
|
LL | assert!(true);
| ^^^^^^^^^^^^^
|
= help: remove it
error: `assert!(true)` will be optimized out by the compiler
--> tests/ui/assertions_on_constants.rs:60:5
|
LL | assert!(8 == (7 + 1));
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: remove it
error: aborting due to 12 previous errors