diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-08-17 05:45:10 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-08-01 21:50:36 +0000 |
| commit | adcda6ca9a6d27c04399e3efe1c67fc6ff04d997 (patch) | |
| tree | 15c6ab8c0c8f03ff178999ee76e0865189e62288 /tests/ui/rustdoc/cfg-rustdoc.rs | |
| parent | e5e79f8bd428d0b8d26e8240d718b134ef297459 (diff) | |
| download | rust-adcda6ca9a6d27c04399e3efe1c67fc6ff04d997.tar.gz rust-adcda6ca9a6d27c04399e3efe1c67fc6ff04d997.zip | |
Detect more `cfg`d out items in resolution errors
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)))]
| ^^^^^^^^^^
```
Diffstat (limited to 'tests/ui/rustdoc/cfg-rustdoc.rs')
| -rw-r--r-- | tests/ui/rustdoc/cfg-rustdoc.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/ui/rustdoc/cfg-rustdoc.rs b/tests/ui/rustdoc/cfg-rustdoc.rs index dd8e1ed97c4..11c48d07552 100644 --- a/tests/ui/rustdoc/cfg-rustdoc.rs +++ b/tests/ui/rustdoc/cfg-rustdoc.rs @@ -1,6 +1,7 @@ -#[cfg(doc)] -pub struct Foo; +#[cfg(doc)] //~ NOTE the item is gated here +pub struct Foo; //~ NOTE found an item that was configured out fn main() { - let f = Foo; //~ ERROR + let f = Foo; //~ ERROR cannot find value `Foo` in this scope + //~^ NOTE not found in this scope } |
