Skip to content

Commit e357682

Browse files
CreepySkeletonmystor
authored andcommitted
Support custom attributes
1 parent 8d36456 commit e357682

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/macros.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ pub use syn::{parse, parse_str, DeriveInput};
5353
#[macro_export]
5454
macro_rules! decl_derive {
5555
// XXX: Switch to using this variant everywhere?
56-
([$derives:ident $($derive_t:tt)*] => $inner:path) => {
56+
([$derives:ident $($derive_t:tt)*] => $(#[$attrs:meta])* $inner:path) => {
5757
#[proc_macro_derive($derives $($derive_t)*)]
5858
#[allow(non_snake_case)]
59+
$(#[$attrs])*
5960
pub fn $derives(
6061
i: $crate::macros::TokenStream
6162
) -> $crate::macros::TokenStream {
@@ -104,8 +105,9 @@ macro_rules! decl_derive {
104105
/// ```
105106
#[macro_export]
106107
macro_rules! decl_attribute {
107-
([$attribute:ident] => $inner:path) => {
108+
([$attribute:ident] => $(#[$attrs:meta])* $inner:path) => {
108109
#[proc_macro_attribute]
110+
$(#[$attrs])*
109111
pub fn $attribute(
110112
attr: $crate::macros::TokenStream,
111113
i: $crate::macros::TokenStream,

0 commit comments

Comments
 (0)