aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/snippets/rustc-improvements.md1
-rw-r--r--mesonbuild/compilers/rust.py14
2 files changed, 15 insertions, 0 deletions
diff --git a/docs/markdown/snippets/rustc-improvements.md b/docs/markdown/snippets/rustc-improvements.md
index 2db0a11..e874b38 100644
--- a/docs/markdown/snippets/rustc-improvements.md
+++ b/docs/markdown/snippets/rustc-improvements.md
@@ -2,3 +2,4 @@
- Werror now works, this set's `-D warnings`, which will cause rustc to error
for every warning not explicitly disabled
+- warning levels have been implemented
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index 10f54ef..f11d240 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -45,6 +45,13 @@ class RustCompiler(Compiler):
# rustc doesn't invoke the compiler itself, it doesn't need a LINKER_PREFIX
language = 'rust'
+ _WARNING_LEVELS: T.Dict[str, T.List[str]] = {
+ '0': ['-A', 'warnings'],
+ '1': [],
+ '2': [],
+ '3': ['-W', 'warnings'],
+ }
+
def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice,
is_cross: bool, info: 'MachineInfo',
exe_wrapper: T.Optional['ExternalProgram'] = None,
@@ -173,3 +180,10 @@ class RustCompiler(Compiler):
# Use -D warnings, which makes every warning not explicitly allowed an
# error
return ['-D', 'warnings']
+
+ def get_warn_args(self, level: str) -> T.List[str]:
+ # TODO: I'm not really sure what to put here, Rustc doesn't have warning
+ return self._WARNING_LEVELS[level]
+
+ def get_no_warn_args(self) -> T.List[str]:
+ return self._WARNING_LEVELS["0"]