Skip to content

Commit 2a1d23c

Browse files
committed
moved renamed docs formatted | inner-attrs-on-impl.rs
1 parent fd50e10 commit 2a1d23c

File tree

2 files changed

+36
-24
lines changed

2 files changed

+36
-24
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//! Test inner attributes (#![...]) behavior in impl blocks with cfg conditions.
2+
//!
3+
//! This test verifies that:
4+
//! - Inner attributes can conditionally exclude entire impl blocks
5+
//! - Regular attributes within impl blocks work independently
6+
//! - Attribute parsing doesn't consume too eagerly
7+
8+
//@ run-pass
9+
10+
struct Foo;
11+
12+
impl Foo {
13+
#![cfg(false)]
14+
15+
fn method(&self) -> bool {
16+
false
17+
}
18+
}
19+
20+
impl Foo {
21+
#![cfg(not(FALSE))]
22+
23+
// Check that we don't eat attributes too eagerly.
24+
#[cfg(false)]
25+
fn method(&self) -> bool {
26+
false
27+
}
28+
29+
fn method(&self) -> bool {
30+
true
31+
}
32+
}
33+
34+
pub fn main() {
35+
assert!(Foo.method());
36+
}

tests/ui/inner-attrs-on-impl.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)