From: "Alex Bennée" <alex.bennee@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, manos.pitsidianakis@linaro.org,
kwolf@redhat.com, junjie.mao@hotmail.com, zhao1.liu@intel.com,
qemu-rust@nondevel.org
Subject: Re: [RFC PATCH 00/11] rust: improved integration with cargo
Date: Thu, 14 Nov 2024 13:07:46 +0000 [thread overview]
Message-ID: <87plmyrmjh.fsf@draig.linaro.org> (raw)
In-Reply-To: <20241108180139.117112-1-pbonzini@redhat.com> (Paolo Bonzini's message of "Fri, 8 Nov 2024 19:01:28 +0100")
Paolo Bonzini <pbonzini@redhat.com> writes:
> While we're not sure where we'll be going in the future, for now
> using cargo remains an important part of developing QEMU Rust code.
> This is because cargo is the easiest way to run clippy, rustfmt,
> rustdoc. Cargo also allows working with doc tests, though there are
> pretty much none yet, and provides tools such as "cargo expand".
>
> This series aims at improving the integration with cargo and
> cargo-based tooling.
>
> First, while it is currently possible to run cargo on the rust/ directory,
> but it has the issue that the bindings.rs must be placed by hand in
> the build directory. Therefore, this series starts by allowing
> cargo to "just work" when run in a "meson devenv" environment:
>
> meson devenv -w ../rust cargo clippy --tests
> meson devenv -w ../rust cargo fmt
Is this meant to be the rust source root, or the root of the rust
builddir:
$ meson devenv ../../rust
ERROR: Build data file './meson-private/build.dat' references functions or classes that don't exist. This probably means that it was generated with an old version of meson. Try running from the source directory meson setup . --wipe
🕙13:05:22 alex@draig:qemu.git/builds/rust on review/rust-cargo-rfc [$!?] [🔴 ERROR]
$ meson devenv rust
ERROR: Build data file './meson-private/build.dat' references functions or classes that don't exist. This probably means that it was generated with an old version of meson. Try running from the source directory meson setup . --wipe
🕙13:05:53 alex@draig:qemu.git/builds/rust on review/rust-cargo-rfc [$!?] [🔴 ERROR]
>
> If you are going to use cargo repeatedly, invoking just 'meson devenv'
> will put you in a shell where commands like 'cargo clippy' just work.
> For simplicity, I am also adding two targets 'make clippy' and 'make
> rustfmt'.
>
> Secondly, one problem with mixing Cargo and meson is having to redo the
> configuration of "lints" in both sides. This series standardizes
> on using Cargo.toml to configure the build, and bringing the flags
> over to build.ninja with extensions to the existing rustc_args.py script.
> I admit that these additions to the script are pretty large and therefore
> I'm open to scrapping the idea. I tried to organize the changes so that
> the changes are split over multiple patches.
>
> Finally, this series adds a CI job that runs rustfmt, clippy, and
> rustdoc, including running doctests.
>
> Please send comments!
>
> Paolo
>
> Paolo Bonzini (11):
> rust: qemu_api: do not disable lints outside bindgen-generated code
> rust: build: move rustc_args.py invocation to individual crates
> rust: build: restrict --cfg generation to only required symbols
> rust: build: generate warning flags from Cargo.toml
> rust: cargo: store desired warning levels in workspace Cargo.toml
> rust: build: move strict lints handling to rustc_args.py
> rust: fix a couple style issues from clippy
> rust: build: establish a baseline of lints across all crates
> rust: build: add "make clippy", "make rustfmt"
> rust: fix doc test syntax
> rust: ci: add job that runs Rust tools
>
> meson.build | 56 +++---
> .gitlab-ci.d/buildtest-template.yml | 14 ++
> .gitlab-ci.d/buildtest.yml | 14 ++
> rust/Cargo.toml | 80 ++++++++
> rust/hw/char/pl011/Cargo.toml | 3 +
> rust/hw/char/pl011/src/device.rs | 6 +-
> rust/hw/char/pl011/src/lib.rs | 18 +-
> rust/hw/char/pl011/src/memory_ops.rs | 4 +-
> rust/meson.build | 14 ++
> rust/qemu-api-macros/Cargo.toml | 3 +
> rust/qemu-api/.gitignore | 2 +-
> rust/qemu-api/Cargo.toml | 5 +-
> rust/qemu-api/build.rs | 24 ++-
> rust/qemu-api/meson.build | 5 +
> rust/qemu-api/src/bindings.rs | 29 +++
> rust/qemu-api/src/lib.rs | 22 ---
> rust/qemu-api/src/zeroable.rs | 6 +-
> rust/qemu-api/tests/tests.rs | 2 +-
> scripts/rust/rustc_args.py | 178 ++++++++++++++++--
> .../dockerfiles/fedora-rust-nightly.docker | 4 +
> tests/lcitool/refresh | 4 +
> 21 files changed, 391 insertions(+), 102 deletions(-)
> create mode 100644 rust/qemu-api/src/bindings.rs
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-11-14 13:08 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 18:01 [RFC PATCH 00/11] rust: improved integration with cargo Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 01/11] rust: qemu_api: do not disable lints outside bindgen-generated code Paolo Bonzini
2024-11-12 2:25 ` Junjie Mao
2024-11-12 5:33 ` Paolo Bonzini
2024-11-12 10:10 ` Junjie Mao
2024-11-12 18:47 ` Paolo Bonzini
2024-11-13 6:46 ` Junjie Mao
2024-11-13 10:41 ` Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 02/11] rust: build: move rustc_args.py invocation to individual crates Paolo Bonzini
2024-11-12 3:02 ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 03/11] rust: build: restrict --cfg generation to only required symbols Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 04/11] rust: build: generate warning flags from Cargo.toml Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 05/11] rust: cargo: store desired warning levels in workspace Cargo.toml Paolo Bonzini
2024-11-12 3:12 ` Junjie Mao
2024-11-12 5:28 ` Paolo Bonzini
2024-11-12 5:40 ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 06/11] rust: build: move strict lints handling to rustc_args.py Paolo Bonzini
2024-11-08 18:01 ` [RFC PATCH 07/11] rust: fix a couple style issues from clippy Paolo Bonzini
2024-11-13 6:59 ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 08/11] rust: build: establish a baseline of lints across all crates Paolo Bonzini
2024-11-13 7:14 ` Junjie Mao
2024-11-13 10:02 ` Paolo Bonzini
2024-11-13 10:13 ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 09/11] rust: build: add "make clippy", "make rustfmt" Paolo Bonzini
2024-11-13 7:20 ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 10/11] rust: fix doc test syntax Paolo Bonzini
2024-11-13 7:22 ` Junjie Mao
2024-11-08 18:01 ` [RFC PATCH 11/11] rust: ci: add job that runs Rust tools Paolo Bonzini
2024-11-08 18:12 ` Daniel P. Berrangé
2024-11-14 13:07 ` Alex Bennée [this message]
2024-11-14 13:11 ` [RFC PATCH 00/11] rust: improved integration with cargo Paolo Bonzini
2024-11-14 15:22 ` Alex Bennée
2024-11-14 15:38 ` Paolo Bonzini
2024-11-14 17:27 ` Alex Bennée
2024-11-14 18:18 ` Paolo Bonzini
2024-11-14 21:13 ` Alex Bennée
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=87plmyrmjh.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=junjie.mao@hotmail.com \
--cc=kwolf@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nondevel.org \
--cc=zhao1.liu@intel.com \
/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).