aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
Diffstat (limited to 'askama_derive')
-rw-r--r--askama_derive/Cargo.toml1
-rw-r--r--askama_derive/src/lib.rs9
2 files changed, 5 insertions, 5 deletions
diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml
index 84970fb..63d08bd 100644
--- a/askama_derive/Cargo.toml
+++ b/askama_derive/Cargo.toml
@@ -25,5 +25,4 @@ warp = []
[dependencies]
askama_shared = { version = "0.10.4", path = "../askama_shared", default-features = false }
proc-macro2 = "1"
-quote = "1"
syn = "1"
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs
index 8844e99..101b861 100644
--- a/askama_derive/src/lib.rs
+++ b/askama_derive/src/lib.rs
@@ -7,6 +7,7 @@ use askama_shared::{
generator, get_template_source, read_config_file, CompileError, Config, Integrations,
};
use proc_macro::TokenStream;
+use proc_macro2::Span;
use std::collections::HashMap;
use std::path::PathBuf;
@@ -15,11 +16,11 @@ use std::path::PathBuf;
pub fn derive_template(input: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(input).unwrap();
match build_template(&ast) {
- Ok(source) => source,
- Err(e) => format!("compile_error!({:?})", e),
+ Ok(source) => source.parse().unwrap(),
+ Err(e) => syn::Error::new(Span::call_site(), e)
+ .to_compile_error()
+ .into(),
}
- .parse()
- .unwrap()
}
/// Takes a `syn::DeriveInput` and generates source code for it