From f5e6545b2deec70c7e1acadaae138fe42b3acc85 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 20 Feb 2018 22:00:47 -0800 Subject: [PATCH] Use num-traits, and release num-derive 0.2.0 --- Cargo.toml | 7 +++---- README.md | 4 ++-- RELEASES.md | 14 ++++++++++++++ src/lib.rs | 10 +++++----- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b0eb120..03ed943 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ categories = [ "science" ] license = "MIT/Apache-2.0" name = "num-derive" repository = "https://github.com/rust-num/num-derive" -version = "0.1.44" +version = "0.2.0" readme = "README.md" [dependencies] @@ -18,9 +18,8 @@ syn = "0.12.7" [dev-dependencies] compiletest_rs = "0.3.5" - -[dev-dependencies.num] -version = "0.1" +num-traits = "0.2" +num = "0.1" [features] full-syntax = ["syn/full"] diff --git a/README.md b/README.md index e56540e..75ac6d5 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -num = "0.1" -num-derive = "0.1" +num-traits = "0.2" +num-derive = "0.2" ``` and this to your crate root: diff --git a/RELEASES.md b/RELEASES.md index 5785fdd..5281b1a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,15 @@ +# Release 0.2.0 + +- [Discriminant matching is now simplified][10], casting values directly by + name, rather than trying to compute offsets from known values manually. +- **breaking change**: [Derivations now import the traits from `num-traits`][11] + instead of the full `num` crate. These are still compatible, but users need + to have an explicit `num-traits = "0.2"` dependency in their `Cargo.toml`. + +[10]: https://github.com/rust-num/num-derive/pull/10 +[11]: https://github.com/rust-num/num-derive/pull/11 + + # Release 0.1.44 - [The derived code now explicitly allows `unused_qualifications`][9], so users @@ -5,6 +17,7 @@ [9]: https://github.com/rust-num/num-derive/pull/9 + # Release 0.1.43 - [The derived code now explicitly allows `trivial_numeric_casts`][7], so users @@ -12,6 +25,7 @@ [7]: https://github.com/rust-num/num-derive/pull/7 + # Release 0.1.42 - [num-derive now has its own source repository][num-356] at [rust-num/num-derive][home]. diff --git a/src/lib.rs b/src/lib.rs index 318ff38..61d63f3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,7 @@ // except according to those terms. #![crate_type = "proc-macro"] -#![doc(html_root_url = "https://docs.rs/num-derive/0.1")] +#![doc(html_root_url = "https://docs.rs/num-derive/0.2")] extern crate proc_macro; @@ -59,9 +59,9 @@ pub fn from_primitive(input: TokenStream) -> TokenStream { #[allow(non_upper_case_globals)] #[allow(unused_qualifications)] const #dummy_const: () = { - extern crate num as _num; + extern crate num_traits as _num_traits; - impl _num::traits::FromPrimitive for #name { + impl _num_traits::FromPrimitive for #name { #[allow(trivial_numeric_casts)] fn from_i64(#from_i64_var: i64) -> Option { #(#clauses else)* { @@ -124,9 +124,9 @@ pub fn to_primitive(input: TokenStream) -> TokenStream { #[allow(non_upper_case_globals)] #[allow(unused_qualifications)] const #dummy_const: () = { - extern crate num as _num; + extern crate num_traits as _num_traits; - impl _num::traits::ToPrimitive for #name { + impl _num_traits::ToPrimitive for #name { #[allow(trivial_numeric_casts)] fn to_i64(&self) -> Option { #match_expr