Skip to content

Ambiguity between custom derive attributes and proc macro attributes #52226

Description

@alexcrichton

Discovered by @alercah here
it's not clear what to do with this crate right now:

#![feature(proc_macro)]

extern crate proc_macro;
#[macro_use]
extern crate quote;

use proc_macro::TokenStream;

#[proc_macro_derive(Hello, attributes(Bye))]
pub fn Hello(_: TokenStream) -> TokenStream {
    (quote! { fn hello() { println!("hello") }}).into()
}

#[proc_macro_attribute]
pub fn Bye(_: TokenStream, _: TokenStream) -> TokenStream {
    TokenStream::new()
}

along with:

#[Bye]
#[derive(Hello)]
struct T()

cc @petrochenkov

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions