We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e8acb46 commit 266da38Copy full SHA for 266da38
lang/syn/src/idl/program.rs
@@ -20,7 +20,13 @@ pub fn gen_idl_print_fn_program(program: &Program) -> TokenStream {
20
Ok(tokens) => tokens,
21
Err(e) => {
22
// If we can't perform safety checks, emit a compile error
23
- return syn::Error::new(proc_macro2::Span::call_site(), e.to_string())
+ // Use the span of the first instruction if available, otherwise use the program module span
24
+ let error_span = program
25
+ .ixs
26
+ .first()
27
+ .map(|ix| ix.raw_method.span())
28
+ .unwrap_or_else(|| program.program_mod.span());
29
+ return syn::Error::new(error_span, e.to_string())
30
.to_compile_error();
31
}
32
};
0 commit comments