mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-29 12:04:20 +00:00
Use a visitor to collect *all* items (including those nested) that were stripped behind a `cfg` condition.
```
error[E0425]: cannot find function `f` in this scope
--> $DIR/nested-cfg-attrs.rs:4:13
|
LL | fn main() { f() }
| ^ not found in this scope
|
note: found an item that was configured out
--> $DIR/nested-cfg-attrs.rs:2:4
|
LL | fn f() {}
| ^
note: the item is gated here
--> $DIR/nested-cfg-attrs.rs:1:35
|
LL | #[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))]
| ^^^^^^^^^^
```
11 lines
299 B
Rust
11 lines
299 B
Rust
//@ compile-flags: --cfg foo --check-cfg=cfg(foo,bar)
|
|
|
|
#[cfg(all(foo, bar))] // foo AND bar
|
|
//~^ NOTE the item is gated here
|
|
fn foo() {} //~ NOTE found an item that was configured out
|
|
|
|
fn main() {
|
|
foo(); //~ ERROR cannot find function `foo` in this scope
|
|
//~^ NOTE not found in this scope
|
|
}
|