rust/tests/ui/macros/macro-outer-attributes.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
394 B
Rust
Raw Permalink Normal View History

#![feature(rustc_attrs)]
macro_rules! test { ($nm:ident,
#[$a:meta],
$i:item) => (mod $nm { #[$a] $i }); }
test!(a,
2025-03-29 17:24:03 +00:00
#[cfg(false)],
pub fn bar() { });
test!(b,
#[cfg(not(FALSE))],
pub fn bar() { });
// test1!(#[bar])
#[rustc_dummy]
fn main() {
a::bar(); //~ ERROR cannot find function `bar` in module `a`
b::bar();
}