xso-proc: improve spans for error messages

For codec-based error messages, this reduces the amount of errors per
violation to one. For all others, it improves the placement of the error
slightly, but we still get duplicates.

I couldn't figure out the remaining discrepancies in the spans ...
This commit is contained in:
Jonas Schäfer 2025-05-02 16:56:22 +02:00
commit de39f410d5
5 changed files with 75 additions and 49 deletions

View file

@ -430,12 +430,14 @@ impl Compound {
} => {
let feed = feed_fn(builder.clone());
let mut substate_data_ident = substate_data.clone();
substate_data_ident.set_span(ty.span());
states.push(State::new_with_builder(
state_name.clone(),
builder_data_ident,
&builder_data_ty,
).with_field(
substate_data,
&substate_data_ident,
&builder,
).with_mut(substate_data).with_impl(quote! {
match #feed(&mut #substate_data, ev, ctx)? {