Skip to content

Commit e5f5bbb

Browse files
committed
docs formatted stderr | nested-cfg-attrs.rs
1 parent 6a78240 commit e5f5bbb

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1+
//! Test that nested `cfg_attr` attributes work correctly for conditional compilation.
2+
//! This checks that `cfg_attr` can be arbitrarily deeply nested and that the
3+
//! expansion works from outside to inside, eventually applying the innermost
4+
//! conditional compilation directive.
5+
//!
6+
//! In this test, `cfg_attr(all(), cfg_attr(all(), cfg(false)))` should expand to:
7+
//! 1. `cfg_attr(all(), cfg(false))` (outer cfg_attr applied)
8+
//! 2. `cfg(false)` (inner cfg_attr applied)
9+
//! 3. Function `f` is excluded from compilation
10+
//!
11+
//! Regression test for <https://github.com/rust-lang/rust/pull/34216>.
12+
113
#[cfg_attr(all(), cfg_attr(all(), cfg(false)))]
214
fn f() {}
315

4-
fn main() { f() } //~ ERROR cannot find function `f` in this scope
16+
fn main() {
17+
f() //~ ERROR cannot find function `f` in this scope
18+
}

tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0425]: cannot find function `f` in this scope
2-
--> $DIR/nested-cfg-attrs.rs:4:13
2+
--> $DIR/nested-cfg-attr-conditional-compilation.rs:17:5
33
|
4-
LL | fn main() { f() }
5-
| ^ not found in this scope
4+
LL | f()
5+
| ^ not found in this scope
66

77
error: aborting due to 1 previous error
88

0 commit comments

Comments
 (0)