Skip to content

Commit

Permalink
Bump MSRV to Rust 1.48.0
Browse files Browse the repository at this point in the history
As we are doing throughout the rust-bitcoin ecosystem; bump the MSRV to
Rust 1.48.0
  • Loading branch information
tcharding committed Apr 3, 2023
1 parent 5962169 commit f5cd60e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 42 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- name: Running test script
env:
DO_LINT: true
DO_FEATURE_MATRIX: true
run: ./contrib/test.sh

Beta:
Expand Down Expand Up @@ -48,15 +49,15 @@ jobs:
run: ./contrib/test.sh

MSRV:
name: Test - 1.41.1 toolchain
name: Test - 1.48.0 toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@1.41.1
uses: dtolnay/rust-toolchain@1.48.0
- name: Running test script
run: ./contrib/test.sh

Expand Down
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ default = ["std"]
std = ["alloc"]
alloc = []

# Only for CI to make all warnings errors, do not activate otherwise (may break forward compatibility)
strict = []

[dependencies.arrayvec]
version = "0.7.1"
default-features = false
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ Bitcoin-specific address encoding is handled by the `bitcoin-bech32` crate.

## MSRV

The minimum supported Rust version with the standard library is **1.41.1**.

This library should always compile with any combination of features excluding "arrayvec" on **Rust 1.48.0**.
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.41.1"
msrv = "1.48.0"
59 changes: 26 additions & 33 deletions contrib/test.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
#!/bin/sh
#
# CI test script for rust-bech32.
#
# The "strict" feature is used to configure cargo to deny all warnings, always use it in test runs.

set -eu
set -x

# "arrayvec" feature breaks the MSRV, its added manually in DO_FEATURE_MATRIX loop below.
FEATURES="std alloc"

# Some tests require certain toolchain types.
NIGHTLY=false
MIN_VERSION=false
MSRV=false
if cargo --version | grep nightly; then
NIGHTLY=true
fi
if cargo --version | grep 1.41; then
MIN_VERSION=true
if cargo --version | grep "1\.48"; then
MSRV=true
fi

build_and_test () {
cargo build --no-default-features --features="$1"
cargo test --no-default-features --features="$1"
}

# Sanity, check tools exist.
cargo --version
rustc --version
Expand All @@ -37,34 +43,21 @@ if [ "${DO_FMT-false}" = true ]; then
cargo fmt --check
fi

check () {
cargo build --no-default-features --features="strict $1"
cargo test --no-default-features --features="strict $1"
}

# Check without features ("strict" is a CI feature only, see above).
check ""

# Check "arrayvec" feature alone.
if [ "$MIN_VERSION" != true ]; then
check "arrayvec"
fi

# Check "alloc" feature alone.
check "alloc"

# Check "alloc" & "arrayvec" features together.
if [ "$MIN_VERSION" != true ]; then
check "alloc arrayvec"
fi

# Check "std" feature (implies "alloc", so this is equivalent to --all-features).
cargo build --no-default-features --features="std"
cargo test --no-default-features --features="std"

# Check "std" & "arrayvec" features together.
if [ "$MIN_VERSION" != true ]; then
check "std arrayvec"
if [ "${DO_FEATURE_MATRIX-false}" = true ]; then
# No features
build_and_test ""

# Feature combos
build_and_test "std"
build_and_test "alloc"
build_and_test "std alloc"
# arrayvec breaks the MSRV
if [ $MSRV = false
]; then
build_and_test "arrayvec"
build_and_test "std arrayvec"
build_and_test "alloc arrayvec"
fi
fi

exit 0
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ assert_eq!(variant, Variant::Bech32);
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]

#[cfg(feature = "alloc")]
Expand Down

0 comments on commit f5cd60e

Please sign in to comment.