git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 5/6] ci: verify minimum supported Rust version

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 15, 2025, 06:04 UTC
Message-ID
<20251015-b4-pks-ci-rust-v3-5-13810af33bd5@pks.im>
In-Reply-To
<20251015-b4-pks-ci-rust-v3-0-13810af33bd5@pks.im>

In the current state of our Rust code base we don't really have any requirements for the minimum supported Rust version yet, as we don't use any features introduced by a recent version of Rust. Consequently, we have decided that we want to aim for a rather old version and edition of Rust, where the hope is that using an old version will make alternatives like gccrs viable earlier for compiling Git.

But while we specify the Rust edition, we don't yet specify a Rust version. And even if we did, the Rust version would only be enforced for our own code, but not for any of our dependencies.

We don't yet have any dependencies at the current point in time. But let's add some safeguards by specifying the minimum supported Rust version and using cargo-msrv(1) to verify that this version can be satisfied for all of our dependencies.

Note that we fix the version of cargo-msrv(1) at v0.18.1. This is the latest release supported by Ubuntu's Rust version.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Cargo.toml                 | 1 +
 ci/install-dependencies.sh | 8 ++++++++
 ci/run-rust-checks.sh      | 5 +++++
 3 files changed, 14 insertions(+)
diff --git a/Cargo.toml b/Cargo.toml
index 45c9b34981..2f51bf5d5f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,6 +2,7 @@
 name = "gitcore"
 version = "0.1.0"
 edition = "2018"
+rust-version = "1.49.0"
 
 [lib]
 crate-type = ["staticlib"]
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index dcd22ddd95..29e558bb9c 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -10,6 +10,8 @@ begin_group "Install dependencies"
 P4WHENCE=https://cdist2.perforce.com/perforce/r23.2
 LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
 JGITWHENCE=https://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit.pgm/6.8.0.202311291450-r/org.eclipse.jgit.pgm-6.8.0.202311291450-r.sh
+CARGO_MSRV_VERSION=0.18.4
+CARGO_MSRV_WHENCE=https://github.com/foresterre/cargo-msrv/releases/download/v$CARGO_MSRV_VERSION/cargo-msrv-x86_64-unknown-linux-musl-v$CARGO_MSRV_VERSION.tgz
 
 # Make sudo a no-op and execute the command directly when running as root.
 # While using sudo would be fine on most platforms when we are root already,
@@ -130,6 +132,12 @@ RustAnalysis)
 	sudo apt-get -q -y install rustup
 	rustup default stable
 	rustup component add clippy rustfmt
+
+	wget -q "$CARGO_MSRV_WHENCE" -O "cargo-msvc.tgz"
+	sudo mkdir -p "$CUSTOM_PATH"
+	sudo tar -xf "cargo-msvc.tgz" --strip-components=1 \
+		--directory "$CUSTOM_PATH" --wildcards "*/cargo-msrv"
+	sudo chmod a+x "$CUSTOM_PATH/cargo-msrv"
 	;;
 sparse)
 	sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
diff --git a/ci/run-rust-checks.sh b/ci/run-rust-checks.sh
index fb5ea8991b..b5ad9e8dc6 100755
--- a/ci/run-rust-checks.sh
+++ b/ci/run-rust-checks.sh
@@ -14,4 +14,9 @@ then
 	RET=1
 fi
 
+if ! group "Check for minimum required Rust version" cargo msrv verify
+then
+	RET=1
+fi
+
 exit $RET
-- 
2.51.0.869.ge66316f041.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 32 of 37 in “ci: improvements to our Rust infrastructure”
  1. 0/6 ci: improvements to our Rust infrastructurePatrick Steinhardt, Oct 7, 2025
  2. 1/6 ci: deduplicate calls to `apt-get update`Patrick Steinhardt, Oct 7, 2025
  3. Karthik NayakOct 7, 2025
  4. Justin ToblerOct 14, 2025
  5. 2/6 ci: check formatting of our Rust codePatrick Steinhardt, Oct 7, 2025
  6. Karthik NayakOct 7, 2025
  7. Patrick SteinhardtOct 7, 2025
  8. Eric SunshineOct 7, 2025
  9. Junio C HamanoOct 7, 2025
  10. Eric SunshineOct 7, 2025
  11. brian m. carlsonOct 7, 2025
  12. Chris TorekOct 7, 2025
  13. Patrick SteinhardtOct 8, 2025
  14. Junio C HamanoOct 8, 2025
  15. Patrick SteinhardtOct 9, 2025
  16. SZEDER GáborOct 29, 2025
  17. brian m. carlsonOct 7, 2025
  18. SZEDER GáborOct 8, 2025
  19. Patrick SteinhardtOct 9, 2025
  20. SZEDER GáborOct 29, 2025
  21. 3/6 rust/varint: add safety commentsPatrick Steinhardt, Oct 7, 2025
  22. brian m. carlsonOct 8, 2025
  23. Patrick SteinhardtOct 8, 2025
  24. 4/6 ci: check for common Rust mistakes via ClippyPatrick Steinhardt, Oct 7, 2025
  25. 5/6 ci: verify minimum supported Rust versionPatrick Steinhardt, Oct 7, 2025
  26. 6/6 rust: support for WindowsPatrick Steinhardt, Oct 7, 2025
  27. 0/6 ci: improvements to our Rust infrastructurePatrick Steinhardt, Oct 15, 2025
  28. 1/6 ci: deduplicate calls to `apt-get update`Patrick Steinhardt, Oct 15, 2025
  29. 2/6 ci: check formatting of our Rust codePatrick Steinhardt, Oct 15, 2025
  30. 3/6 rust/varint: add safety commentsPatrick Steinhardt, Oct 15, 2025
  31. 4/6 ci: check for common Rust mistakes via ClippyPatrick Steinhardt, Oct 15, 2025
  32. 5/6 ci: verify minimum supported Rust versionPatrick Steinhardt, Oct 15, 2025
  33. 6/6 rust: support for WindowsPatrick Steinhardt, Oct 15, 2025
  34. Ezekiel NewrenNov 20, 2025
  35. Johannes SchindelinNov 21, 2025
  36. Junio C HamanoNov 21, 2025
  37. Junio C HamanoOct 15, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.