From 94966d52f5961440909b0d37d02956798a0a3596 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 20 Dec 2024 18:46:33 +0100 Subject: [PATCH] rust: change warning_level=0 to "--cap-lints allow" This is a better and more backwards-compatible way to disable all warnings, compared to "-A warnings". The Rust RFC (https://rust-lang.github.io/rfcs/1193-cap-lints.html) explains the rationale: > We would very much like to be able to modify lints, however. For example > rust-lang/rust#26473 updated the missing_docs lint to also look for missing > documentation on const items. This ended up breaking some crates in the > ecosystem due to their usage of #![deny(missing_docs)]. While at it, document that Rust deviates from the other languages in its interpretation of warning_level=0. Signed-off-by: Paolo Bonzini --- docs/markdown/Builtin-options.md | 2 ++ mesonbuild/compilers/rust.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index f16a46ffebea..3a912805a057 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -98,6 +98,8 @@ machine](#specifying-options-per-machine) section for details. | force_fallback_for | [] | Force fallback for those dependencies | no | no | | vsenv | false | Activate Visual Studio environment | no | no | +(For the Rust language only, `warning_level=0` disables all warnings). + #### Details for `backend` Several build file formats are supported as command runners to build the diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 717d5635f842..bc3f4cb6c999 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -69,7 +69,7 @@ class RustCompiler(Compiler): id = 'rustc' _WARNING_LEVELS: T.Dict[str, T.List[str]] = { - '0': ['-A', 'warnings'], + '0': ['--cap-lints', 'allow'], '1': [], '2': [], '3': ['-W', 'warnings'],