mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
18 lines
267 B
Rust
18 lines
267 B
Rust
// check-pass
|
|
#![allow(unused_must_use)]
|
|
#![feature(decl_macro)]
|
|
|
|
pub macro create_struct($a:ident) {
|
|
struct $a;
|
|
impl Clone for $a {
|
|
fn clone(&self) -> Self {
|
|
$a
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
create_struct!(Test);
|
|
Test.clone();
|
|
}
|