Skip to content

Commit

Permalink
rust: change warning_level=0 to "--cap-lints allow"
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bonzini committed Dec 20, 2024
1 parent 79fc894 commit 94966d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/markdown/Builtin-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/compilers/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit 94966d5

Please sign in to comment.