]> git.lizzy.rs Git - rust.git/blob - tests/ui/assertions_on_constants.rs
Auto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
[rust.git] / tests / ui / assertions_on_constants.rs
1 #![allow(non_fmt_panics)]
2
3 macro_rules! assert_const {
4     ($len:expr) => {
5         assert!($len > 0);
6         debug_assert!($len < 0);
7     };
8 }
9 fn main() {
10     assert!(true);
11     assert!(false);
12     assert!(true, "true message");
13     assert!(false, "false message");
14
15     let msg = "panic message";
16     assert!(false, "{}", msg.to_uppercase());
17
18     const B: bool = true;
19     assert!(B);
20
21     const C: bool = false;
22     assert!(C);
23     assert!(C, "C message");
24
25     debug_assert!(true);
26     // Don't lint this, since there is no better way for expressing "Only panic in debug mode".
27     debug_assert!(false); // #3948
28     assert_const!(3);
29     assert_const!(-1);
30
31     // Don't lint on this:
32     assert!(cfg!(feature = "hey") || cfg!(not(feature = "asdf")));
33 }