rust/tests/ui/hygiene/rustc-macro-transparency.rs
Vadim Petrochenkov 54bb849aff hygiene: Rename semi-transparent to semi-opaque
The former is just too long, see the examples in `hygiene.rs`
2025-03-31 15:41:48 +03:00

32 lines
698 B
Rust

#![feature(decl_macro, rustc_attrs)]
#[rustc_macro_transparency = "transparent"]
macro transparent() {
struct Transparent;
let transparent = 0;
}
#[rustc_macro_transparency = "semitransparent"]
macro semiopaque() {
struct SemiOpaque;
let semiopaque = 0;
}
#[rustc_macro_transparency = "opaque"]
macro opaque() {
struct Opaque;
let opaque = 0;
}
fn main() {
transparent!();
semiopaque!();
opaque!();
Transparent; // OK
SemiOpaque; // OK
Opaque; //~ ERROR cannot find value `Opaque` in this scope
transparent; // OK
semiopaque; //~ ERROR expected value, found macro `semiopaque`
opaque; //~ ERROR expected value, found macro `opaque`
}