Skip to content

Commit 844d462

Browse files
bors[bot]cuviperCAD97
committed
Merge #367
367: Release 0.2.0 r=cuviper a=cuviper Closes #298. Closes #357. Closes #360. Co-authored-by: Josh Stone <[email protected]> Co-authored-by: Christopher Durham <[email protected]>
2 parents 5c7cb7d + 7ba063e commit 844d462

File tree

7 files changed

+221
-88
lines changed

7 files changed

+221
-88
lines changed

.travis.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
language: rust
22
rust:
3+
- 1.15.0
4+
- 1.22.0
5+
- 1.26.0
36
- stable
47
- beta
58
- nightly
69
matrix:
710
include:
8-
- rust: 1.8.0
9-
before_script:
10-
# rand 0.3.22 started depending on rand 0.4, which requires rustc 1.15
11-
# manually hacking the lockfile due to the limitations of cargo#2773
12-
- cargo generate-lockfile
13-
- sed -i -e 's/"rand 0.[34].[0-9]\+/"rand 0.3.20/' Cargo.lock
14-
- sed -i -e '/^name = "rand"/,/^$/s/version = "0.3.[0-9]\+"/version = "0.3.20"/' Cargo.lock
11+
# try a target that doesn't have std at all
12+
- rust: stable
13+
env: TARGET=thumbv6m-none-eabi
14+
script:
15+
- rustup target add $TARGET
16+
- cargo build --verbose --target $TARGET --no-default-features
1517
sudo: false
1618
script:
1719
- cargo build --verbose

Cargo.toml

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,76 @@ description = "A collection of numeric types and traits for Rust, including bigi
44
documentation = "https://docs.rs/num"
55
homepage = "https://github.com/rust-num/num"
66
keywords = ["mathematics", "numerics", "bignum"]
7-
categories = [ "algorithms", "data-structures", "science" ]
7+
categories = [ "algorithms", "data-structures", "science", "no-std" ]
88
license = "MIT/Apache-2.0"
99
repository = "https://github.com/rust-num/num"
1010
name = "num"
11-
version = "0.1.42"
11+
version = "0.2.0"
1212
readme = "README.md"
1313

14+
[package.metadata.docs.rs]
15+
features = ["std", "serde", "rand"]
16+
1417
[badges]
1518
travis-ci = { repository = "rust-num/num" }
1619

1720
[dependencies]
1821

1922
[dependencies.num-bigint]
20-
optional = true
21-
version = "0.1.42"
23+
optional = true # needs std
24+
version = "0.2.0"
25+
default-features = false
2226

2327
[dependencies.num-complex]
24-
optional = true
25-
version = "0.1.42"
28+
version = "0.2.0"
29+
default-features = false
2630

2731
[dependencies.num-integer]
28-
version = "0.1.36"
32+
version = "0.1.39"
33+
default-features = false
2934

3035
[dependencies.num-iter]
31-
version = "0.1.35"
36+
version = "0.1.37"
37+
default-features = false
3238

3339
[dependencies.num-rational]
34-
optional = true
35-
version = "0.1.42"
40+
version = "0.2.1"
41+
default-features = false
3642

3743
[dependencies.num-traits]
38-
version = "0.2.0"
44+
version = "0.2.5"
45+
default-features = false
3946

4047
[dev-dependencies]
4148

4249
[features]
43-
bigint = ["num-bigint"]
44-
complex = ["num-complex"]
45-
rational = ["num-rational"]
46-
default = ["bigint", "complex", "rational", "rustc-serialize"]
50+
default = ["std"]
51+
52+
std = [
53+
"num-bigint/std",
54+
"num-complex/std",
55+
"num-integer/std",
56+
"num-iter/std",
57+
"num-rational/std", "num-rational/bigint",
58+
"num-traits/std",
59+
]
60+
61+
i128 = [
62+
"num-bigint/i128",
63+
"num-complex/i128",
64+
"num-integer/i128",
65+
"num-iter/i128",
66+
"num-rational/i128",
67+
"num-traits/i128",
68+
]
69+
70+
rand = [
71+
"num-bigint/rand",
72+
"num-complex/rand",
73+
]
4774

4875
serde = [
4976
"num-bigint/serde",
5077
"num-complex/serde",
51-
"num-rational/serde"
52-
]
53-
rustc-serialize = [
54-
"num-bigint/rustc-serialize",
55-
"num-complex/rustc-serialize",
56-
"num-rational/rustc-serialize"
78+
"num-rational/serde",
5779
]

README.md

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

33
[![crate](https://img.shields.io/crates/v/num.svg)](https://crates.io/crates/num)
44
[![documentation](https://docs.rs/num/badge.svg)](https://docs.rs/num)
5-
![minimum rustc 1.8](https://img.shields.io/badge/rustc-1.8+-red.svg)
5+
![minimum rustc 1.15](https://img.shields.io/badge/rustc-1.15+-red.svg)
66
[![Travis status](https://travis-ci.org/rust-num/num.svg?branch=master)](https://travis-ci.org/rust-num/num)
77

88
A collection of numeric types and traits for Rust.
@@ -13,36 +13,26 @@ and generic range iterators.
1313

1414
`num` is a meta-crate, re-exporting items from these sub-crates:
1515

16-
- [`num-bigint`](https://github.com/rust-num/num-bigint)
17-
[![crate](https://img.shields.io/crates/v/num-bigint.svg)](https://crates.io/crates/num-bigint)
16+
| Repository | Crate | Documentation |
17+
| ---------- | ----- | ------------- |
18+
| [`num-bigint`] | [![crate][bigint-cb]][bigint-c] | [![documentation][bigint-db]][bigint-d]
19+
| [`num-complex`] | [![crate][complex-cb]][complex-c] | [![documentation][complex-db]][complex-d]
20+
| [`num-integer`] | [![crate][integer-cb]][integer-c] | [![documentation][integer-db]][integer-d]
21+
| [`num-iter`] | [![crate][iter-cb]][iter-c] | [![documentation][iter-db]][iter-d]
22+
| [`num-rational`] | [![crate][rational-cb]][rational-c] | [![documentation][rational-db]][rational-d]
23+
| [`num-traits`] | [![crate][traits-cb]][traits-c] | [![documentation][traits-db]][traits-d]
24+
| ([`num-derive`]) | [![crate][derive-cb]][derive-c] | [![documentation][derive-db]][derive-d]
1825

19-
- [`num-complex`](https://github.com/rust-num/num-complex)
20-
[![crate](https://img.shields.io/crates/v/num-complex.svg)](https://crates.io/crates/num-complex)
21-
22-
- [`num-integer`](https://github.com/rust-num/num-integer)
23-
[![crate](https://img.shields.io/crates/v/num-integer.svg)](https://crates.io/crates/num-integer)
24-
25-
- [`num-iter`](https://github.com/rust-num/num-iter)
26-
[![crate](https://img.shields.io/crates/v/num-iter.svg)](https://crates.io/crates/num-iter)
27-
28-
- [`num-rational`](https://github.com/rust-num/num-rational)
29-
[![crate](https://img.shields.io/crates/v/num-rational.svg)](https://crates.io/crates/num-rational)
30-
31-
- [`num-traits`](https://github.com/rust-num/num-traits)
32-
[![crate](https://img.shields.io/crates/v/num-traits.svg)](https://crates.io/crates/num-traits)
33-
34-
There is also a `proc-macro` crate for deriving some numeric traits:
35-
36-
- [`num-derive`](https://github.com/rust-num/num-derive)
37-
[![crate](https://img.shields.io/crates/v/num-derive.svg)](https://crates.io/crates/num-derive)
26+
Note: `num-derive` is listed here for reference, but it's not directly included
27+
in `num`. This is a `proc-macro` crate for deriving some of `num`'s traits.
3828

3929
## Usage
4030

4131
Add this to your `Cargo.toml`:
4232

4333
```toml
4434
[dependencies]
45-
num = "0.1"
35+
num = "0.2"
4636
```
4737

4838
and this to your crate root:
@@ -51,11 +41,84 @@ and this to your crate root:
5141
extern crate num;
5242
```
5343

44+
## Features
45+
46+
This crate can be used without the standard library (`#![no_std]`) by disabling
47+
the default `std` feature. Use this in `Cargo.toml`:
48+
49+
```toml
50+
[dependencies.num]
51+
version = "0.2"
52+
default-features = false
53+
```
54+
55+
The `num-bigint` crate is only available when `std` is enabled, and the other
56+
sub-crates may have limited functionality when used without `std`.
57+
58+
Implementations for `i128` and `u128` are only available with Rust 1.26 and
59+
later. The build script automatically detects this, but you can make it
60+
mandatory by enabling the `i128` crate feature.
61+
62+
The `rand` feature enables randomization traits in `num-bigint` and
63+
`num-complex`.
64+
65+
The `serde` feature enables serialization for types in `num-bigint`,
66+
`num-complex`, and `num-rational`.
67+
68+
The `num` meta-crate no longer supports features to toggle the inclusion of
69+
the individual sub-crates. If you need such control, you are recommended to
70+
directly depend on your required crates instead.
71+
5472
## Releases
5573

5674
Release notes are available in [RELEASES.md](RELEASES.md).
5775

5876
## Compatibility
5977

60-
Most of the `num` crates are tested for rustc 1.8 and greater.
61-
The exception is `num-derive` which requires at least rustc 1.15.
78+
The `num` crate as a whole is tested for rustc 1.15 and greater.
79+
80+
The `num-traits`, `num-integer`, and `num-iter` crates are individually tested
81+
for rustc 1.8 and greater, if you require such older compatibility.
82+
83+
84+
[`num-bigint`]: https://github.com/rust-num/num-bigint
85+
[bigint-c]: https://crates.io/crates/num-bigint
86+
[bigint-cb]: https://img.shields.io/crates/v/num-bigint.svg
87+
[bigint-d]: https://docs.rs/num-bigint/
88+
[bigint-db]: https://docs.rs/num-bigint/badge.svg
89+
90+
[`num-complex`]: https://github.com/rust-num/num-complex
91+
[complex-c]: https://crates.io/crates/num-complex
92+
[complex-cb]: https://img.shields.io/crates/v/num-complex.svg
93+
[complex-d]: https://docs.rs/num-complex/
94+
[complex-db]: https://docs.rs/num-complex/badge.svg
95+
96+
[`num-derive`]: https://github.com/rust-num/num-derive
97+
[derive-c]: https://crates.io/crates/num-derive
98+
[derive-cb]: https://img.shields.io/crates/v/num-derive.svg
99+
[derive-d]: https://docs.rs/num-derive/
100+
[derive-db]: https://docs.rs/num-derive/badge.svg
101+
102+
[`num-integer`]: https://github.com/rust-num/num-integer
103+
[integer-c]: https://crates.io/crates/num-integer
104+
[integer-cb]: https://img.shields.io/crates/v/num-integer.svg
105+
[integer-d]: https://docs.rs/num-integer/
106+
[integer-db]: https://docs.rs/num-integer/badge.svg
107+
108+
[`num-iter`]: https://github.com/rust-num/num-iter
109+
[iter-c]: https://crates.io/crates/num-iter
110+
[iter-cb]: https://img.shields.io/crates/v/num-iter.svg
111+
[iter-d]: https://docs.rs/num-iter/
112+
[iter-db]: https://docs.rs/num-iter/badge.svg
113+
114+
[`num-rational`]: https://github.com/rust-num/num-rational
115+
[rational-c]: https://crates.io/crates/num-rational
116+
[rational-cb]: https://img.shields.io/crates/v/num-rational.svg
117+
[rational-d]: https://docs.rs/num-rational/
118+
[rational-db]: https://docs.rs/num-rational/badge.svg
119+
120+
[`num-traits`]: https://github.com/rust-num/num-traits
121+
[traits-c]: https://crates.io/crates/num-traits
122+
[traits-cb]: https://img.shields.io/crates/v/num-traits.svg
123+
[traits-d]: https://docs.rs/num-traits/
124+
[traits-db]: https://docs.rs/num-traits/badge.svg

RELEASES.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,46 @@
1-
# Release 0.1.42
1+
# Release 0.2.0 (2018-06-29)
2+
3+
All items exported from `num-integer`, `num-iter`, and `num-traits` are still
4+
semver-compatible with those exported by `num` 0.1. If you have these as public
5+
dependencies in your own crates, it is not a breaking change to move to `num`
6+
0.2. However, this is not true of `num-bigint`, `num-complex`, or
7+
`num-rational`, as those exported items are distinct in this release.
8+
9+
A few common changes are listed below, but most of the development happens in
10+
the individual sub-crates. Please consult their release notes for more details
11+
about recent changes:
12+
[`num-bigint`](https://github.com/rust-num/num-bigint/blob/master/RELEASES.md),
13+
[`num-complex`](https://github.com/rust-num/num-complex/blob/master/RELEASES.md),
14+
[`num-integer`](https://github.com/rust-num/num-integer/blob/master/RELEASES.md),
15+
[`num-iter`](https://github.com/rust-num/num-iter/blob/master/RELEASES.md),
16+
[`num-rational`](https://github.com/rust-num/num-rational/blob/master/RELEASES.md),
17+
and [`num-traits`](https://github.com/rust-num/num-traits/blob/master/RELEASES.md).
18+
19+
### Enhancements
20+
21+
- Updates to `num-integer`, `num-iter`, and `num-traits` are still compatible
22+
with `num` 0.1.
23+
- 128-bit integers are supported with Rust 1.26 and later.
24+
- `BigInt`, `BigUint`, `Complex`, and `Ratio` all implement `Sum` and `Product`.
25+
26+
### Breaking Changes
27+
28+
- `num` now requires rustc 1.15 or greater.
29+
- `num-bigint`, `num-complex`, and `num-rational` have all been updated to 0.2.
30+
- It's no longer possible to toggle individual `num-*` sub-crates using cargo
31+
features. If you need that control, please use those crates directly.
32+
- There is now a `std` feature, enabled by default, along with the implication
33+
that building *without* this feature makes this a `#![no_std]` crate.
34+
`num::bigint` is not available without `std`, and the other sub-crates may
35+
have limited functionality.
36+
- The `serde` dependency has been updated to 1.0, still disabled by default.
37+
The `rustc-serialize` crate is no longer supported by `num`.
38+
- The `rand` dependency has been updated to 0.5, now disabled by default. This
39+
requires rustc 1.22 or greater for `rand`'s own requirement.
40+
41+
**Contributors**: @CAD97, @cuviper, and the many sub-crate contributors!
42+
43+
# Release 0.1.42 (2018-02-08)
244

345
- [All of the num sub-crates now have their own source repositories][num-356].
446
- Updated num sub-crates to their latest versions.

ci/rustup.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
#!/bin/sh
22
# Use rustup to locally run the same suite of tests as .travis.yml.
3-
# (You should first install/update 1.8.0, stable, beta, and nightly.)
3+
# (You should first install/update all versions listed below.)
44

55
set -ex
66

77
export TRAVIS_RUST_VERSION
8-
for TRAVIS_RUST_VERSION in 1.8.0 stable beta nightly; do
8+
for TRAVIS_RUST_VERSION in 1.15.0 1.22.0 1.26.0 stable beta nightly; do
99
run="rustup run $TRAVIS_RUST_VERSION"
10-
if [ "$TRAVIS_RUST_VERSION" = 1.8.0 ]; then
11-
# rand 0.3.22 started depending on rand 0.4, which requires rustc 1.15
12-
# manually hacking the lockfile due to the limitations of cargo#2773
13-
$run cargo generate-lockfile
14-
$run sed -i -e 's/"rand 0.[34].[0-9]\+/"rand 0.3.20/' Cargo.lock
15-
$run sed -i -e '/^name = "rand"/,/^$/s/version = "0.3.[0-9]\+"/version = "0.3.20"/' Cargo.lock
16-
fi
1710
$run cargo build --verbose
1811
$run $PWD/ci/test_full.sh
1912
done

ci/test_full.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ set -ex
44

55
echo Testing num on rustc ${TRAVIS_RUST_VERSION}
66

7+
FEATURES="serde"
8+
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable|1.26.0|1.22.0)$ ]]; then
9+
FEATURES="$FEATURES rand"
10+
fi
11+
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable|1.26.0)$ ]]; then
12+
FEATURES="$FEATURES i128"
13+
fi
14+
715
# num should build and test everywhere.
816
cargo build --verbose
917
cargo test --verbose
@@ -13,11 +21,12 @@ cargo build --no-default-features
1321
cargo test --no-default-features
1422

1523
# Each isolated feature should also work everywhere.
16-
for feature in bigint complex rational rustc-serialize serde; do
17-
cargo build --verbose --no-default-features --features="$feature"
18-
cargo test --verbose --no-default-features --features="$feature"
24+
# (but still with "std", else bigint breaks)
25+
for feature in $FEATURES; do
26+
cargo build --verbose --no-default-features --features="std $feature"
27+
cargo test --verbose --no-default-features --features="std $feature"
1928
done
2029

21-
# Downgrade serde and build test the 0.7.0 channel as well
22-
cargo update -p serde --precise 0.7.0
23-
cargo build --verbose --features "serde"
30+
# test all supported features together
31+
cargo build --features="std $FEATURES"
32+
cargo test --features="std $FEATURES"

0 commit comments

Comments
 (0)