From 8cb429d065c707554d809ac3d401985a066830d0 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Tue, 11 Jul 2023 08:08:13 -0500 Subject: [PATCH] chore(rust): bump MSRV to 1.71.0 Summary: Let's be more aggressive about tracking the latest stable Rust release. There's little benefit to being conservative so early on, especially when no users seem to have faced any issue with upgrading, or strictly required an old Rust version. Right now, just lagging Rust by 1 major release probably seems fine. We're targeting 1.71.0 to get ahead of the curve, since 1.72.0 will likely release sometime before the next `jj` release. Signed-off-by: Austin Seipp Change-Id: I4e691b6ba63b5b9023a75ae0a6917672 --- .github/workflows/build.yml | 6 +++--- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- docs/contributing.md | 13 +++++++------ flake.nix | 16 ++++++++++++---- lib/Cargo.toml | 2 +- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9a86a13d..d61ec3d47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: cargo_flags: [""] include: - os: ubuntu-latest - rust_version: "1.64" + rust_version: "1.71" cargo_flags: "" - os: ubuntu-latest rust_version: stable @@ -65,7 +65,7 @@ jobs: with: toolchain: nightly components: rustfmt - - run: cargo fmt --all -- --check + - run: cargo +nightly fmt --all -- --check cargo-deny: runs-on: ubuntu-latest @@ -95,4 +95,4 @@ jobs: with: toolchain: stable components: clippy - - run: cargo clippy --all-features --workspace --all-targets -- -D warnings + - run: cargo +stable clippy --all-features --workspace --all-targets -- -D warnings diff --git a/CHANGELOG.md b/CHANGELOG.md index cc764614e..f16c56d4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking changes +* The minimum supported Rust version (MSRV) is now 1.71.0. + ### New features ### Fixed bugs diff --git a/Cargo.toml b/Cargo.toml index e68167962..1d9be1c82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "jj-cli" version = "0.8.0" authors = ["Martin von Zweigbergk "] edition = "2021" -rust-version = "1.64" # Remember to update CI, contributing.md, and flake.nix +rust-version = "1.71" # Remember to update CI, and contributing.md license = "Apache-2.0" description = "Jujutsu (an experimental VCS)" homepage = "https://github.com/martinvonz/jj" diff --git a/docs/contributing.md b/docs/contributing.md index edac3f3d6..249a811b6 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -77,10 +77,12 @@ recommended steps. ### Summary +If you already have `rustup` installed, then moving into the source code +directory will install the MSRV for you. + One-time setup: - rustup toolchain add nightly # If this is not your default - rustup toolchain add 1.64 # See note about MSRV & `rust-version` below + rustup toolchain add nightly # wanted for 'rustfmt' cargo install cargo-insta cargo install cargo-watch cargo install cargo-nextest @@ -89,7 +91,7 @@ During development (adapt according to your preference): cargo watch --ignore '.jj/**' -s \ 'cargo clippy --workspace --all-targets \ - && cargo +1.64 check --workspace --all-targets' + && cargo check --workspace --all-targets' cargo +nightly fmt # Occasionally cargo nextest run --workspace # Occasionally cargo insta test --workspace # Occasionally @@ -116,9 +118,8 @@ These are listed roughly in order of decreasing importance. toolchain and use `cargo +nightly fmt`. 3. Your code will be rejected if it cannot be compiled with the minimal - supported version of Rust ("MSRV"). This version is listed as - `rust-version` in [`Cargo.toml`](../Cargo.toml); it is 1.64 as of this - writing. + supported version of Rust ("MSRV"). Currently, `jj` follows a rather + casual MSRV policy: "The current `rustc` stable version, minus one." 4. Your code needs to pass `cargo clippy`. You can also use `cargo +nightly clippy` if you wish to see more warnings. diff --git a/flake.nix b/flake.nix index 1b338a47d..7e0da5bdf 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,13 @@ pkgs.lib.all (re: builtins.match re relPath == null) regexes; }; + rust-version = pkgs.rust-bin.stable."1.71.0".default; + + ourRustPlatform = pkgs.makeRustPlatform { + rustc = rust-version; + cargo = rust-version; + }; + # NOTE (aseipp): on Linux, go ahead and use mold by default to improve # link times a bit; mostly useful for debug build speed, but will help # over time if we ever get more dependencies, too @@ -42,7 +49,7 @@ in { packages = { - jujutsu = pkgs.rustPlatform.buildRustPackage rec { + jujutsu = ourRustPlatform.buildRustPackage rec { pname = "jujutsu"; version = "unstable-${self.shortRev or "dirty"}"; buildNoDefaultFeatures = true; @@ -64,8 +71,9 @@ makeWrapper pkg-config ]; - buildInputs = with pkgs; [ openssl zstd libgit2 libssh2 ] - ++ lib.optionals stdenv.isDarwin [ + buildInputs = with pkgs; [ + openssl zstd libgit2 libssh2 + ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.SystemConfiguration libiconv @@ -102,7 +110,7 @@ buildInputs = with pkgs; [ # Using the minimal profile with explicit "clippy" extension to avoid # two versions of rustfmt - (rust-bin.stable."1.64.0".minimal.override { + (rust-version.override { extensions = [ "rust-src" # for rust-analyzer "clippy" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 91d5c5543..6566e0a6b 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -3,7 +3,7 @@ name = "jj-lib" version = "0.8.0" authors = ["Martin von Zweigbergk "] edition = "2021" -rust-version = "1.64" +rust-version = "1.71" license = "Apache-2.0" description = "Library for Jujutsu (an experimental VCS)" homepage = "https://github.com/martinvonz/jj"