3 #![feature(decl_macro)]
6 struct NonCopy(String);
12 macro copy_modern($foo: ident) {
16 macro_rules! copy_legacy {
18 $foo.x //~ ERROR use of moved value: `foo.x`
22 fn assert_two_copies(a: NonCopy, b: NonCopy) {
23 println!("Got two copies: {:?}, {:?}", a, b);
27 let foo = Foo { x: NonCopy("foo".into()) };
28 assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x`
29 assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x`