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
728 B
Rust
Raw Normal View History

// The duplicate macro will create a copy of the item with the given identifier.
2015-01-20 13:10:55 -06:00
// check-pass
// aux-build:duplicate.rs
2015-01-20 13:10:55 -06:00
2015-04-30 23:05:02 -05:00
#[macro_use]
extern crate duplicate;
2015-04-30 23:05:02 -05:00
#[duplicate(MyCopy)]
2015-01-20 13:10:55 -06:00
struct MyStruct {
number: i32,
2015-01-20 13:10:55 -06:00
}
trait TestTrait {
#[duplicate(TestType2)]
2015-01-20 13:10:55 -06:00
type TestType;
#[duplicate(required_fn2)]
2015-01-20 13:10:55 -06:00
fn required_fn(&self);
#[duplicate(provided_fn2)]
fn provided_fn(&self) {}
2015-01-20 13:10:55 -06:00
}
impl TestTrait for MyStruct {
#[duplicate(TestType2)]
2015-01-20 13:10:55 -06:00
type TestType = f64;
#[duplicate(required_fn2)]
fn required_fn(&self) {}
2015-01-20 13:10:55 -06: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 };
}