Skip to content

Commit 5397a1c

Browse files
bors[bot]cuviper
andauthored
Merge #240
240: Upgrade to 2018 edition, MSRV 1.31 r=cuviper a=cuviper Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents 6d50d5d + a5bad70 commit 5397a1c

25 files changed

+167
-332
lines changed

.github/workflows/ci.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
rust: [1.8.0, 1.15.0, 1.20.0, 1.26.0, 1.31.0, stable, beta, nightly]
15+
rust: [
16+
1.31.0, # MSRV
17+
1.35.0, # has_copysign
18+
1.37.0, # has_reverse_bits
19+
1.38.0, # has_div_euclid
20+
1.44.0, # has_to_int_unchecked
21+
1.46.0, # has_leading_trailing_ones
22+
stable,
23+
beta,
24+
nightly,
25+
]
1626
steps:
1727
- uses: actions/checkout@v3
1828
- uses: dtolnay/rust-toolchain@master
@@ -44,7 +54,7 @@ jobs:
4454
- uses: dtolnay/rust-toolchain@stable
4555
with:
4656
target: thumbv6m-none-eabi
47-
- run: cargo build --target thumbv6m-none-eabi --no-default-features --features i128
57+
- run: cargo build --target thumbv6m-none-eabi --no-default-features
4858
- run: cargo build --target thumbv6m-none-eabi --no-default-features --features libm
4959

5060
fmt:

.github/workflows/master.yaml

Lines changed: 1 addition & 1 deletion
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.8.0, stable]
16+
rust: [1.31.0, stable]
1717
steps:
1818
- uses: actions/checkout@v3
1919
- uses: dtolnay/rust-toolchain@master

.github/workflows/pr.yaml

Lines changed: 1 addition & 1 deletion
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.8.0, stable]
12+
rust: [1.31.0, stable]
1313
steps:
1414
- uses: actions/checkout@v3
1515
- uses: dtolnay/rust-toolchain@master

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ version = "0.2.15"
1212
readme = "README.md"
1313
build = "build.rs"
1414
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
15+
edition = "2018"
16+
rust-version = "1.31"
1517

1618
[package.metadata.docs.rs]
1719
features = ["std"]
@@ -22,6 +24,8 @@ libm = { version = "0.2.0", optional = true }
2224
[features]
2325
default = ["std"]
2426
std = []
27+
28+
# vestigial features, now always in effect
2529
i128 = []
2630

2731
[build-dependencies]

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![crate](https://img.shields.io/crates/v/num-traits.svg)](https://crates.io/crates/num-traits)
44
[![documentation](https://docs.rs/num-traits/badge.svg)](https://docs.rs/num-traits)
5-
[![minimum rustc 1.8](https://img.shields.io/badge/rustc-1.8+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
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)
66
[![build status](https://github.com/rust-num/num-traits/workflows/master/badge.svg)](https://github.com/rust-num/num-traits/actions)
77

88
Numeric traits for generic mathematics in Rust.
@@ -29,23 +29,18 @@ default-features = false
2929
```
3030

3131
The `Float` and `Real` traits are only available when either `std` or `libm` is enabled.
32-
The `libm` feature is only available with Rust 1.31 and later ([see PR #99](https://github.com/rust-num/num-traits/pull/99)).
3332

3433
The `FloatCore` trait is always available. `MulAdd` and `MulAddAssign` for `f32`
3534
and `f64` also require `std` or `libm`, as do implementations of signed and floating-
3635
point exponents in `Pow`.
3736

38-
Implementations for `i128` and `u128` are only available with Rust 1.26 and
39-
later. The build script automatically detects this, but you can make it
40-
mandatory by enabling the `i128` crate feature.
41-
4237
## Releases
4338

4439
Release notes are available in [RELEASES.md](RELEASES.md).
4540

4641
## Compatibility
4742

48-
The `num-traits` crate is tested for rustc 1.8 and greater.
43+
The `num-traits` crate is tested for rustc 1.31 and greater.
4944

5045
## License
5146

bors.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
status = [
2-
"Test (1.8.0)",
3-
"Test (1.15.0)",
4-
"Test (1.20.0)",
5-
"Test (1.26.0)",
62
"Test (1.31.0)",
3+
"Test (1.35.0)",
4+
"Test (1.37.0)",
5+
"Test (1.38.0)",
6+
"Test (1.44.0)",
7+
"Test (1.46.0)",
78
"Test (stable)",
89
"Test (beta)",
910
"Test (nightly)",

build.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
extern crate autocfg;
2-
31
use std::env;
42

53
fn main() {
64
let ac = autocfg::new();
75

8-
// If the "i128" feature is explicity requested, don't bother probing for it.
9-
// It will still cause a build error if that was set improperly.
10-
if env::var_os("CARGO_FEATURE_I128").is_some() || ac.probe_type("i128") {
11-
autocfg::emit("has_i128");
12-
}
13-
146
ac.emit_expression_cfg(
157
"unsafe { 1f64.to_int_unchecked::<i32>() }",
168
"has_to_int_unchecked",
179
);
1810

1911
ac.emit_expression_cfg("1u32.reverse_bits()", "has_reverse_bits");
2012
ac.emit_expression_cfg("1u32.trailing_ones()", "has_leading_trailing_ones");
21-
ac.emit_expression_cfg("{ let mut x = 1; x += &2; }", "has_int_assignop_ref");
2213
ac.emit_expression_cfg("1u32.div_euclid(1u32)", "has_div_euclid");
2314

2415
if env::var_os("CARGO_FEATURE_STD").is_some() {

ci/rustup.sh

Lines changed: 1 addition & 1 deletion
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.8.0 1.15.0 1.20.0 1.26.0 1.31.0 stable beta nightly; do
8+
for version in 1.31.0 1.35.0 1.37.0 1.38.0 1.44.0 1.46.0 stable beta nightly; do
99
rustup run "$version" "$ci/test_full.sh"
1010
done

ci/test_full.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
CRATE=num-traits
6-
MSRV=1.8
6+
MSRV=1.31
77

88
get_rust_version() {
99
local array=($(rustc --version));
@@ -27,9 +27,7 @@ if ! check_version $MSRV ; then
2727
exit 1
2828
fi
2929

30-
FEATURES=()
31-
check_version 1.26 && FEATURES+=(i128)
32-
check_version 1.27 && FEATURES+=(libm)
30+
FEATURES=(libm)
3331
echo "Testing supported features: ${FEATURES[*]}"
3432

3533
set -x

src/bounds.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use core::num::Wrapping;
22
use core::{f32, f64};
3-
#[cfg(has_i128)]
4-
use core::{i128, u128};
5-
use core::{i16, i32, i64, i8, isize};
6-
use core::{u16, u32, u64, u8, usize};
3+
use core::{i128, i16, i32, i64, i8, isize};
4+
use core::{u128, u16, u32, u64, u8, usize};
75

86
/// Numbers which have upper and lower bounds
97
pub trait Bounded {
@@ -61,15 +59,13 @@ bounded_impl!(u8, u8::MIN, u8::MAX);
6159
bounded_impl!(u16, u16::MIN, u16::MAX);
6260
bounded_impl!(u32, u32::MIN, u32::MAX);
6361
bounded_impl!(u64, u64::MIN, u64::MAX);
64-
#[cfg(has_i128)]
6562
bounded_impl!(u128, u128::MIN, u128::MAX);
6663

6764
bounded_impl!(isize, isize::MIN, isize::MAX);
6865
bounded_impl!(i8, i8::MIN, i8::MAX);
6966
bounded_impl!(i16, i16::MIN, i16::MAX);
7067
bounded_impl!(i32, i32::MIN, i32::MAX);
7168
bounded_impl!(i64, i64::MIN, i64::MAX);
72-
#[cfg(has_i128)]
7369
bounded_impl!(i128, i128::MIN, i128::MAX);
7470

7571
impl<T: Bounded> Bounded for Wrapping<T> {
@@ -130,7 +126,6 @@ fn wrapping_bounded() {
130126
test_wrapping_bounded!(usize u8 u16 u32 u64 isize i8 i16 i32 i64);
131127
}
132128

133-
#[cfg(has_i128)]
134129
#[test]
135130
fn wrapping_bounded_i128() {
136131
macro_rules! test_wrapping_bounded {

0 commit comments

Comments
 (0)