From d32fc0563d629eac112f0b7b5b0f21d434f0a74b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 17 May 2021 12:06:01 -0700 Subject: 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". --- mesonbuild/compilers/rust.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mesonbuild/compilers/rust.py') 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"] -- cgit v1.1