bigint: Create the parsing error better for nested `+`
If a `+` is encountered in the middle of parsing a BigUint, this should
generate an `ParseIntError::InvalidDigit`. Since we can't create that
directly, we get it by trying to parse a `u64` from this point, but of
course `+` is a perfectly valid prefix to a `u64`.
Now we include the previous character in the string passed to `u64`, so it
has proper parsing context to understand what's in error.
Fixes#268.
If a `+` is encountered in the middle of parsing a BigUint, this should
generate an `ParseIntError::InvalidDigit`. Since we can't create that
directly, we get it by trying to parse a `u64` from this point, but of
course `+` is a perfectly valid prefix to a `u64`.
Now we include the previous character in the string passed to `u64`, so
it has proper parsing context to understand what's in error.
Fixes#268.
Bump rustc to 1.8 and revamp all CI
This bumps the minimum rustc to 1.8.0, "fixing" #257. I normally
consider this a breaking change, but we were already broken due to
external factors, for which I couldn't find a workaround.
This adds 1.15.0 to the CI matrix to build stable num-derive. We still
need nightly to run its tests though, because of compiletest_rs, and
dev-dependencies can't be optional.
The testing scripts are moved from .travis/ to ci/, as they don't really
need to be hidden. It's also now consolidated into one test_full.sh
which considers $TRAVIS_RUST_VERSION as needed.
This bumps the minimum rustc to 1.8.0, "fixing" #257. I normally
consider this a breaking change, but we were already broken due to
external factors, for which I couldn't find a workaround.
This adds 1.15.0 to the CI matrix to build stable num-derive. We still
need nightly to run its tests though, because of compiletest_rs, and
dev-dependencies can't be optional.
The testing scripts are moved from .travis/ to ci/, as they don't really
need to be hidden. It's also now consolidated into one test_full.sh
which considers $TRAVIS_RUST_VERSION as needed.
rational: test_recip_fail: Correct should_panic syntax
Fixes this warning with rustc nightly:
```
warning: attribute must be of the form: `#[should_panic]` or `#[should_panic(expected = "error message")]`
--> rational/src/lib.rs:1051:7
|
1051 | #[should_panic = "== 0"]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.
```
Fixes this warning:
warning: attribute must be of the form: `#[should_panic]` or `#[should_panic(expected = "error message")]`
--> rational/src/lib.rs:1051:7
|
1051 | #[should_panic = "== 0"]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
rational: Into<(T,T)> implementation
Right now it appears impossible to get integers without cloning them. Converting into a pair can be a cheap and easy way to extract the data.
Added trait From<T> for Ratio<T> where T: Clone + Integer
Hi!
So I thought that this kind of trait would be useful when one wants to write code which should be generic over different types of numbers.