PR #12 used quote_spanned to make error messages have the span of the
corresponding field in the struct. However, there's no indication that
the error comes from #[derive(Collect)], which could be confusing for
people unfamiliar with the crate.
This PR uses Span::resolved_at to give the generated spans the hygiene
information from the call site. This causes rustc to add a note about
the error message originating from a macro, while still keeping the
error message at the proper location.
PR #12 used
quote_spanned
to make error messages have the span of the corresponding field in the struct. However, there's no indication that the error comes from#[derive(Collect)]
, which could be confusing for people unfamiliar with the crate.This PR uses
Span::resolved_at
to give the generated spans the hygiene information from the call site. This causes rustc to add a note about the error message originating from a macro, while still keeping the error message at the proper location.