Skip to content

Commit

Permalink
rust: raise a warning if clippy is used instead of rustc
Browse files Browse the repository at this point in the history
clippy-driver is not meant to be a general-purpose compiler front-end.
Since Meson can now provide natively the ability to invoke clippy,
raise a warning if someone uses it that way.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Nov 17, 2024
1 parent 033b937 commit ae3c594
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/markdown/snippets/clippy.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
Meson now defines a `clippy` target if the project uses the Rust programming
language. The target runs clippy on all Rust sources, using the `clippy-driver`
program from the same Rust toolchain as the `rustc` compiler.

Using `clippy-driver` as the Rust compiler will now emit a warning, as it
is not meant to be a general-purpose compiler front-end.
4 changes: 4 additions & 0 deletions mesonbuild/compilers/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,10 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
version = search_version(out)

cls = rust.ClippyRustCompiler
mlog.warning(
'clippy-driver is not intended as a general purpose compiler. '
'You can use "ninja clippy" in order to run clippy on a '
'meson project.')

if 'rustc' in out:
# On Linux and mac rustc will invoke gcc (clang for mac
Expand Down

0 comments on commit ae3c594

Please sign in to comment.