summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers/detect.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index d4ad4bade..784e00d3d 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -1047,7 +1047,11 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
popen_exceptions[join_args(compiler + arg)] = e
continue
- version = search_version(out)
+ # Full version contains the "-nightly" or "-beta" suffixes, but version
+ # should just be X.Y.Z
+ full_version = search_version(out)
+ version = full_version.split('-', 1)[0]
+
cls: T.Type[RustCompiler] = rust.RustCompiler
# Clippy is a wrapper around rustc, but it doesn't have rustc in its
@@ -1063,7 +1067,8 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
except OSError as e:
popen_exceptions[join_args(compiler + arg)] = e
continue
- version = search_version(out)
+ full_version = search_version(out)
+ version = full_version.split('-', 1)[0]
cls = rust.ClippyRustCompiler
mlog.deprecation(
@@ -1143,7 +1148,7 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
return cls(
compiler, version, for_machine, is_cross, info,
- linker=linker)
+ linker=linker, full_version=full_version)
_handle_exceptions(popen_exceptions, compilers)
raise EnvironmentException('Unreachable code (exception to make mypy happy)')