2017-08-23 02:22:52 +00:00
|
|
|
// `#![derive]` raises errors when it occurs at contexts other than ADT
|
|
|
|
// definitions.
|
2017-07-11 12:30:10 +00:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-07-17 18:13:50 +00:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 12:30:10 +00:00
|
|
|
mod derive {
|
|
|
|
mod inner { #![derive(Debug)] }
|
2021-07-17 18:13:50 +00:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2020-11-14 11:47:14 +00:00
|
|
|
//~| ERROR inner macro attributes are unstable
|
2017-07-11 12:30:10 +00:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-07-17 18:13:50 +00:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 12:30:10 +00: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 18:13:50 +00:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 12:30:10 +00:00
|
|
|
type T = S;
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-07-17 18:13:50 +00:00
|
|
|
//~^ ERROR `derive` may only be applied to `struct`s, `enum`s and `union`s
|
2017-07-11 12:30:10 +00:00
|
|
|
impl S { }
|
|
|
|
}
|
2018-12-16 17:23:27 +00:00
|
|
|
|
|
|
|
fn main() {}
|