rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gary Guo <gary@garyguo.net>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Alex Gaynor" <alex.gaynor@gmail.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev
Subject: Re: [PATCH 00/18] `syn` support
Date: Mon, 10 Nov 2025 13:59:27 +0000	[thread overview]
Message-ID: <20251110135927.05d83da2@eugeo> (raw)
In-Reply-To: <20251110095025.1475896-1-ojeda@kernel.org>

On Mon, 10 Nov 2025 10:50:05 +0100
Miguel Ojeda <ojeda@kernel.org> wrote:

> This patch series introduces support for `syn` (and its dependencies).
> Having such support allows to greatly simplify writing complex macros
> such as `pin-init`.
> 
> Benno has already prepared the `pin-init` version based on this, and on
> top of that, we will be able to simplify the `macros` crate too.
> 
> The series starts with a few preparation commits (two fixes were already
> merged in mainline that were discovered by this series), then each crate
> is added.
> 
> This has been a long time coming -- the first iterations of this, from
> 2022 and 2023 (with `serde` too), are at:
> 
>     https://github.com/Rust-for-Linux/linux/pull/910
>     https://github.com/Rust-for-Linux/linux/pull/1007
> 
> After those, we considered picking these from the distributions where
> possible. However, after discussing it, it is not really worth the
> complexity: vendoring makes things less complex and is less fragile.
> 
> In particular, we avoid having to support and test several versions,
> we avoid having to introduce Cargo just to properly fetch the right
> versions from the registry, we can easily customize the crates if needed
> (e.g. dropping the `unicode_idents` dependency like it is done in this
> series) and we simplify the configuration of the build for users for
> which the "default" paths/registries would not have worked.
> 
> Moreover, nowadays, the ~57k lines introduced are not that much compared
> to years ago (it dwarfed the actual Rust kernel code). Moreover, back
> then it wasn't clear the Rust experiment would be a success, so it would
> have been a bit pointless/risky to add many lines for nothing. Our macro
> needs were also smaller in the early days.
> 
> So, finally, in Kangrejos 2025 we discussed going with the original,
> simpler approach. Thus here it is the result.
> 
> There should not be many updates needed for these, and even if there
> are, they should not be too big, e.g. +7k -3k lines across the 3 crates
> in the last year.
> 
> Note that `syn` does not have all the features enabled, since we do not
> need them so far, but they can easily be enabled just adding them to the
> list.
> 
> I will be updating the webpage as well with the result of this:
> 
>     https://rust-for-linux.com/third-party-crates
> 
> Please give it a test -- thanks!

Hi Miguel,

Thank you for creating this. I have been wanting to use `syn` even
before RfL was merged into mainline :)

I've gone through all commits and they all look good to me (I've also
verified the "import crate" patches against the source). So

Reviewed-by: Gary Guo <gary@garyguo.net>

I can build with these patches and I've verified that libmacros can
indeed reference types within `syn`, so also

Tested-by: Gary Guo <gary@garyguo.net>

Best,
Gary

> 
> Miguel Ojeda (18):
>   rust: condvar: avoid `pub` in example
>   rust: kbuild: introduce `core-flags` and `core-skip_flags`
>   rust: kbuild: simplify `--cfg` handling
>   rust: kbuild: add host library support
>   rust: proc-macro2: import crate
>   rust: proc-macro2: add SPDX License Identifiers
>   rust: proc-macro2: remove `unicode_ident` dependency
>   rust: proc-macro2: add `README.md`
>   rust: proc-macro2: enable support in kbuild
>   rust: quote: import crate
>   rust: quote: add SPDX License Identifiers
>   rust: quote: add `README.md`
>   rust: quote: enable support in kbuild
>   rust: syn: import crate
>   rust: syn: add SPDX License Identifiers
>   rust: syn: remove `unicode-ident` dependency
>   rust: syn: add `README.md`
>   rust: syn: enable support in kbuild
> 
>  .gitignore                                    |    1 +
>  Makefile                                      |    5 +
>  rust/Makefile                                 |  134 +-
>  rust/kernel/sync/condvar.rs                   |    2 +-
>  rust/proc-macro2/README.md                    |   13 +
>  rust/proc-macro2/detection.rs                 |   77 +
>  rust/proc-macro2/extra.rs                     |  153 +
>  rust/proc-macro2/fallback.rs                  | 1258 +++++
>  rust/proc-macro2/lib.rs                       | 1351 ++++++
>  rust/proc-macro2/location.rs                  |   31 +
>  rust/proc-macro2/marker.rs                    |   19 +
>  rust/proc-macro2/parse.rs                     |  997 ++++
>  rust/proc-macro2/probe.rs                     |   12 +
>  rust/proc-macro2/probe/proc_macro_span.rs     |   53 +
>  .../proc-macro2/probe/proc_macro_span_file.rs |   16 +
>  .../probe/proc_macro_span_location.rs         |   23 +
>  rust/proc-macro2/rcvec.rs                     |  148 +
>  rust/proc-macro2/wrapper.rs                   |  986 ++++
>  rust/quote/README.md                          |   12 +
>  rust/quote/ext.rs                             |  112 +
>  rust/quote/format.rs                          |  170 +
>  rust/quote/ident_fragment.rs                  |   90 +
>  rust/quote/lib.rs                             | 1456 ++++++
>  rust/quote/runtime.rs                         |  494 ++
>  rust/quote/spanned.rs                         |   52 +
>  rust/quote/to_tokens.rs                       |  273 ++
>  rust/syn/README.md                            |   13 +
>  rust/syn/attr.rs                              |  838 ++++
>  rust/syn/bigint.rs                            |   68 +
>  rust/syn/buffer.rs                            |  436 ++
>  rust/syn/classify.rs                          |  313 ++
>  rust/syn/custom_keyword.rs                    |  262 ++
>  rust/syn/custom_punctuation.rs                |  306 ++
>  rust/syn/data.rs                              |  426 ++
>  rust/syn/derive.rs                            |  261 ++
>  rust/syn/discouraged.rs                       |  227 +
>  rust/syn/drops.rs                             |   60 +
>  rust/syn/error.rs                             |  469 ++
>  rust/syn/export.rs                            |   75 +
>  rust/syn/expr.rs                              | 4175 +++++++++++++++++
>  rust/syn/ext.rs                               |  138 +
>  rust/syn/file.rs                              |  127 +
>  rust/syn/fixup.rs                             |  775 +++
>  rust/syn/gen/clone.rs                         | 2269 +++++++++
>  rust/syn/gen/debug.rs                         | 3240 +++++++++++++
>  rust/syn/gen/eq.rs                            | 2308 +++++++++
>  rust/syn/gen/fold.rs                          | 3904 +++++++++++++++
>  rust/syn/gen/hash.rs                          | 2878 ++++++++++++
>  rust/syn/gen/visit.rs                         | 3943 ++++++++++++++++
>  rust/syn/gen/visit_mut.rs                     | 3761 +++++++++++++++
>  rust/syn/generics.rs                          | 1479 ++++++
>  rust/syn/group.rs                             |  293 ++
>  rust/syn/ident.rs                             |  110 +
>  rust/syn/item.rs                              | 3492 ++++++++++++++
>  rust/syn/lib.rs                               | 1013 ++++
>  rust/syn/lifetime.rs                          |  158 +
>  rust/syn/lit.rs                               | 1862 ++++++++
>  rust/syn/lookahead.rs                         |  334 ++
>  rust/syn/mac.rs                               |  227 +
>  rust/syn/macros.rs                            |  184 +
>  rust/syn/meta.rs                              |  429 ++
>  rust/syn/op.rs                                |  221 +
>  rust/syn/parse.rs                             | 1421 ++++++
>  rust/syn/parse_macro_input.rs                 |  130 +
>  rust/syn/parse_quote.rs                       |  242 +
>  rust/syn/pat.rs                               |  957 ++++
>  rust/syn/path.rs                              |  968 ++++
>  rust/syn/precedence.rs                        |  212 +
>  rust/syn/print.rs                             |   18 +
>  rust/syn/punctuated.rs                        | 1157 +++++
>  rust/syn/restriction.rs                       |  180 +
>  rust/syn/scan_expr.rs                         |  267 ++
>  rust/syn/sealed.rs                            |    6 +
>  rust/syn/span.rs                              |   65 +
>  rust/syn/spanned.rs                           |  120 +
>  rust/syn/stmt.rs                              |  486 ++
>  rust/syn/thread.rs                            |   62 +
>  rust/syn/token.rs                             | 1098 +++++
>  rust/syn/tt.rs                                |  109 +
>  rust/syn/ty.rs                                | 1273 +++++
>  rust/syn/verbatim.rs                          |   35 +
>  rust/syn/whitespace.rs                        |   67 +
>  scripts/generate_rust_analyzer.py             |   23 +-
>  83 files changed, 57895 insertions(+), 13 deletions(-)
>  create mode 100644 rust/proc-macro2/README.md
>  create mode 100644 rust/proc-macro2/detection.rs
>  create mode 100644 rust/proc-macro2/extra.rs
>  create mode 100644 rust/proc-macro2/fallback.rs
>  create mode 100644 rust/proc-macro2/lib.rs
>  create mode 100644 rust/proc-macro2/location.rs
>  create mode 100644 rust/proc-macro2/marker.rs
>  create mode 100644 rust/proc-macro2/parse.rs
>  create mode 100644 rust/proc-macro2/probe.rs
>  create mode 100644 rust/proc-macro2/probe/proc_macro_span.rs
>  create mode 100644 rust/proc-macro2/probe/proc_macro_span_file.rs
>  create mode 100644 rust/proc-macro2/probe/proc_macro_span_location.rs
>  create mode 100644 rust/proc-macro2/rcvec.rs
>  create mode 100644 rust/proc-macro2/wrapper.rs
>  create mode 100644 rust/quote/README.md
>  create mode 100644 rust/quote/ext.rs
>  create mode 100644 rust/quote/format.rs
>  create mode 100644 rust/quote/ident_fragment.rs
>  create mode 100644 rust/quote/lib.rs
>  create mode 100644 rust/quote/runtime.rs
>  create mode 100644 rust/quote/spanned.rs
>  create mode 100644 rust/quote/to_tokens.rs
>  create mode 100644 rust/syn/README.md
>  create mode 100644 rust/syn/attr.rs
>  create mode 100644 rust/syn/bigint.rs
>  create mode 100644 rust/syn/buffer.rs
>  create mode 100644 rust/syn/classify.rs
>  create mode 100644 rust/syn/custom_keyword.rs
>  create mode 100644 rust/syn/custom_punctuation.rs
>  create mode 100644 rust/syn/data.rs
>  create mode 100644 rust/syn/derive.rs
>  create mode 100644 rust/syn/discouraged.rs
>  create mode 100644 rust/syn/drops.rs
>  create mode 100644 rust/syn/error.rs
>  create mode 100644 rust/syn/export.rs
>  create mode 100644 rust/syn/expr.rs
>  create mode 100644 rust/syn/ext.rs
>  create mode 100644 rust/syn/file.rs
>  create mode 100644 rust/syn/fixup.rs
>  create mode 100644 rust/syn/gen/clone.rs
>  create mode 100644 rust/syn/gen/debug.rs
>  create mode 100644 rust/syn/gen/eq.rs
>  create mode 100644 rust/syn/gen/fold.rs
>  create mode 100644 rust/syn/gen/hash.rs
>  create mode 100644 rust/syn/gen/visit.rs
>  create mode 100644 rust/syn/gen/visit_mut.rs
>  create mode 100644 rust/syn/generics.rs
>  create mode 100644 rust/syn/group.rs
>  create mode 100644 rust/syn/ident.rs
>  create mode 100644 rust/syn/item.rs
>  create mode 100644 rust/syn/lib.rs
>  create mode 100644 rust/syn/lifetime.rs
>  create mode 100644 rust/syn/lit.rs
>  create mode 100644 rust/syn/lookahead.rs
>  create mode 100644 rust/syn/mac.rs
>  create mode 100644 rust/syn/macros.rs
>  create mode 100644 rust/syn/meta.rs
>  create mode 100644 rust/syn/op.rs
>  create mode 100644 rust/syn/parse.rs
>  create mode 100644 rust/syn/parse_macro_input.rs
>  create mode 100644 rust/syn/parse_quote.rs
>  create mode 100644 rust/syn/pat.rs
>  create mode 100644 rust/syn/path.rs
>  create mode 100644 rust/syn/precedence.rs
>  create mode 100644 rust/syn/print.rs
>  create mode 100644 rust/syn/punctuated.rs
>  create mode 100644 rust/syn/restriction.rs
>  create mode 100644 rust/syn/scan_expr.rs
>  create mode 100644 rust/syn/sealed.rs
>  create mode 100644 rust/syn/span.rs
>  create mode 100644 rust/syn/spanned.rs
>  create mode 100644 rust/syn/stmt.rs
>  create mode 100644 rust/syn/thread.rs
>  create mode 100644 rust/syn/token.rs
>  create mode 100644 rust/syn/tt.rs
>  create mode 100644 rust/syn/ty.rs
>  create mode 100644 rust/syn/verbatim.rs
>  create mode 100644 rust/syn/whitespace.rs
> 
> --
> 2.51.2


  parent reply	other threads:[~2025-11-10 13:59 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  9:50 [PATCH 00/18] `syn` support Miguel Ojeda
2025-11-10  9:50 ` [PATCH 01/18] rust: condvar: avoid `pub` in example Miguel Ojeda
2025-11-10 10:24   ` Alice Ryhl
2025-11-10 11:10     ` Miguel Ojeda
2025-11-10  9:50 ` [PATCH 02/18] rust: kbuild: introduce `core-flags` and `core-skip_flags` Miguel Ojeda
2025-11-10 10:19   ` Miguel Ojeda
2025-11-10 11:50     ` Alice Ryhl
2025-11-10 10:27   ` Alice Ryhl
2025-11-10 19:18   ` John Hubbard
2025-11-12 11:13     ` Miguel Ojeda
2025-11-10  9:50 ` [PATCH 03/18] rust: kbuild: simplify `--cfg` handling Miguel Ojeda
2025-11-10 10:33   ` Alice Ryhl
2025-11-10  9:50 ` [PATCH 04/18] rust: kbuild: add host library support Miguel Ojeda
2025-11-10 10:43   ` Alice Ryhl
2025-11-10 11:17     ` Miguel Ojeda
2025-11-10  9:50 ` [PATCH 05/18] rust: proc-macro2: import crate Miguel Ojeda
2025-11-10  9:50 ` [PATCH 06/18] rust: proc-macro2: add SPDX License Identifiers Miguel Ojeda
2025-11-10  9:50 ` [PATCH 07/18] rust: proc-macro2: remove `unicode_ident` dependency Miguel Ojeda
2025-11-10 10:50   ` Alice Ryhl
2025-11-10  9:50 ` [PATCH 08/18] rust: proc-macro2: add `README.md` Miguel Ojeda
2025-11-10 10:52   ` Alice Ryhl
2025-11-10  9:50 ` [PATCH 09/18] rust: proc-macro2: enable support in kbuild Miguel Ojeda
2025-11-10 11:38   ` Alice Ryhl
2025-11-10 13:10     ` Gary Guo
2025-11-10 13:28       ` Miguel Ojeda
2025-11-10 13:34         ` Alice Ryhl
2025-11-10 19:34   ` John Hubbard
2025-11-12 11:14     ` Miguel Ojeda
2025-11-24 19:36       ` John Hubbard
2025-11-24 20:00         ` Miguel Ojeda
2025-11-24 20:21           ` John Hubbard
2025-11-10  9:50 ` [PATCH 10/18] rust: quote: import crate Miguel Ojeda
2025-11-10  9:50 ` [PATCH 11/18] rust: quote: add SPDX License Identifiers Miguel Ojeda
2025-11-10  9:50 ` [PATCH 12/18] rust: quote: add `README.md` Miguel Ojeda
2025-11-10  9:50 ` [PATCH 13/18] rust: quote: enable support in kbuild Miguel Ojeda
2025-11-10 11:44   ` Alice Ryhl
2025-11-10 13:13     ` Gary Guo
2025-11-10 13:22       ` Miguel Ojeda
2025-11-10 13:35         ` Alice Ryhl
2025-11-10  9:50 ` [PATCH 14/18] rust: syn: import crate Miguel Ojeda
2025-11-10 10:26   ` Miguel Ojeda
2025-11-10  9:50 ` [PATCH 15/18] rust: syn: add SPDX License Identifiers Miguel Ojeda
2025-11-10  9:50 ` [PATCH 16/18] rust: syn: remove `unicode-ident` dependency Miguel Ojeda
2025-11-10 11:47   ` Alice Ryhl
2025-11-10  9:50 ` [PATCH 17/18] rust: syn: add `README.md` Miguel Ojeda
2025-11-10 11:47   ` Alice Ryhl
2025-11-10  9:50 ` [PATCH 18/18] rust: syn: enable support in kbuild Miguel Ojeda
2025-11-10 11:49   ` Alice Ryhl
2025-11-10 13:38     ` Miguel Ojeda
2025-11-10 13:42       ` Alice Ryhl
2025-11-10 19:43   ` John Hubbard
2025-11-10 13:59 ` Gary Guo [this message]
2025-11-10 14:20   ` [PATCH 00/18] `syn` support Miguel Ojeda
2025-11-21  4:37   ` Jesung Yang
2025-11-21  5:36     ` Miguel Ojeda
2025-11-21  9:08       ` Jesung Yang
2025-11-23 12:50         ` Miguel Ojeda
2025-11-23 22:46           ` Jesung Yang
2025-11-10 15:59 ` Jonathan Corbet
2025-11-10 16:27   ` Miguel Ojeda
2025-11-10 17:04     ` Benno Lossin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251110135927.05d83da2@eugeo \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).