File tree Expand file tree Collapse file tree 2 files changed +36
-24
lines changed Expand file tree Collapse file tree 2 files changed +36
-24
lines changed Original file line number Diff line number Diff line change 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+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments