Skip to content

Commit c979f0c

Browse files
dcbakerMeson Test
authored and
Meson Test
committed
compilers/detect: Split -beta and -nightly suffixes from rustc
Store both a full version with the nightly and beta suffixes, and the version as just X.Y.Z. This sort of distinction is why full_version exists. This fixes an issue with the bindgen module where we pass invalid version of X.Y.Z-beta and X.Y.Z-nightly.
1 parent f07bcb9 commit c979f0c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

mesonbuild/compilers/detect.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,11 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
10471047
popen_exceptions[join_args(compiler + arg)] = e
10481048
continue
10491049

1050-
version = search_version(out)
1050+
# Full version contains the "-nightly" or "-beta" suffixes, but version
1051+
# should just be X.Y.Z
1052+
full_version = search_version(out)
1053+
version = full_version.split('-', 1)[0]
1054+
10511055
cls: T.Type[RustCompiler] = rust.RustCompiler
10521056

10531057
# 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
10631067
except OSError as e:
10641068
popen_exceptions[join_args(compiler + arg)] = e
10651069
continue
1066-
version = search_version(out)
1070+
full_version = search_version(out)
1071+
version = full_version.split('-', 1)[0]
10671072

10681073
cls = rust.ClippyRustCompiler
10691074
mlog.deprecation(
@@ -1143,7 +1148,7 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
11431148
env.coredata.add_lang_args(cls.language, cls, for_machine, env)
11441149
return cls(
11451150
compiler, version, for_machine, is_cross, info,
1146-
linker=linker)
1151+
linker=linker, full_version=full_version)
11471152

11481153
_handle_exceptions(popen_exceptions, compilers)
11491154
raise EnvironmentException('Unreachable code (exception to make mypy happy)')

0 commit comments

Comments
 (0)