From: Nicolas Schier <nsc@kernel.org>
To: "Onur Özkan" <work@onurozkan.dev>
Cc: rust-for-linux@vger.kernel.org, ojeda@kernel.org,
nathan@kernel.org, masahiroy@kernel.org, aliceryhl@google.com,
thomas.weissschuh@linutronix.de, tamird@gmail.com,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org
Subject: Re: [PATCH v2 1/1] rust: add `rustcheck` make target for check-only builds
Date: Fri, 10 Oct 2025 20:56:29 +0200 [thread overview]
Message-ID: <aOlW3RFO9sm6IsIB@levanger> (raw)
In-Reply-To: <20250923064720.0b2ea467@nimda>
On Tue, Sep 23, 2025 at 06:47:20AM +0300, Onur Özkan wrote:
> On Mon, 22 Sep 2025 08:02:36 +0200
> Nicolas Schier <nicolas.schier@linux.dev> wrote:
>
> > On Mon, Sep 15, 2025 at 02:53:11PM +0300, Onur Özkan wrote:
> > > Adds a new `rustcheck` make target to run a check-only build
> > > similar to `cargo check`. This allows us to verify that the Rust
> > > sources can build without building/linking final artifacts,
> > > which speeds up the iteration (a lot) during development.
> > >
> > > The target also supports the CLIPPY flag (e.g., `make LLVM=1
> > > rustcheck CLIPPY=1) to run Clippy in a faster way.
> > >
> > > Also, unlike `make LLVM=1`, it doesn't compile large amounts of C
> > > code (on a fresh checkout) when the goal is only to check that
> > > Rust builds are not broken after some changes.
> > >
> > > Suggested-by: Benno Losin <lossin@kernel.org>
> > > Link:
> > > https://rust-for-linux.zulipchat.com/#narrow/channel/288089/topic/x/near/539103602
> > > Signed-off-by: Onur Özkan <work@onurozkan.dev> ---
> > > Makefile | 7 +++++
> > > rust/Makefile | 73
> > > +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files
> > > changed, 80 insertions(+)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index cf37b9407821..7812cdc72938 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -1716,6 +1716,8 @@ help:
> > > @echo ' is formatted, printing a diff
> > > otherwise.' @echo ' rustdoc - Generate Rust
> > > documentation' @echo ' (requires kernel
> > > .config)'
> > > + @echo ' rustcheck - Check that the Rust code
> > > builds'
> > > + @echo ' (requires kernel .config)'
> > > @echo ' rusttest - Runs the Rust tests'
> > > @echo ' (requires kernel .config;
> > > downloads external repos)' @echo ' rust-analyzer -
> > > Generate rust-project.json rust-analyzer support file' @@ -1821,6
> > > +1823,11 @@ PHONY += rustdoc rustdoc: prepare
> > > $(Q)$(MAKE) $(build)=rust $@
> > >
> > > +# Checking Rust sources.
> > > +PHONY += rustcheck
> > > +rustcheck: prepare0
> >
> > Why do you let rustcheck depend on prepare0 instead of prepare?
> >
>
> Because "prepare" does more job which isn't necessary (therefore waste
> of time) for "rustcheck".
>
> > > + $(Q)$(MAKE) $(build)=rust $@
> > > +
> > > # Testing target
> > > PHONY += rusttest
> > > rusttest: prepare
> > > diff --git a/rust/Makefile b/rust/Makefile
> > > index bfa915b0e588..b45878870207 100644
> > > --- a/rust/Makefile
> > > +++ b/rust/Makefile
> > > @@ -265,6 +265,79 @@ rusttest-kernel: $(src)/kernel/lib.rs
> > > rusttestlib-ffi rusttestlib-kernel \ rusttestlib-uapi
> > > rusttestlib-pin_init FORCE +$(call if_changed,rustc_test)
> > >
> > > +## Check-only compilation (similar to `cargo check`)
> > > +quiet_cmd_rustc_check_library = $(RUSTC_OR_CLIPPY_QUIET) CHECK $<
> > > + cmd_rustc_check_library = \
> > > + OBJTREE=$(abspath $(objtree)) \
> >
> > Have you tried this?
> >
> > OBJTREE=$(CURDIR) \
> >
> > or
> >
> > OBJTREE=$(abs_output) \
> >
> > I'd favor using one of these instead.
> >
>
> I don't have a strong opinion on any of them. I followed the existing
> approach from the other use cases used in the same file.
well, you're right, it's not really consistent right now.
Acked-by: Nicolas Schier <nsc@kernel.org>
next prev parent reply other threads:[~2025-10-10 18:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 11:53 [PATCH v2 0/1] rust: add `rustcheck` make target for check-only builds Onur Özkan
2025-09-15 11:53 ` [PATCH v2 1/1] " Onur Özkan
2025-09-22 6:02 ` Nicolas Schier
2025-09-23 3:47 ` Onur Özkan
2025-10-10 18:56 ` Nicolas Schier [this message]
2025-09-16 12:06 ` [PATCH v2 0/1] " Onur
2025-10-09 12:54 ` Onur Özkan
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=aOlW3RFO9sm6IsIB@levanger \
--to=nsc@kernel.org \
--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=gary@garyguo.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@gmail.com \
--cc=thomas.weissschuh@linutronix.de \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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).