Skip to content

Commit d04413a

Browse files
committed
add uitest for issue 12816
1 parent 76b8434 commit d04413a

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

tests/ui/assertions_on_constants.rs

+6
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ fn main() {
5353
const N: usize = 1024;
5454
const _: () = assert!(N.is_power_of_two());
5555
}
56+
57+
#[allow(clippy::eq_op)]
58+
const _: () = {
59+
assert!(true);
60+
assert!(8 == (7 + 1));
61+
};

tests/ui/assertions_on_constants.stderr

+17-1
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,21 @@ LL | const _: () = assert!(true);
8080
|
8181
= help: remove it
8282

83-
error: aborting due to 10 previous errors
83+
error: `assert!(true)` will be optimized out by the compiler
84+
--> tests/ui/assertions_on_constants.rs:59:5
85+
|
86+
LL | assert!(true);
87+
| ^^^^^^^^^^^^^
88+
|
89+
= help: remove it
90+
91+
error: `assert!(true)` will be optimized out by the compiler
92+
--> tests/ui/assertions_on_constants.rs:60:5
93+
|
94+
LL | assert!(8 == (7 + 1));
95+
| ^^^^^^^^^^^^^^^^^^^^^
96+
|
97+
= help: remove it
98+
99+
error: aborting due to 12 previous errors
84100

0 commit comments

Comments
 (0)