mirror of https://github.com/rwf2/Rocket.git
Use register_custom_derive to remove custom_derive deprecation warning.
This commit is contained in:
parent
d610e0adff
commit
337173eaf4
|
@ -93,6 +93,7 @@
|
|||
#![feature(quote, concat_idents, plugin_registrar, rustc_private, unicode)]
|
||||
#![feature(custom_attribute)]
|
||||
#![allow(unused_attributes)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
#[macro_use] extern crate syntax;
|
||||
#[macro_use] extern crate log;
|
||||
|
@ -127,6 +128,14 @@ macro_rules! register_decorators {
|
|||
)
|
||||
}
|
||||
|
||||
macro_rules! register_derives {
|
||||
($registry:expr, $($name:expr => $func:ident),+) => (
|
||||
$($registry.register_custom_derive(Symbol::intern($name),
|
||||
SyntaxExtension::MultiDecorator(Box::new(decorators::$func)));
|
||||
)+
|
||||
)
|
||||
}
|
||||
|
||||
/// Compiler hook for Rust to register plugins.
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
|
@ -138,9 +147,11 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
|||
reg.register_macro("routes", macros::routes);
|
||||
reg.register_macro("errors", macros::errors);
|
||||
|
||||
register_decorators!(reg,
|
||||
"derive_FromForm" => from_form_derive,
|
||||
register_derives!(reg,
|
||||
"derive_FromForm" => from_form_derive
|
||||
);
|
||||
|
||||
register_decorators!(reg,
|
||||
"error" => error_decorator,
|
||||
"route" => route_decorator,
|
||||
"get" => get_decorator,
|
||||
|
|
Loading…
Reference in New Issue