whitespaces
This commit is contained in:
parent
aa7ecdbd65
commit
17a9bb81e8
@ -17,29 +17,29 @@
|
|||||||
|
|
||||||
#[cfg(feature = "with-syntex")]
|
#[cfg(feature = "with-syntex")]
|
||||||
mod inner {
|
mod inner {
|
||||||
extern crate syntex;
|
extern crate syntex;
|
||||||
extern crate quasi_codegen;
|
extern crate quasi_codegen;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
let mut registry = syntex::Registry::new();
|
let mut registry = syntex::Registry::new();
|
||||||
quasi_codegen::register(&mut registry);
|
quasi_codegen::register(&mut registry);
|
||||||
|
|
||||||
let src = Path::new("src/lib.rs.in");
|
let src = Path::new("src/lib.rs.in");
|
||||||
let dst = Path::new(&out_dir).join("lib.rs");
|
let dst = Path::new(&out_dir).join("lib.rs");
|
||||||
|
|
||||||
registry.expand("", &src, &dst).unwrap();
|
registry.expand("", &src, &dst).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "with-syntex"))]
|
#[cfg(not(feature = "with-syntex"))]
|
||||||
mod inner {
|
mod inner {
|
||||||
pub fn main() {}
|
pub fn main() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
inner::main();
|
inner::main();
|
||||||
}
|
}
|
||||||
|
@ -42,22 +42,22 @@ pub fn expand_ipc_implementation(
|
|||||||
annotatable: &Annotatable,
|
annotatable: &Annotatable,
|
||||||
push: &mut FnMut(Annotatable)
|
push: &mut FnMut(Annotatable)
|
||||||
) {
|
) {
|
||||||
let item = match *annotatable {
|
let item = match *annotatable {
|
||||||
Annotatable::Item(ref item) => item,
|
Annotatable::Item(ref item) => item,
|
||||||
_ => {
|
_ => {
|
||||||
cx.span_err(meta_item.span, "`#[derive(Ipc)]` may only be applied to struct implementations");
|
cx.span_err(meta_item.span, "`#[derive(Ipc)]` may only be applied to struct implementations");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let builder = aster::AstBuilder::new().span(span);
|
let builder = aster::AstBuilder::new().span(span);
|
||||||
|
|
||||||
let impl_item = match implement_interface(cx, &builder, &item, push) {
|
let impl_item = match implement_interface(cx, &builder, &item, push) {
|
||||||
Ok(item) => item,
|
Ok(item) => item,
|
||||||
Err(Error) => { return; }
|
Err(Error) => { return; }
|
||||||
};
|
};
|
||||||
|
|
||||||
push(Annotatable::Item(impl_item))
|
push(Annotatable::Item(impl_item))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn field_name(builder: &aster::AstBuilder, arg: &Arg) -> ast::Ident {
|
fn field_name(builder: &aster::AstBuilder, arg: &Arg) -> ast::Ident {
|
||||||
|
@ -52,16 +52,16 @@ include!("lib.rs.in");
|
|||||||
|
|
||||||
#[cfg(feature = "with-syntex")]
|
#[cfg(feature = "with-syntex")]
|
||||||
pub fn register(reg: &mut syntex::Registry) {
|
pub fn register(reg: &mut syntex::Registry) {
|
||||||
reg.add_attr("feature(custom_derive)");
|
reg.add_attr("feature(custom_derive)");
|
||||||
reg.add_attr("feature(custom_attribute)");
|
reg.add_attr("feature(custom_attribute)");
|
||||||
|
|
||||||
reg.add_decorator("derive_Ipc", codegen::expand_ipc_implementation);
|
reg.add_decorator("derive_Ipc", codegen::expand_ipc_implementation);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "with-syntex"))]
|
#[cfg(not(feature = "with-syntex"))]
|
||||||
pub fn register(reg: &mut rustc_plugin::Registry) {
|
pub fn register(reg: &mut rustc_plugin::Registry) {
|
||||||
reg.register_syntax_extension(
|
reg.register_syntax_extension(
|
||||||
syntax::parse::token::intern("derive_Ipc"),
|
syntax::parse::token::intern("derive_Ipc"),
|
||||||
syntax::ext::base::MultiDecorator(
|
syntax::ext::base::MultiDecorator(
|
||||||
Box::new(ser::expand_derive_serialize)));
|
Box::new(ser::expand_derive_serialize)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user