We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e8acb46 commit e6c666bCopy full SHA for e6c666b
lang/syn/src/idl/program.rs
@@ -19,9 +19,13 @@ pub fn gen_idl_print_fn_program(program: &Program) -> TokenStream {
19
let safety_check_errors = match check_safety_comments() {
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())
24
- .to_compile_error();
+ /// CHECK: Use the span of the first instruction if available, otherwise use the program module span
+ let error_span = program
+ .ixs
25
+ .first()
26
+ .map(|ix| ix.raw_method.span())
27
+ .unwrap_or_else(|| program.program_mod.span());
28
+ return syn::Error::new(error_span, e.to_string()).to_compile_error();
29
}
30
};
31
0 commit comments