Skip to content

Commit 2cd2b9a

Browse files
committed
Avoid passing rustc as second parameter to clippy-driver
It turns out that is only a workaround intended for `cargo`. The official instructions since PR [1] describe the usage of `clippy-driver`, and they intentionally only cover replacing `rustc` with `clippy-driver` rather than wrapping it, as discussed in that PR. [1] rust-lang/rust-clippy#6782 Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 302e275 commit 2cd2b9a

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,15 @@ KBUILD_LDFLAGS :=
525525
CLANG_FLAGS :=
526526

527527
ifeq ($(KBUILD_CLIPPY),1)
528-
CLIPPY_QUIET_TAG := CLIPPY$(space)
528+
RUSTC_OR_CLIPPY_QUIET := CLIPPY
529+
RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER)
529530
else
530-
CLIPPY_QUIET_TAG :=
531-
CLIPPY_DRIVER :=
531+
RUSTC_OR_CLIPPY_QUIET := RUSTC
532+
RUSTC_OR_CLIPPY = $(RUSTC)
532533
endif
533-
export CLIPPY_QUIET_TAG
534+
export RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY
534535

535-
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC RUSTC CLIPPY_DRIVER BINDGEN
536+
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC RUSTC BINDGEN
536537
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
537538
export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
538539
export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD

rust/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ $(objtree)/rust/exports_kernel_generated.h: $(objtree)/rust/kernel.o FORCE
9090

9191
# `-Cpanic=unwind -Cforce-unwind-tables=y` overrides `rustc_flags` in order to
9292
# avoid the https://github.com/rust-lang/rust/issues/82320 rustc crash.
93-
quiet_cmd_rustc_procmacro = RUSTC P $(CLIPPY_QUIET_TAG)$@
93+
quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
9494
cmd_rustc_procmacro = \
95-
$(CLIPPY_DRIVER) $(RUSTC) $(rustc_flags) --emit=dep-info,link --extern proc_macro \
95+
$(RUSTC_OR_CLIPPY) $(rustc_flags) \
96+
--emit=dep-info,link --extern proc_macro \
9697
-Cpanic=unwind -Cforce-unwind-tables=y \
9798
--crate-type proc-macro --out-dir $(objtree)/rust/ \
9899
--crate-name $(patsubst lib%.so,%,$(notdir $@)) $<; \
@@ -102,11 +103,11 @@ quiet_cmd_rustc_procmacro = RUSTC P $(CLIPPY_QUIET_TAG)$@
102103
$(objtree)/rust/libmodule.so: $(srctree)/rust/module.rs FORCE
103104
$(call if_changed_dep,rustc_procmacro)
104105

105-
quiet_cmd_rustc_library = RUSTC L $(if $(skip_clippy),,$(CLIPPY_QUIET_TAG))$@
106+
quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L $@
106107
cmd_rustc_library = \
107108
RUST_BINDINGS_FILE=$(abspath $(objtree)/rust/bindings_generated.rs) \
108-
$(if $(skip_clippy),,$(CLIPPY_DRIVER)) $(RUSTC) $(rustc_flags) \
109-
$(rustc_cross_flags) $(rustc_target_flags) \
109+
$(if $(skip_clippy),$(RUSTC),$(RUSTC_OR_CLIPPY)) \
110+
$(rustc_flags) $(rustc_cross_flags) $(rustc_target_flags) \
110111
--crate-type rlib --out-dir $(objtree)/rust/ -L $(objtree)/rust/ \
111112
--crate-name $(patsubst %.o,%,$(notdir $@)) $<; \
112113
mv $(objtree)/rust/$(patsubst %.o,%,$(notdir $@)).d $(depfile); \

scripts/Makefile.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ $(obj)/%.lst: $(src)/%.c FORCE
301301

302302
rustc_cross_flags := --target=$(srctree)/arch/$(SRCARCH)/rust/target.json
303303

304-
quiet_cmd_rustc_o_rs = RUSTC $(CLIPPY_QUIET_TAG)$(quiet_modtag) $@
304+
quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
305305
cmd_rustc_o_rs = \
306306
RUST_MODFILE=$(modfile) \
307-
$(CLIPPY_DRIVER) $(RUSTC) $(rustc_flags) $(rustc_cross_flags) \
307+
$(RUSTC_OR_CLIPPY) $(rustc_flags) $(rustc_cross_flags) \
308308
--extern alloc --extern kernel \
309309
--crate-type rlib --out-dir $(obj) -L $(objtree)/rust/ \
310310
--crate-name $(patsubst %.o,%,$(notdir $@)) $<; \

0 commit comments

Comments
 (0)