diff options
| author | Gary Guo <gary@garyguo.net> | 2026-09-23 15:06:14 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2026-09-28 12:43:17 +0100 |
| commit | 73c1f157907cf23ef90e105f48c40fae75ee1008 (patch) | |
| tree | 7cde9c7ecc26af6f5eda6816141ffb6490afbfb4 /tools/lib/python/kdoc/python_version.py | |
| parent | 01c3d218e8fa5ac4393e7959701cd6c2e90c4a81 (diff) | |
| download | linux-next-73c1f157907cf23ef90e105f48c40fae75ee1008.tar.gz linux-next-73c1f157907cf23ef90e105f48c40fae75ee1008.zip | |
rust: pin-init: internal: make `DiagCtxt` available inside parser
Currently, there is a split between `syn::Error` and pin-init's custom
`DiagCtxt`. Parsing has no access to `DiagCtxt` and therefore cannot report
diagnostics without failing the parse. Bridge the gap by making the
`DiagCtxt` available inside parsers using `thread_local!`.
`parse_macro_input!` returns error as token stream directly, so it is no
longer suitable when the parsing is moved inside `DiagCtxt` closure. Add a
`From<syn::Error> for ErrorGuaranteed` implementation so `?` can be used to
add a `syn::Error` into the current diagnostic context and obtain a
`ErrorGuaranteed`.
Clean up the handler of using `<-` inside tuple expression as a
demonstration of the usefulness of having `DiagCtxt` access inside `Parse`.
Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20260923140618.1978181-2-gary@kernel.org
Signed-off-by: Gary Guo <gary@garyguo.net>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
