All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jesung Yang" <y.j3ms.n@gmail.com>
To: "Eliot Courtney" <ecourtney@nvidia.com>,
	"Jesung Yang" <y.j3ms.n@gmail.com>,
	"Tamir Duberstein" <tamird@kernel.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"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>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH 6/6] scripts: generate_rust_analyzer: move sysroot crates to sysroot_project
Date: Thu, 22 Jan 2026 20:06:24 +0900	[thread overview]
Message-ID: <DFV2IL7N8X9O.2DLY12HALP8AA@gmail.com> (raw)
In-Reply-To: <DFV0C3T2RXW8.1F3G0Q7R999TC@nvidia.com>

On Thu Jan 22, 2026 at 6:23 PM KST, Eliot Courtney wrote:
> On Wed Jan 21, 2026 at 9:01 AM JST, Jesung Yang wrote:
>> I still think the versioning infrastructure is a prerequisite as we're
>> using the `sysroot_src` field here.
>>
>> If we specify `sysroot_src` without `crate_attrs = ["no_std"]`,
>> rust-analyzer treats `std` as a dependency for all local crates by
>> default. Consequently, any rust-analyzer version lacking `crate_attrs`
>> support (which silently ignores `crate_attrs = ["no_std"]`) would
>> incorrectly assume an implicit `std` dependency for all kernel modules.
>> Having the versioning infrastructure first allows us to handle this
>> transition without breaking the user experience for those on older
>> toolchains.
> Yeah, I agree that specifying sysroot_src by itself includes std and that
> is potentially an issue.
>
> But, currently due to issues like the relative #[path] include, the
> sysroot crates aren't really processable very well by rust-analyzer
> causing a lot of spurious errors and unresolved symbols, which make
> using the LSP experience pretty bad IMO. OTOH, while the sysroot_src
> approach does include std, it at least makes it usable. Personally I
> find it more useful this way, but I can see the argument for both sides.

So the problem here is that the versioning infrastructure effectively
restricts the use of `sysroot_src` for older rust-analyzer versions
that do not support `crate_attrs`, which leads to yet another bad
experience. Hmm... I would like to hear others' thoughts on this
trade-off, since I don't have a perfect solution at the moment.

> Tangential, but I'm not sure why the drivers don't specify no_std
> themselves - then we wouldn't have to worry about this IIUC.

Perhaps Miguel could chime in and give some details about this, but
you can find a bit of context here [1].

On a separate note: I actually have a previous effort covering
`sysroot_src` and `crate_attrs` [2] that I'd like to land first. It
covers almost the same ground as your 6th patch (minus the
`sysroot_project` use). Since I wrote the `crate-attrs` code in
rust-analyzer itself specifically to improve its usability in the
kernel, I'm hoping to finish the full story on the kernel side. Would
you be open to that?

Thanks!

[1] https://rust-for-linux.zulipchat.com/#narrow/channel/x/topic/x/near/561668361
[2] https://lore.kernel.org/rust-for-linux/20260101-ra-fix-primitive-v1-1-def809357b4e@gmail.com/

Best regards,
Jesung

  reply	other threads:[~2026-01-22 11:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20  8:52 [PATCH 0/6] scripts: generate_rust_analyzer: improve rust-project.json generation Eliot Courtney
2026-01-20  8:52 ` [PATCH 1/6] scripts: generate_rust_analyzer: rename cfg to generated_cfg Eliot Courtney
2026-01-20 15:28   ` Tamir Duberstein
2026-03-02 17:09     ` Tamir Duberstein
2026-01-20  8:52 ` [PATCH 2/6] scripts: generate_rust_analyzer: plumb editions via command line Eliot Courtney
2026-01-20 13:57   ` Miguel Ojeda
2026-01-20 15:28   ` Tamir Duberstein
2026-01-20  8:52 ` [PATCH 3/6] scripts: generate_rust_analyzer: plumb crate-attrs Eliot Courtney
2026-01-20 15:28   ` Tamir Duberstein
2026-01-20  8:52 ` [PATCH 4/6] scripts: generate_rust_analyzer: plumb common crate-attrs for non-host crates Eliot Courtney
2026-01-20 15:28   ` Tamir Duberstein
2026-01-20  8:52 ` [PATCH 5/6] scripts: generate_rust_analyzer: add pin_init to driver crate deps Eliot Courtney
2026-01-20 15:28   ` Tamir Duberstein
2026-01-20  8:52 ` [PATCH 6/6] scripts: generate_rust_analyzer: move sysroot crates to sysroot_project Eliot Courtney
2026-01-20 15:34   ` Tamir Duberstein
2026-01-21  0:01     ` Jesung Yang
2026-01-22  9:23       ` Eliot Courtney
2026-01-22 11:06         ` Jesung Yang [this message]
2026-01-23  5:45           ` Eliot Courtney
2026-01-23 12:08             ` Miguel Ojeda
2026-01-23 12:23               ` Gary Guo
2026-01-23 12:31                 ` Miguel Ojeda
2026-01-20 13:38 ` [PATCH 0/6] scripts: generate_rust_analyzer: improve rust-project.json generation Miguel Ojeda

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=DFV2IL7N8X9O.2DLY12HALP8AA@gmail.com \
    --to=y.j3ms.n@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.