summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2026-09-21 12:35:46 +0100
committerGary Guo <gary@garyguo.net>2026-09-30 18:58:39 +0100
commit499b8f8a5d0401a6ab83b346a307f923640a024a (patch)
treed74d353493766fe8606088a5f66937601f8acc96 /tools/lib/python
parentb2cb983f9d59ddc0ede2a4976443fda6297778af (diff)
downloadlinux-next-499b8f8a5d0401a6ab83b346a307f923640a024a.tar.gz
linux-next-499b8f8a5d0401a6ab83b346a307f923640a024a.zip
rust: proc-macro2: enable `proc_macro_span` feature
The `Span::join` function is very important in generating useful diagnostics. When invoking `syn::Spanned::span`, it attempts to return an overall span that covers the whole expression. If the `join` function is unavailable, however, only the span of the first token is generated. This causes worse diagnostics quality for all macros, notably pin-init, when compared to the pin-init's own diagnostics test suite with the feature enabled. For example, this diagnostic covers only part of the text where replacement is suggested: error: expected nothing or `..Zeroable::init_zeroed()`. --> tests/ui/compile-fail/zeroable/invalid_spread.rs:15:11 | 15 | ..MyZeroable::init_zeroed() | ^^^^^^^^^^ In the upcoming pin-init self-reference series, spans of full types or expressions are used quite heavily to make diagnostics not confusing. Thus, enable the `proc_macro_span` feature. This does make use of the unstable `Span::join` function, but this is for producing diagnostics only, so we do not have a hard reliance on the feature. A very small tweak of proc-macro2 vendored code is needed to make the code compile for 1.85. Link: https://github.com/rust-lang/rust/issues/54725 Link: https://github.com/dtolnay/proc-macro2/pull/542 Acked-by: Miguel Ojeda <ojeda@kernel.org> Link: https://patch.msgid.link/20260921115708.4009754-1-gary@kernel.org/ [ Updated example diagnostics, removed unused PathBuf import. - Gary ] Signed-off-by: Gary Guo <gary@garyguo.net>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions