Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: relax most deny-level lints to warnings

Since we are starting to support several Rust toolchains, lints (including
Clippy ones) now may behave differently and lint groups may include
new lints.

Therefore, to maximize the chances a given version works, relax some
deny-level lints to warnings. It may also make our lives a bit easier
while developing new code or refactoring.

To be clear, the requirements for in-tree code are still the same, since
Rust code still needs to be warning-free (patches should be clean under
`WERROR=y`) and the set of lints is not changed.

`unsafe_op_in_unsafe_fn` is left unmodified, i.e. as an error, since it is
becoming the default in the language (warn-by-default in Rust 2024 [1] and
ideally an error later on) and thus it should also be very well tested. In
addition, it is simple enough that it should not have false positives
(unlike e.g. `rust_2018_idioms`'s `explicit_outlives_requirements`).

`non_ascii_idents` is left unmodified as well, i.e. as an error, since
it is unlikely one gains any productivity during development if it
were a warning (in fact, it may be worse, since it is likely one made
a typo). In addition, it should not have false positives.

Finally, put the two `-D` ones at the top and take the chance to do one
per line.

Link: https://github.com/rust-lang/rust/pull/112038 [1]
Reviewed-by: Finn Behrens <me@kloenk.dev>
Tested-by: Benno Lossin <benno.lossin@proton.me>
Tested-by: Andreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20240709160615.998336-5-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

+15 -13
+13 -11
Makefile
··· 461 461 # host programs. 462 462 export rust_common_flags := --edition=2021 \ 463 463 -Zbinary_dep_depinfo=y \ 464 - -Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \ 465 - -Dunreachable_pub -Dnon_ascii_idents \ 464 + -Dunsafe_op_in_unsafe_fn \ 465 + -Dnon_ascii_idents \ 466 + -Wrust_2018_idioms \ 467 + -Wunreachable_pub \ 466 468 -Wmissing_docs \ 467 - -Drustdoc::missing_crate_level_docs \ 468 - -Dclippy::correctness -Dclippy::style \ 469 - -Dclippy::suspicious -Dclippy::complexity \ 470 - -Dclippy::perf \ 471 - -Dclippy::let_unit_value -Dclippy::mut_mut \ 472 - -Dclippy::needless_bitwise_bool \ 473 - -Dclippy::needless_continue \ 474 - -Dclippy::no_mangle_with_rust_abi \ 469 + -Wrustdoc::missing_crate_level_docs \ 470 + -Wclippy::correctness -Wclippy::style \ 471 + -Wclippy::suspicious -Wclippy::complexity \ 472 + -Wclippy::perf \ 473 + -Wclippy::let_unit_value -Wclippy::mut_mut \ 474 + -Wclippy::needless_bitwise_bool \ 475 + -Wclippy::needless_continue \ 476 + -Wclippy::no_mangle_with_rust_abi \ 475 477 -Wclippy::dbg_macro 476 478 477 479 KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) ··· 574 572 -Csymbol-mangling-version=v0 \ 575 573 -Crelocation-model=static \ 576 574 -Zfunction-sections=n \ 577 - -Dclippy::float_arithmetic 575 + -Wclippy::float_arithmetic 578 576 579 577 KBUILD_AFLAGS_KERNEL := 580 578 KBUILD_CFLAGS_KERNEL :=
+2 -2
rust/Makefile
··· 367 367 endif 368 368 369 369 $(obj)/core.o: private skip_clippy = 1 370 - $(obj)/core.o: private skip_flags = -Dunreachable_pub 370 + $(obj)/core.o: private skip_flags = -Wunreachable_pub 371 371 $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym)) 372 372 $(obj)/core.o: private rustc_target_flags = $(core-cfgs) 373 373 $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE ··· 381 381 +$(call if_changed_dep,rustc_library) 382 382 383 383 $(obj)/alloc.o: private skip_clippy = 1 384 - $(obj)/alloc.o: private skip_flags = -Dunreachable_pub 384 + $(obj)/alloc.o: private skip_flags = -Wunreachable_pub 385 385 $(obj)/alloc.o: private rustc_target_flags = $(alloc-cfgs) 386 386 $(obj)/alloc.o: $(RUST_LIB_SRC)/alloc/src/lib.rs $(obj)/compiler_builtins.o FORCE 387 387 +$(call if_changed_dep,rustc_library)