Skip to content

Commit 200f50f

Browse files
committed
Use namespaced-features to safely bump to MSRV 1.60
Earlier versions won't see the incompatible updates at all!
1 parent 3303b7d commit 200f50f

File tree

8 files changed

+17
-31
lines changed

8 files changed

+17
-31
lines changed

.github/workflows/ci.yaml

+3-19
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
rust: [
12-
1.31.0, # 2018!
13-
1.36.0, # alloc
12+
1.60.0, # MSRV
1413
stable,
1514
beta,
1615
nightly
@@ -29,7 +28,7 @@ jobs:
2928
- run: ./ci/test_full.sh
3029

3130
# try a target that doesn't have std at all, but does have alloc
32-
no_std_stable:
31+
no_std:
3332
name: No Std (stable)
3433
runs-on: ubuntu-latest
3534
steps:
@@ -39,21 +38,6 @@ jobs:
3938
target: thumbv6m-none-eabi
4039
- run: cargo build --target thumbv6m-none-eabi --no-default-features --features "num-bigint serde"
4140

42-
# try a target that doesn't have std at all, nor alloc
43-
no_std_131:
44-
name: No Std (1.31.0)
45-
runs-on: ubuntu-latest
46-
steps:
47-
- uses: actions/checkout@v4
48-
- uses: actions/cache@v4
49-
with:
50-
path: ~/.cargo/registry/index
51-
key: cargo-1.31.0-git-index
52-
- uses: dtolnay/[email protected]
53-
with:
54-
target: thumbv6m-none-eabi
55-
- run: cargo build --target thumbv6m-none-eabi --no-default-features --features "serde"
56-
5741
fmt:
5842
name: Format
5943
runs-on: ubuntu-latest
@@ -69,7 +53,7 @@ jobs:
6953
success:
7054
name: Success
7155
runs-on: ubuntu-latest
72-
needs: [test, no_std_131, no_std_stable, fmt]
56+
needs: [test, no_std, fmt]
7357
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
7458
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
7559
# dependencies fails.

.github/workflows/master.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
rust: [1.31.0, stable]
16+
rust: [1.60.0, stable]
1717
steps:
1818
- uses: actions/checkout@v4
1919
- uses: actions/cache@v4

.github/workflows/pr.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
rust: [1.31.0, stable]
12+
rust: [1.60.0, stable]
1313
steps:
1414
- uses: actions/checkout@v4
1515
- uses: actions/cache@v4

Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ version = "0.4.1"
1212
readme = "README.md"
1313
exclude = ["/ci/*", "/.github/*"]
1414
edition = "2018"
15+
rust-version = "1.60"
1516

1617
[package.metadata.docs.rs]
1718
features = ["std", "num-bigint-std", "serde"]
@@ -39,9 +40,11 @@ version = "1.0.0"
3940
default-features = false
4041

4142
[features]
42-
default = ["num-bigint-std", "std"]
43-
std = ["num-integer/std", "num-traits/std"]
43+
default = ["num-bigint", "std"]
44+
std = ["num-bigint?/std", "num-integer/std", "num-traits/std"]
4445
num-bigint-std = ["num-bigint/std"]
46+
num-bigint = ["dep:num-bigint"]
47+
serde = ["dep:serde"]
4548

4649
[build-dependencies]
4750
autocfg = "1.0.0"

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![crate](https://img.shields.io/crates/v/num-rational.svg)](https://crates.io/crates/num-rational)
44
[![documentation](https://docs.rs/num-rational/badge.svg)](https://docs.rs/num-rational)
5-
[![minimum rustc 1.31](https://img.shields.io/badge/rustc-1.31+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
5+
[![minimum rustc 1.60](https://img.shields.io/badge/rustc-1.60+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
66
[![build status](https://github.com/rust-num/num-rational/workflows/master/badge.svg)](https://github.com/rust-num/num-rational/actions)
77

88
Generic `Rational` numbers (aka fractions) for Rust.
@@ -33,7 +33,7 @@ Release notes are available in [RELEASES.md](RELEASES.md).
3333

3434
## Compatibility
3535

36-
The `num-rational` crate is tested for rustc 1.31 and greater.
36+
The `num-rational` crate is tested for rustc 1.60 and greater.
3737

3838
## License
3939

ci/rustup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
set -ex
66

77
ci=$(dirname $0)
8-
for version in 1.31.0 1.36.0 stable beta nightly; do
8+
for version in 1.60.0 stable beta nightly; do
99
rustup run "$version" "$ci/test_full.sh"
1010
done

ci/test_full.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
CRATE=num-rational
6-
MSRV=1.31
6+
MSRV=1.60
77

88
get_rust_version() {
99
local array=($(rustc --version));
@@ -28,8 +28,7 @@ if ! check_version $MSRV ; then
2828
fi
2929

3030
STD_FEATURES=(num-bigint-std serde)
31-
NO_STD_FEATURES=(serde)
32-
check_version 1.36 && NO_STD_FEATURES+=(num-bigint)
31+
NO_STD_FEATURES=(num-bigint serde)
3332
echo "Testing supported features: ${STD_FEATURES[*]}"
3433
echo " no_std supported features: ${NO_STD_FEATURES[*]}"
3534

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//!
1313
//! ## Compatibility
1414
//!
15-
//! The `num-rational` crate is tested for rustc 1.31 and greater.
15+
//! The `num-rational` crate is tested for rustc 1.60 and greater.
1616
1717
#![doc(html_root_url = "https://docs.rs/num-rational/0.4")]
1818
#![no_std]
@@ -73,7 +73,7 @@ pub type Rational64 = Ratio<i64>;
7373
/// Alias for arbitrary precision rationals.
7474
pub type BigRational = Ratio<BigInt>;
7575

76-
/// These method are `const` for Rust 1.31 and later.
76+
/// These method are `const`.
7777
impl<T> Ratio<T> {
7878
/// Creates a `Ratio` without checking for `denom == 0` or reducing.
7979
///

0 commit comments

Comments
 (0)