-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for the previously merged TryFrom
#10
Conversation
Thanks @regexident I think you may need to install the rustfmt-preview in the Travis builder for the buld script to work, though? Let's see what bors says. bors r+ |
10: Fixes for the previously merged `TryFrom` r=japaric a=regexident Turns out generating shim code via `build.rs` and relying on being correct without compiling/running any of it during testing is a bad idea. Code that does not get compiled won't fail tests either. Embarrassing. Fixes: - I used `#[cfg(feature = “try_from”)]` instead `#[cfg(feature = “try-from”)]` causing my code to not even get generated. (#fdda4b1) - Had a wrong error type in one function that did not get caught. (#07319d7) - Had a wrong implementation in one function that did not get caught. (#e3d0328) Changes: - Switched errors from `core::num::TryFromIntError` to `cast::Error`. (#35a3fbd) - Removed impls of `TryFrom` for `usize`/`isize` to mirror ‘stdlib’. (#67a17b1) - Refactored unit tests. Let’s actually run them this time, shall we? (#b134161) As part of the unit test refactoring we are now also: - Testing `From` and `TryFrom` for every variant of `cast::From`, where applicable. - Splitting asserts into smaller test functions making it easier to see what's wrong. We now have **418 tests** for `num-traits` and **477 tests** for `cast::From`/`From`/`TryFrom`.
Build failed |
|
Could we try this one again, @japaric? |
Any chance to have this re-tested and merged, @japaric? |
Turns out generating shim code via
build.rs
and relying on being correct without compiling/running any of it during testing is a bad idea. Code that does not get compiled won't fail tests either. Embarrassing.Fixes:
#[cfg(feature = “try_from”)]
instead#[cfg(feature = “try-from”)]
causing my code to not even get generated. (#fdda4b1)Changes:
core::num::TryFromIntError
tocast::Error
. (#35a3fbd)TryFrom
forusize
/isize
to mirror ‘stdlib’. (#67a17b1)As part of the unit test refactoring we are now also:
From
andTryFrom
for every variant ofcast::From
, where applicable.We now have 418 tests for
num-traits
and 477 tests forcast::From
/From
/TryFrom
.