ci: read the MSRV from clippy.toml to avoid having too many copies to keep in sync

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38807>
This commit is contained in:
Eric Engestrom 2025-10-04 15:05:58 +02:00
parent 9a681f20ef
commit 675fe92e78
4 changed files with 5 additions and 17 deletions

View file

@ -12,12 +12,7 @@ section_start rust "Building Rust toolchain"
# DEBIAN_BUILD_BASE_TAG
# DEBIAN_TEST_BASE_TAG
# This version number should match what we require in meson.build so we catch
# build issues from patches relying on new features in newer Rust versions.
# Keep this is sync with the `rustc.version()` check in meson.build, and with
# the `rustup default` line in .gitlab-ci/meson/build.sh and the `msrv` in
# clippy.toml
MINIMUM_SUPPORTED_RUST_VERSION=1.82.0
MINIMUM_SUPPORTED_RUST_VERSION=$(python3 -c 'import tomllib; print(tomllib.load(open("'"$CI_PROJECT_DIR"'/clippy.toml", "rb"))["msrv"])')
# This version number can be bumped freely, to benefit from the latest
# diagnostics in CI `build-only` jobs, and for building external CI
@ -40,7 +35,7 @@ curl -L --retry 4 -f --retry-all-errors --retry-delay 60 \
if [ "$1" = "build" ]
then
rustup toolchain install --profile minimal --component clippy,rustfmt $MINIMUM_SUPPORTED_RUST_VERSION
rustup toolchain install --profile minimal --component clippy,rustfmt "$MINIMUM_SUPPORTED_RUST_VERSION"
fi
find "$HOME"/.rustup/toolchains/*/lib -type f -name "*.so" -exec strip {} \;

View file

@ -43,10 +43,7 @@ fi
# Android manages the rust toolchain differently, ignore that case
if [ "$CI_JOB_STAGE" = "build-for-tests" ] && [[ "$CI_JOB_NAME" != *android* ]]; then
# Keep this in sync with the `rustc.version()` check in meson.build, and
# MINIMUM_SUPPORTED_RUST_VERSION in .gitlab-ci/container/build-rust.sh and the
# `msrv` in clippy.toml
rustup default 1.82.0
rustup default "$(python3 -c 'import tomllib; print(tomllib.load(open("'"$CI_PROJECT_DIR"'/clippy.toml", "rb"))["msrv"])')"
fi
# cross-xfail-$CROSS, if it exists, contains a list of tests that are expected

View file

@ -1,4 +1,2 @@
# Keep this in sync with the `rustc.version()` check in meson.build, the
# MINIMUM_SUPPORTED_RUST_VERSION in .gitlab-ci/container/build-rust.sh, the
# `rustup default` line in .gitlab-ci/meson/build.sh
# Keep this in sync with the `rustc.version()` check in meson.build
msrv = "1.82.0"

View file

@ -788,9 +788,7 @@ if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv') or
rustc = meson.get_compiler('rust')
rust = import('rust')
# Keep this in sync with the MINIMUM_SUPPORTED_RUST_VERSION in
# .gitlab-ci/container/build-rust.sh and the `rustup default` line in
# .gitlab-ci/meson/build.sh and the `msrv` in clippy.toml
# Keep this in sync with the `msrv` in clippy.toml
if rustc.version().version_compare('< 1.82')
error('Mesa requires Rust 1.82.0 or newer')
endif