aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/rust.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-05-17 12:06:01 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-09-24 18:48:48 -0700
commitd32fc0563d629eac112f0b7b5b0f21d434f0a74b (patch)
tree5c9463b024558e41c888a56459d07acdb1424492 /mesonbuild/compilers/rust.py
parente2260650a046a54f97f57e76ad6f0c106f96cea0 (diff)
downloadmeson-d32fc0563d629eac112f0b7b5b0f21d434f0a74b.zip
meson-d32fc0563d629eac112f0b7b5b0f21d434f0a74b.tar.gz
meson-d32fc0563d629eac112f0b7b5b0f21d434f0a74b.tar.bz2
compilers/rust: Implement warning levels
Currently this implements 3 warning levels, 1 and 2 are just the "default" set by rustc, 3, is "everything is a warning", and 0 is "nothign is a warning".
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r--mesonbuild/compilers/rust.py14
1 files changed, 14 insertions, 0 deletions
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"]