2017-08-22 21:22:52 -05:00
|
|
|
// `#![derive]` raises errors when it occurs at contexts other than ADT
|
|
|
|
// definitions.
|
2017-07-11 07:30:10 -05:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-07-17 13:13:50 -05:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 07:30:10 -05:00
|
|
|
mod derive {
|
|
|
|
mod inner { #![derive(Debug)] }
|
2021-07-17 13:13:50 -05:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2020-11-14 05:47:14 -06:00
|
|
|
//~| ERROR inner macro attributes are unstable
|
2017-07-11 07:30:10 -05:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-07-17 13:13:50 -05:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 07:30:10 -05:00
|
|
|
fn derive() { }
|
|
|
|
|
|
|
|
#[derive(Copy, Clone)] // (can't derive Debug for unions)
|
|
|
|
union U { f: i32 }
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
enum E { }
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-07-17 13:13:50 -05:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 07:30:10 -05:00
|
|
|
type T = S;
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-07-17 13:13:50 -05:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 07:30:10 -05:00
|
|
|
impl S { }
|
|
|
|
}
|
2018-12-16 11:23:27 -06:00
|
|
|
|
|
|
|
fn main() {}
|