Closed
Description
// lib.rs in proc-macro crate
#[proc_macro_derive(MyTrait)]
pub fn mytrait(item: TokenStream) -> TokenStream {
"compile_error!()".parse().unwrap()
}
// lib.rs in other crate
#[derive(MyTrait)]
struct MyStruct;
error: macros that expand to items must be delimited with braces or followed by a semicolon
--> examples\mytrait.rs:10:10
|
10 | #[derive(MyTrait)]
| ^^^^^^^
|
= note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info)
help: change the delimiters to curly braces
|
10 | #[derive({})]
| ~
help: add a semicolon
|
10 | #[derive(MyTrait;)]
| +
Both suggestions have invalid syntax.
Ideally rustc should suggest to add ;
into token stream returned from derive-proc-macro.