mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00
37 lines
669 B
Rust
37 lines
669 B
Rust
//! Test inner attributes (#![...]) behavior in impl blocks with cfg conditions.
|
|
//!
|
|
//! This test verifies that:
|
|
//! - Inner attributes can conditionally exclude entire impl blocks
|
|
//! - Regular attributes within impl blocks work independently
|
|
//! - Attribute parsing doesn't consume too eagerly
|
|
|
|
//@ run-pass
|
|
|
|
struct Foo;
|
|
|
|
impl Foo {
|
|
#![cfg(false)]
|
|
|
|
fn method(&self) -> bool {
|
|
false
|
|
}
|
|
}
|
|
|
|
impl Foo {
|
|
#![cfg(not(FALSE))]
|
|
|
|
// Check that we don't eat attributes too eagerly.
|
|
#[cfg(false)]
|
|
fn method(&self) -> bool {
|
|
false
|
|
}
|
|
|
|
fn method(&self) -> bool {
|
|
true
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
assert!(Foo.method());
|
|
}
|