93
93
#![ feature( quote, concat_idents, plugin_registrar, rustc_private, unicode) ]
94
94
#![ feature( custom_attribute) ]
95
95
#![ allow( unused_attributes) ]
96
+ #![ allow( deprecated) ]
96
97
97
98
#[ macro_use] extern crate syntax;
98
99
#[ macro_use] extern crate log;
@@ -127,6 +128,14 @@ macro_rules! register_decorators {
127
128
)
128
129
}
129
130
131
+ macro_rules! register_derives {
132
+ ( $registry: expr, $( $name: expr => $func: ident) ,+) => (
133
+ $( $registry. register_custom_derive( Symbol :: intern( $name) ,
134
+ SyntaxExtension :: MultiDecorator ( Box :: new( decorators:: $func) ) ) ;
135
+ ) +
136
+ )
137
+ }
138
+
130
139
/// Compiler hook for Rust to register plugins.
131
140
#[ plugin_registrar]
132
141
pub fn plugin_registrar ( reg : & mut Registry ) {
@@ -138,9 +147,11 @@ pub fn plugin_registrar(reg: &mut Registry) {
138
147
reg. register_macro ( "routes" , macros:: routes) ;
139
148
reg. register_macro ( "errors" , macros:: errors) ;
140
149
141
- register_decorators ! ( reg,
142
- "derive_FromForm" => from_form_derive,
150
+ register_derives ! ( reg,
151
+ "derive_FromForm" => from_form_derive
152
+ ) ;
143
153
154
+ register_decorators ! ( reg,
144
155
"error" => error_decorator,
145
156
"route" => route_decorator,
146
157
"get" => get_decorator,
0 commit comments