File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -20,13 +20,16 @@ use syn::{parse_macro_input, DeriveInput};
2020/// It expected to run inside composite_template_derive, not by users
2121#[ cfg( feature = "blueprint" ) ]
2222#[ proc_macro]
23+ #[ proc_macro_error]
24+ #[ doc( hidden) ]
2325pub fn include_blueprint ( input : TokenStream ) -> TokenStream {
26+ use proc_macro_error:: abort_call_site;
2427 use quote:: quote;
2528
2629 let tokens: Vec < _ > = input. into_iter ( ) . collect ( ) ;
2730
2831 if tokens. len ( ) != 1 {
29- panic ! ( "File name not found" ) ;
32+ abort_call_site ! ( "File name not found" ) ;
3033 }
3134
3235 let root = std:: env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap_or_else ( |_| "." . into ( ) ) ;
@@ -38,14 +41,14 @@ pub fn include_blueprint(input: TokenStream) -> TokenStream {
3841 let path = std:: path:: Path :: new ( & root) . join ( file_name) ;
3942
4043 if !path. exists ( ) {
41- panic ! ( "{path:? } not found" ) ;
44+ abort_call_site ! ( "{} not found" , & path . to_string_lossy ( ) ) ;
4245 }
4346
4447 let path = path. to_string_lossy ( ) . to_string ( ) ;
4548
4649 let template = blueprint:: compile_blueprint (
4750 std:: fs:: read_to_string ( & path)
48- . unwrap_or_else ( |err| panic ! ( "{err}" ) )
51+ . unwrap_or_else ( |err| abort_call_site ! ( "{}" , err ) )
4952 . as_bytes ( ) ,
5053 )
5154 . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments