summary refs log tree commit diff
path: root/tests/ui/conditional-compilation/test-cfg.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/conditional-compilation/test-cfg.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/conditional-compilation/test-cfg.stderr')
-rw-r--r--tests/ui/conditional-compilation/test-cfg.stderr11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/ui/conditional-compilation/test-cfg.stderr b/tests/ui/conditional-compilation/test-cfg.stderr
index 9715f16acc2..379456f74b1 100644
--- a/tests/ui/conditional-compilation/test-cfg.stderr
+++ b/tests/ui/conditional-compilation/test-cfg.stderr
@@ -1,8 +1,17 @@
 error[E0425]: cannot find function `foo` in this scope
-  --> $DIR/test-cfg.rs:7:5
+  --> $DIR/test-cfg.rs:8:5
    |
 LL |     foo();
    |     ^^^ not found in this scope
+   |
+note: found an item that was configured out
+  --> $DIR/test-cfg.rs:5:4
+   |
+LL | #[cfg(all(foo, bar))] // foo AND bar
+   |                --- the item is gated here
+LL |
+LL | fn foo() {}
+   |    ^^^
 
 error: aborting due to 1 previous error