-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed as duplicate of#48038
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
A derive proc macro expanding to something starting with a { is ignored:
use proc_macro::TokenStream;
#[proc_macro_derive(Test)]
pub fn test(_: TokenStream) -> TokenStream {
quote::quote!(
{}
fn main() {}
).into()
}use scratchpad::Test;
#[derive(Test)]
struct A;error[E0601]: `main` function not found in crate `scratchpad`
--> src/main.rs:1:1
|
1 | / use scratchpad::Test;
2 | |
3 | | #[derive(Test)]
4 | | struct A;
| |_________^ consider adding a `main` function to `src/main.rs`
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.