Skip to content

Commit 1b681d6

Browse files
committed
Test that cfg-gated if-exprs are not type-checked
1 parent 7f19358 commit 1b681d6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/ui/if-attrs/cfg-false-if-attr.rs

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ fn if_let() {
1919
#[attr] if let Some(_) = Some(true) {}
2020
}
2121

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+
2234
macro_rules! custom_macro {
2335
($expr:expr) => {}
2436
}

0 commit comments

Comments
 (0)