rust: pin-init: provide better span for diagnostics
Status from this message: Applied to pin-init-next.
Get series with b4
b4 am [email protected] change-id 20260916-dev-hygiene-5473c74b5b63Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | rust: pin-init: internal: pin_init: emit `slot` using mixed site hygienerust/ | +5 | 0 replies | |
| 2/3 | rust: pin-init: internal: pin_init: use `slot` identifier directly with mixed siterust/ | +12 | 0 replies | |
| 3/3 | rust: pin-init: internal: pin_init: provide span for slot projectionrust/ | +7 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] rust: pin-init: provide better span for diagnostics
When initializing a field, pin-init first projects the full slot to a slot of the field, then initialize it by invoking a method. Currently the span location is not explicitly set, so the error message points to the full macro invocation.
Improve it by provide a span, so Rust will point to the specific fields causing the error when type check fails.
Old error message:
error[E0308]: mismatched types
--> tests/ui/compile-fail/init/field_value_wrong_type.rs:8:28
|
8 | let _ = init!(Foo { a: () });
| ---------------^^---
| | |
| | expected usize, found ()
| arguments to this method are incorrect
New error message:
error[E0308]: mismatched types
--> tests/ui/compile-fail/init/field_value_wrong_type.rs:8:28
|
8 | let _ = init!(Foo { a: () });
| ---^^
| | |
| | expected usize, found ()
| arguments to this method are incorrect
---
Gary Guo (3):
rust: pin-init: internal: pin_init: emit slot using mixed site hygiene
rust: pin-init: internal: pin_init: use slot identifier directly with mixed site
rust: pin-init: internal: pin_init: provide span for slot projection
rust/pin-init/internal/src/init.rs | 48 +++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 27 deletions(-)
---
base-commit: 3b3ff9034a497fb3b8429f6fe8ba5697bc7dcebd
change-id: 20260916-dev-hygiene-5473c74b5b63
Best regards,
Signature · 1 line
Gary Guo <[email protected]>