]> git.lizzy.rs Git - rust.git/blob - src/test/ui/if-attrs/cfg-false-if-attr.rs
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.git] / src / test / ui / if-attrs / cfg-false-if-attr.rs
1 // check-pass
2
3 #[cfg(FALSE)]
4 fn simple_attr() {
5     #[attr] if true {}
6     #[allow_warnings] if true {}
7 }
8
9 #[cfg(FALSE)]
10 fn if_else_chain() {
11     #[first_attr] if true {
12     } else if false {
13     } else {
14     }
15 }
16
17 #[cfg(FALSE)]
18 fn if_let() {
19     #[attr] if let Some(_) = Some(true) {}
20 }
21
22 fn bar() {
23     #[cfg(FALSE)]
24     if true {
25         let x: () = true; // Should not error due to the #[cfg(FALSE)]
26     }
27
28     #[cfg_attr(not(unset_attr), cfg(FALSE))]
29     if true {
30         let a: () = true; // Should not error due to the applied #[cfg(FALSE)]
31     }
32 }
33
34 macro_rules! custom_macro {
35     ($expr:expr) => {}
36 }
37
38 custom_macro! {
39     #[attr] if true {}
40 }
41
42
43 fn main() {}