summary refs log tree commit diff stats
path: root/scripts/rust/rustc_args.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* rust: use native Meson support for clippy and rustdocPaolo Bonzini2025-06-031-4/+1
| | | | | | | | | | | | Meson has support for invoking clippy and rustdoc on all crates (1.7.0 for clippy, 1.8.0 for rustdoc). Use it instead of the homegrown version; this requires disabling the multiple_crate_versions lint (the only one that was enabled from the "cargo" group)---which was not particularly useful anyway because all dependencies are converted by hand into Meson subprojects. rustfmt is still not supported. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* rust: add --check-cfg test to rustc argumentsPaolo Bonzini2025-01-101-0/+2
| | | | | | | | | rustc will check that every reachable #[cfg] matches a list of the expected config names and values. Recent versions of rustc are also complaining about #[cfg(test)], even if it is basically a standard part of the language. So, always allow it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* rust: build: move strict lints handling to rustc_args.pyPaolo Bonzini2024-12-101-3/+16
| | | | | | | | Make Cargo use unknown_lints = "allow" as well. This is more future proof as we might add new lints to rust/Cargo.toml that are not supported by older versions of rustc or clippy. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* rust: cargo: store desired warning levels in workspace Cargo.tomlPaolo Bonzini2024-12-101-6/+32
| | | | | | | | | | | | | | | An extra benefit of workspaces is that they allow to place lint level settings in a single Cargo.toml; the settings are then inherited by packages in the workspace. Correspondingly, teach rustc_args.py to get the unexpected_cfgs configuration from the workspace Cargo.toml. Note that it is still possible to allow or deny warnings per crate or module, via the #![] attribute syntax. The rust/qemu-api/src/bindings.rs file is an example. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* rust: build: generate lint flags from Cargo.tomlPaolo Bonzini2024-12-101-1/+82
| | | | | | | | | | | | | Cargo.toml makes it possible to describe the desired lint level settings in a nice format. We can extend this to Meson-built crates, by teaching rustc_args.py to fetch lint and --check-cfg arguments from Cargo.toml. --check-cfg arguments come from the unexpected_cfgs lint as well as crate features Start with qemu-api, since it already has a [lints.rust] table and an invocation of rustc_args.py. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* rust: build: restrict --cfg generation to only required symbolsPaolo Bonzini2024-12-101-16/+45
| | | | | | | | | Parse the Cargo.toml file, looking for the unexpected_cfgs configuration. When generating --cfg options from the config-host.h file, only use those that are included in the configuration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* rust: add bindgen step as a meson dependencyManos Pitsidianakis2024-10-111-0/+84
Add bindings_rs target for generating rust bindings to target-independent qemu C APIs. The bindings need be created before any rust crate that uses them is compiled. The bindings.rs file will end up in BUILDDIR/bindings.rs and have the same name as a target: ninja bindings.rs Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Link: https://lore.kernel.org/r/1be89a27719049b7203eaf2eca8bbb75b33f18d4.1727961605.git.manos.pitsidianakis@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>