diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9a1fdb7c5..df7e9fbfa4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,22 +128,31 @@ jobs: name: Check MSRV steps: - uses: actions/checkout@v3 - # Make sure that the MSRV documented in our crate documentation - # is the same one that we test for in CI. + # Make sure that the MSRV in zerocopy's and zerocopy-derive's `Cargo.toml` + # files are the same and are the same as the one we test for in CI. - name: Check MSRV run: | set -e + function msrv { + cargo metadata --manifest-path $1 --format-version 1 | jq -r '.packages[] | select(.name == "zerocopy").rust_version' + } + path_ci=.github/workflows/ci.yml ver_ci=$(<$path_ci yq '.jobs.build_test.strategy.matrix.toolchain[0] // ""' | grep .) - path_lib=src/lib.rs - ver_lib=$(<$path_lib grep "//! zerocopy's MSRV is" | grep -Po '\d+\.\d+.\d+') + path_zerocopy=Cargo.toml + ver_zerocopy=$(msrv $path_zerocopy) + + path_zerocopy_derive=zerocopy-derive/Cargo.toml + ver_zerocopy_derive=$(msrv $path_zerocopy_derive) - if [[ "$ver_ci" == "$ver_lib" ]]; then - echo "Same MSRV found in '$path_ci' ($ver_ci) and '$path_lib' ($ver_lib)." | tee -a $GITHUB_STEP_SUMMARY + if [[ "$ver_ci" == "$ver_zerocopy" && "$ver_ci" == "$ver_zerocopy_derive" ]]; then + echo "Same MSRV ($ver_ci) found in '$path_ci', '$path_zerocopy', and '$path_zerocopy_derve'." \ + | tee -a $GITHUB_STEP_SUMMARY exit 0 else - echo "Different MSRVs found in '$path_ci' ($ver_ci) and '$path_lib' ($ver_lib)." | tee -a $GITHUB_STEP_SUMMARY >&2 + echo "Different MSRVs found in '$path_ci' ($ver_ci), '$path_zerocopy' ($ver_zerocopy), and '$path_zerocopy_derve' ($ver_zerocopy_derive)." \ + | tee -a $GITHUB_STEP_SUMMARY >&2 exit 1 fi diff --git a/Cargo.toml b/Cargo.toml index 223653bb3d..617239e661 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ authors = ["Joshua Liebow-Feeser "] description = "Utilities for zero-copy parsing and serialization" license-file = "LICENSE" repository = "https://github.com/google/zerocopy" +rust-version = "1.61.0" exclude = [".*"] diff --git a/README.md b/README.md index 8fec35d61d..9504ec5869 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,6 @@ packed SIMD vectors][simd-layout]. which are only available on nightly. Since these types are unstable, support for any type may be removed at any point in the future. -## Minimum Supported Rust Version (MSRV) - -zerocopy's MSRV is 1.61.0. - [simd-layout]: https://rust-lang.github.io/unsafe-code-guidelines/layout/packed-simd-vectors.html ## Disclaimer diff --git a/src/lib.rs b/src/lib.rs index 387a6c6843..ede82566b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,10 +44,6 @@ //! which are only available on nightly. Since these types are unstable, support //! for any type may be removed at any point in the future. //! -//! # Minimum Supported Rust Version (MSRV) -//! -//! zerocopy's MSRV is 1.61.0. -//! //! [simd-layout]: https://rust-lang.github.io/unsafe-code-guidelines/layout/packed-simd-vectors.html #![deny( diff --git a/zerocopy-derive/Cargo.toml b/zerocopy-derive/Cargo.toml index 1ba3b12d1e..b328209962 100644 --- a/zerocopy-derive/Cargo.toml +++ b/zerocopy-derive/Cargo.toml @@ -12,6 +12,7 @@ authors = ["Joshua Liebow-Feeser "] description = "Custom derive for traits from the zerocopy crate" license-file = "../LICENSE" repository = "https://github.com/google/zerocopy" +rust-version = "1.61.0" exclude = [".*"]