summary refs log tree commit diff
path: root/tests/ui/cfg/diagnostics-same-crate.stderr
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-02 05:09:31 +0000
committerbors <bors@rust-lang.org>2025-08-02 05:09:31 +0000
commit889701db1ff614160314734fe4138c2f820a95bb (patch)
tree73cf71993bf2f50f9f20e0013c86c41a969d947b /tests/ui/cfg/diagnostics-same-crate.stderr
parentc23f07d8c56c51b5e634bda55daca2b073306340 (diff)
parent4b24c4bf23df8ae5c53669e3209b9f3074769b69 (diff)
downloadrust-889701db1ff614160314734fe4138c2f820a95bb.tar.gz
rust-889701db1ff614160314734fe4138c2f820a95bb.zip
Auto merge of #129183 - estebank:cfg-visitor, r=davidtwco
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/cfg/diagnostics-same-crate.stderr')
-rw-r--r--tests/ui/cfg/diagnostics-same-crate.stderr52
1 files changed, 24 insertions, 28 deletions
diff --git a/tests/ui/cfg/diagnostics-same-crate.stderr b/tests/ui/cfg/diagnostics-same-crate.stderr
index 121f25ca090..a8d789e61d1 100644
--- a/tests/ui/cfg/diagnostics-same-crate.stderr
+++ b/tests/ui/cfg/diagnostics-same-crate.stderr
@@ -7,13 +7,11 @@ LL |     use super::inner::doesnt_exist;
 note: found an item that was configured out
   --> $DIR/diagnostics-same-crate.rs:11:13
    |
+LL |     #[cfg(false)]
+   |           ----- the item is gated here
+...
 LL |     pub mod doesnt_exist {
    |             ^^^^^^^^^^^^
-note: the item is gated here
-  --> $DIR/diagnostics-same-crate.rs:8:11
-   |
-LL |     #[cfg(false)]
-   |           ^^^^^
 
 error[E0432]: unresolved import `super::inner::doesnt_exist`
   --> $DIR/diagnostics-same-crate.rs:35:23
@@ -24,16 +22,14 @@ LL |     use super::inner::doesnt_exist::hi;
 note: found an item that was configured out
   --> $DIR/diagnostics-same-crate.rs:11:13
    |
+LL |     #[cfg(false)]
+   |           ----- the item is gated here
+...
 LL |     pub mod doesnt_exist {
    |             ^^^^^^^^^^^^
-note: the item is gated here
-  --> $DIR/diagnostics-same-crate.rs:8:11
-   |
-LL |     #[cfg(false)]
-   |           ^^^^^
 
 error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner`
-  --> $DIR/diagnostics-same-crate.rs:54:12
+  --> $DIR/diagnostics-same-crate.rs:53:12
    |
 LL |     inner::doesnt_exist::hello();
    |            ^^^^^^^^^^^^ could not find `doesnt_exist` in `inner`
@@ -41,13 +37,11 @@ LL |     inner::doesnt_exist::hello();
 note: found an item that was configured out
   --> $DIR/diagnostics-same-crate.rs:11:13
    |
+LL |     #[cfg(false)]
+   |           ----- the item is gated here
+...
 LL |     pub mod doesnt_exist {
    |             ^^^^^^^^^^^^
-note: the item is gated here
-  --> $DIR/diagnostics-same-crate.rs:8:11
-   |
-LL |     #[cfg(false)]
-   |           ^^^^^
 
 error[E0425]: cannot find function `uwu` in module `inner`
   --> $DIR/diagnostics-same-crate.rs:49:12
@@ -58,16 +52,13 @@ LL |     inner::uwu();
 note: found an item that was configured out
   --> $DIR/diagnostics-same-crate.rs:5:12
    |
+LL |     #[cfg(false)]
+   |           ----- the item is gated here
 LL |     pub fn uwu() {}
    |            ^^^
-note: the item is gated here
-  --> $DIR/diagnostics-same-crate.rs:4:11
-   |
-LL |     #[cfg(false)]
-   |           ^^^^^
 
 error[E0425]: cannot find function `meow` in module `inner::right`
-  --> $DIR/diagnostics-same-crate.rs:58:19
+  --> $DIR/diagnostics-same-crate.rs:57:19
    |
 LL |     inner::right::meow();
    |                   ^^^^ not found in `inner::right`
@@ -75,13 +66,10 @@ LL |     inner::right::meow();
 note: found an item that was configured out
   --> $DIR/diagnostics-same-crate.rs:26:16
    |
+LL |         #[cfg(feature = "what-a-cool-feature")]
+   |               ------------------------------- the item is gated behind the `what-a-cool-feature` feature
 LL |         pub fn meow() {}
    |                ^^^^
-note: the item is gated behind the `what-a-cool-feature` feature
-  --> $DIR/diagnostics-same-crate.rs:25:15
-   |
-LL |         #[cfg(feature = "what-a-cool-feature")]
-   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0425]: cannot find function `uwu` in this scope
   --> $DIR/diagnostics-same-crate.rs:45:5
@@ -90,10 +78,18 @@ LL |     uwu();
    |     ^^^ not found in this scope
 
 error[E0425]: cannot find function `vanished` in this scope
-  --> $DIR/diagnostics-same-crate.rs:64:5
+  --> $DIR/diagnostics-same-crate.rs:62:5
    |
 LL |     vanished();
    |     ^^^^^^^^ not found in this scope
+   |
+note: found an item that was configured out
+  --> $DIR/diagnostics-same-crate.rs:41:8
+   |
+LL | #[cfg(i_dont_exist_and_you_can_do_nothing_about_it)]
+   |       -------------------------------------------- the item is gated here
+LL | pub fn vanished() {}
+   |        ^^^^^^^^
 
 error: aborting due to 7 previous errors