| 1 |
// { dg-additional-options "-frust-crate-type=proc-macro" } |
| 2 |
|
| 3 |
trait ToDerive {} |
| 4 |
|
| 5 |
mod inner { |
| 6 |
struct InnerStruct; |
| 7 |
} |
| 8 |
|
| 9 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 10 |
type AliasedType = inner::InnerStruct; |
| 11 |
|
| 12 |
// { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" "" { target *-*-* } .+1 } |
| 13 |
#[proc_macro_derive(ToDerive)] |
| 14 |
use inner::InnerStruct; |
| 15 |
|
| 16 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 17 |
struct MyStruct; |
| 18 |
|
| 19 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 20 |
struct MyCurlyStruct { |
| 21 |
member: usize, |
| 22 |
} |
| 23 |
|
| 24 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 25 |
struct MyTupleStruct(usize); |
| 26 |
|
| 27 |
#[proc_macro_derive(ToDerive)] |
| 28 |
// { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" "" { target *-*-* } .-1 } |
| 29 |
extern crate my_extern_crate; // { dg-error "unknown crate .my_extern_crate." } |
| 30 |
// { dg-error "failed to locate crate .my_extern_crate." "" { target *-*-* } .-1 } |
| 31 |
|
| 32 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 33 |
mod my_module {} |
| 34 |
|
| 35 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 36 |
enum MyEnum {} |
| 37 |
|
| 38 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 39 |
union MyUnion { |
| 40 |
f1: u32, |
| 41 |
f2: f32, |
| 42 |
} |
| 43 |
|
| 44 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 45 |
const MY_CONST_STR: &str = "my_string"; |
| 46 |
|
| 47 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 48 |
static MY_STATIC_USIZE: usize = 10; |
| 49 |
|
| 50 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 51 |
trait MyTrait {} |
| 52 |
|
| 53 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 54 |
impl MyStruct {} |
| 55 |
|
| 56 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 57 |
impl MyTrait for MyStruct {} |
| 58 |
|
| 59 |
#[proc_macro_derive(ToDerive)] // { dg-error "the .#.proc_macro_derive.. attribute may only be used on bare functions" } |
| 60 |
extern "C" {} |