diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-04-13 14:42:27 +0300 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2023-04-14 15:52:54 +0530 |
commit | 22960758aa215a2cda21fb3b5a162fcf2bce5d20 (patch) | |
tree | d29f063252b049779afb837913cb860fd6dd8cc9 /mesonbuild | |
parent | c725816c8191ad3235fe3f5f45dddaff429158e2 (diff) | |
download | meson-22960758aa215a2cda21fb3b5a162fcf2bce5d20.zip meson-22960758aa215a2cda21fb3b5a162fcf2bce5d20.tar.gz meson-22960758aa215a2cda21fb3b5a162fcf2bce5d20.tar.bz2 |
rust: Use the corresponding rustc version when clippy-driver is chosen as Rust compiler
By default clippy-driver will report its own version, which is not very
useful to check the toolchain version. Instead make sure to extract the
actual toolchain version here.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/detect.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 78d7fdd..a3233f4 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -952,7 +952,18 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust # Clippy is a wrapper around rustc, but it doesn't have rustc in it's # output. We can otherwise treat it as rustc. if 'clippy' in out: - out = 'rustc' + # clippy returns its own version and not the rustc version by + # default so try harder here to get the correct version. + # Also replace the whole output with the rustc output in + # case this is later used for other purposes. + arg = ['--rustc', '--version'] + try: + out = Popen_safe(compiler + arg)[1] + except OSError as e: + popen_exceptions[join_args(compiler + arg)] = e + continue + version = search_version(out) + cls = rust.ClippyRustCompiler if 'rustc' in out: |