Allow proc_macro functions to whitelist specific attributes

By using a second attribute `attributes(Bar)` on
proc_macro_derive, whitelist any attributes with
the name `Bar` in the deriving item. This allows
a proc_macro function to use custom attribtues
without a custom attribute error or unused attribute
lint.
This commit is contained in:
Josh Driver
2016-11-08 21:45:02 +10:30
parent d377cf5b3f
commit 31a508e118
16 changed files with 260 additions and 46 deletions

View File

@@ -95,7 +95,8 @@ pub mod __internal {
pub trait Registry {
fn register_custom_derive(&mut self,
trait_name: &str,
expand: fn(TokenStream) -> TokenStream);
expand: fn(TokenStream) -> TokenStream,
attributes: &[&'static str]);
}
// Emulate scoped_thread_local!() here essentially