mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
19 lines
284 B
Rust
19 lines
284 B
Rust
![]() |
//@ run-pass
|
||
|
|
||
|
#![feature(macro_metavar_expr_concat)]
|
||
|
|
||
|
macro_rules! one_rep {
|
||
|
( $($a:ident)* ) => {
|
||
|
$(
|
||
|
const ${concat($a, Z)}: i32 = 3;
|
||
|
)*
|
||
|
};
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
one_rep!(A B C);
|
||
|
assert_eq!(AZ, 3);
|
||
|
assert_eq!(BZ, 3);
|
||
|
assert_eq!(CZ, 3);
|
||
|
}
|