summary refs log tree commit diff
path: root/tests/ui/macros/macro-outer-attributes.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/macros/macro-outer-attributes.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/macros/macro-outer-attributes.stderr')
-rw-r--r--tests/ui/macros/macro-outer-attributes.stderr7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/ui/macros/macro-outer-attributes.stderr b/tests/ui/macros/macro-outer-attributes.stderr
index 9215754d4bb..4696bb774e3 100644
--- a/tests/ui/macros/macro-outer-attributes.stderr
+++ b/tests/ui/macros/macro-outer-attributes.stderr
@@ -7,13 +7,10 @@ LL |     a::bar();
 note: found an item that was configured out
   --> $DIR/macro-outer-attributes.rs:9:14
    |
+LL |       #[cfg(false)],
+   |             ----- the item is gated here
 LL |       pub fn bar() { });
    |              ^^^
-note: the item is gated here
-  --> $DIR/macro-outer-attributes.rs:8:13
-   |
-LL |       #[cfg(false)],
-   |             ^^^^^
 help: consider importing this function
    |
 LL + use b::bar;