diff options
| -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 78d7fdda8..a3233f476 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: |
