rust/tests/ui/proc-macro/macro-crate-multi-decorator.rs

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

42 lines
730 B
Rust
Raw Normal View History

// The duplicate macro will create a copy of the item with the given identifier.
2015-01-20 19:10:55 +00:00
//@ check-pass
//@ aux-build:duplicate.rs
2015-01-20 19:10:55 +00:00
2015-05-01 04:05:02 +00:00
#[macro_use]
extern crate duplicate;
2015-05-01 04:05:02 +00:00
#[duplicate(MyCopy)]
2015-01-20 19:10:55 +00:00
struct MyStruct {
number: i32,
2015-01-20 19:10:55 +00:00
}
trait TestTrait {
#[duplicate(TestType2)]
2015-01-20 19:10:55 +00:00
type TestType;
#[duplicate(required_fn2)]
2015-01-20 19:10:55 +00:00
fn required_fn(&self);
#[duplicate(provided_fn2)]
fn provided_fn(&self) {}
2015-01-20 19:10:55 +00:00
}
impl TestTrait for MyStruct {
#[duplicate(TestType2)]
2015-01-20 19:10:55 +00:00
type TestType = f64;
#[duplicate(required_fn2)]
fn required_fn(&self) {}
2015-01-20 19:10:55 +00:00
}
fn main() {
let s = MyStruct { number: 42 };
s.required_fn();
s.required_fn2();
s.provided_fn();
s.provided_fn2();
let s = MyCopy { number: 42 };
}