[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72kMh2QYZF5gLzSZVOxgZz8Or07c4FxzWNXN1_4CwkBVJA@mail.gmail.com>
Date: Fri, 23 Jan 2026 11:26:44 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: engineer.jjhama@...il.com
Cc: Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts: generate_rust_analyzer.py: better pin-init macro resolvea
On Fri, Jan 23, 2026 at 11:02 AM SeungJong Ha via B4 Relay
<devnull+engineer.jjhama.gmail.com@...nel.org> wrote:
>
> From: SeungJong Ha <engineer.jjhama@...il.com>
>
> Signed-off-by: SeungJong Ha <engineer.jjhama@...il.com>
The commit message appears to be empty -- I think you may have wanted
to use the text below the `---`, since I see another title there
(although it isn't exactly worded like the usual commit message
either, i.e. with "Hello" etc., so I am not sure what happened in this
one).
Also, typo in the (patch) title.
> @@ -123,10 +123,18 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
> append_crate(
> "pin_init_internal",
> srctree / "rust" / "pin-init" / "internal" / "src" / "lib.rs",
> - [],
> + ["std", "proc_macro"],
> cfg=["kernel"],
> is_proc_macro=True,
> )
Is this commit 74e15ac34b09 ("scripts: generate_rust_analyzer: Add
pin_init_internal deps")?
I think you based this on top of `rust-next` so you did not see the
fixes currently queued in `rust-fixes` (soon to arrive in mainline).
> + # pin_init_internal uses #[path = "../../../macros/quote.rs"] to include quote.rs
For comments etc., we use the usual style used in other Rust files, e.g.
# `pin_init_internal` uses `#[path = "../../../macros/quote.rs"]`
to include `quote.rs`.
> + str(srctree / "rust" / "pin-init" / "internal" / "src"),
> + str(srctree / "rust" / "macros"),
There is this rule in rust-analyzer about `source`:
/// If two crates share an `.rs` file in common,
/// they *must* have the same `source`.
/// rust-analyzer assumes that files from one
/// source can't refer to files in another source.
I am not sure how that is supposed to work or why rust-analyzer
requires it, i.e. does it mean `macros` must have also the `pin-init`
path too? Or just that, for each file, the path that included it (not
the entire `source`) must match?
If the former, we may be also "abusing" it in the other place we use
`source` for the generated files. If the latter, then it is fine
there, but here we would need `macros` to also have the path, I guess.
Or perhaps that "rule" in the docs isn't as strict as it sounds?
Thanks!
Cheers,
Miguel
Powered by blists - more mailing lists