Commit Graph

544 Commits

Author SHA1 Message Date
est31 c742cf9aec derive: use latest compiletest_rs crate
Version 2.2 was not compiling any more: https://github.com/laumann/compiletest-rs/issues/51
2017-01-07 23:51:21 +01:00
Homu a4faeeffc4 Auto merge of #250 - andersk:should_panic, r=cuviper
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.
```
2017-01-07 06:26:59 +09:00
Anders Kaseorg fd44a86866 rational: test_recip_fail: Correct should_panic syntax
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>
2017-01-06 15:05:01 -05:00
Homu d468177eee Auto merge of #248 - dnsl48:ratio_into_pair, r=cuviper
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.
2016-12-10 09:47:59 +09:00
dnsl48 9d7ab663b1 From<(T,T)> implementation 2016-12-10 09:19:02 +13:00
dnsl48 70da35dff5 Into<(T,T)> implementation 2016-12-10 08:39:06 +13:00
Homu 7db32a4ecd Auto merge of #246 - cuviper:complex-eq, r=hauleth
complex: derive Eq

Fixes #245.
2016-12-06 18:48:42 +09:00
Josh Stone 5531031252 complex: derive Eq
Fixes #245.
2016-12-05 23:11:40 -08:00
Homu dc8c8fc3f6 Auto merge of #244 - wictory:master, r=cuviper
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.
2016-12-03 07:14:51 +09:00
Homu a63bbc916f Auto merge of #243 - cuviper:intern-macros, r=hauleth
macros: update string interning

None
2016-12-03 07:08:30 +09:00
Wictor Lund 4bdad38eee Added test for trait From<T> for Ratio<T> where T: Clone + Integer. 2016-12-01 22:07:03 +02:00
Wictor Lund de91d5d9e3 Added trait From<T> for Ratio<T> where T: Clone + Integer 2016-12-01 21:38:53 +02:00
Josh Stone be61427d03 derive: bump to 0.1.38 2016-11-28 09:46:18 -08:00
Josh Stone 7ebef5bbe6 macros: update string interning 2016-11-28 09:41:18 -08:00
Josh Stone d7cbdb509c Merge pull request #242 from rust-num/feat/do-not-duplicate-enum-definition
Fix code duplication error

(Overriding a CI failure due to `num-macros`.)
2016-11-28 09:39:36 -08:00
Łukasz Jan Niemier 20243f5baa
fix(num_derive): code duplication error
Fixes #240
2016-11-27 19:31:33 +01:00
Homu 8489f0c388 Auto merge of #239 - bluss:doc-root-url, r=cuviper
Add doc(html_root_url) and other doc attrs to each crate

Also update to use https instead of http. This avoids mixed content
degradation on docs.rs.

The doc root URLs are correct as they are, the URL does not include the
crate name itself.
2016-11-05 02:33:34 +09:00
bluss ff2a350e98 Use the integer32 playground 2016-11-02 19:51:10 +01:00
bluss e4a6956e5a Add doc(html_root_url) and other doc attrs to each crate
Also update to use https instead of http. This avois mixed content
degradation on docs.rs.

The doc root URLs are correct as they are, the URL does not include the
crate name itself.
2016-11-01 02:14:23 +01:00
Homu 938ec63c95 Auto merge of #238 - bluss:fix-mut, r=cuviper
traits: Remove pattern in trait's method signature

This use of `mut` was nonsensical for now, but is proposed to be
disallowed by rustc in the future (as a bugfix).

See rust-lang/rust/pull/37378 for context.
2016-10-25 08:05:35 +09:00
bluss 96e96ef762 Remove pattern in trait's method signature
This use of `mut` was nonsensical for now, but is proposed to be
disallowed by rustc in the future (as a bugfix in Rust).
2016-10-25 00:42:44 +02:00
Josh Stone 8d4b7b3a8d derive: bump to 0.1.37 2016-10-14 20:52:24 -07:00
Homu f2aecb591c Auto merge of #236 - cuviper:proc-macro, r=hauleth
derive: update to proc-macro
2016-10-14 03:59:48 +09:00
Josh Stone 97551ade5b derive: update to proc-macro 2016-10-13 10:31:49 -07:00
Homu b6db1eace9 Auto merge of #235 - matklad:minor-corrections, r=cuviper
Minor, style and comment typo

Just a couple of super minor cosmetic corrections.
2016-10-06 01:30:42 +09:00
Aleksey Kladov ec6ce78458 Minor, style and comment typo 2016-10-05 18:47:30 +03:00
Josh Stone f25a3bd51d 0.1.36 bump for num, traits, macros, and the new derive 2016-09-29 23:31:23 -07:00
Homu 019c136b8c Auto merge of #228 - rust-num:fix/num-macros, r=cuviper
Fix `num-macros` `FromPrimitive` implementation

Current solution follow syntax proposed in rust-lang/rfcs#1681.

Tracking issue rust-lang/rust#35900

Close #227

Code broken after change:

- [ ] https://github.com/kdar/gameboy-rs
- [ ] https://github.com/lemonrock/mbedtls
- [ ] https://github.com/timorantalaiho/kelaa
- [ ] https://github.com/dylanede/cef-rs
- [ ] https://github.com/klutzy/aheui-llvm
- [ ] https://github.com/pcwalton/rust-media
- [ ] https://github.com/PistonDevelopers/hematite_server
2016-09-30 14:58:47 +09:00
Łukasz Jan Niemier b7e64074b2
Add new crate num-derive as an new replacement for num-macro 2016-09-28 13:33:13 +02:00
Łukasz Jan Niemier 0c89b893a9
Add compiletest crate to test against invalid derivations 2016-09-27 11:18:27 +02:00
Łukasz Jan Niemier b038b79900
Merge remote-tracking branch 'origin/master' into fix/num-macros 2016-09-26 20:45:49 +02:00
Łukasz Jan Niemier ada17a1793
Update to syn 0.6.0 2016-09-26 20:32:46 +02:00
Homu 338e4799e6 Auto merge of #231 - AtheMathmo:generic-epsilon, r=hauleth
Implementing epsilon function to retrieve EPSILON constant

Hey!

This PR exposes a new `epsilon` function in the `Float` trait so that users can access the `EPSILON` constant on the float types. I figured as this was such a minimal change it was easier to get a PR in offering the change then write up an issue.

For me this is a valuable addition. When writing linear algebra or other optimization routines with generic floats we often want to check if some stopping criteria is reached, often something like: `(a - b).abs() < eps`. Having access to a standard _small value_ would make this a little easier.
2016-09-23 04:25:29 +09:00
James Lucas 381942eb4f Adding default implementation 2016-09-22 19:56:44 +01:00
James Lucas a64cf66f4c Implementing epsilon function to retrieve EPSILON constant 2016-09-18 14:36:44 -07:00
Łukasz Jan Niemier e9768a0a76
Rebase leftovers 2016-09-18 22:45:53 +02:00
Łukasz Jan Niemier 43cfa25426
Add test case for which `syn` currently fails 2016-09-18 22:43:35 +02:00
Łukasz Jan Niemier 11f8289ed4
Fix `num-macros` `FromPrimitive` implementation
Current solution follow syntax proposed in rust-lang/rfcs#1681.

Tracking issue rust-lang/rust#35900

Close #227
2016-09-18 22:43:34 +02:00
Homu a11be641ed Auto merge of #229 - bluss:fix-macros, r=hauleth
Fix num-macros for nightly

Now compatible with rustc 1.13.0-nightly (32571c05c 2016-09-17)
2016-09-19 05:33:27 +09:00
bluss 6cfd6c8d18 Fix num-macros for nightly
Now compatible with rustc 1.13.0-nightly (32571c05c 2016-09-17)
2016-09-18 22:24:38 +02:00
Josh Stone c8ed8ff87b num, bigint, complex, rational, traits: 0.1.35 2016-08-18 08:28:34 -07:00
Homu 4fb22849b4 Auto merge of #222 - SuperFluffy:serde_0.8, r=cuviper
Use serde 0.8

I updated `bigint`, `complex`, and `rational` to use `serde 0.8`, and also fixed deserialization and the `serde` feature as such in the `rational` crate (didn't add any tests, but it compiles now).

Similar to https://github.com/rust-num/num/pull/196 for `num/complex`, “`use serde;`” needed to be removed in `num/rational`.
2016-08-18 06:24:42 +09:00
Richard Janis Goldschmidt 4f6f7b3292 Add travis build test of 0.7.0 channel 2016-08-17 23:12:20 +02:00
Homu b0fbcedfa0 Auto merge of #223 - SuperFluffy:fix_import_serde, r=cuviper
Fix import serde and rational deserialization

Similar to #196 for num/complex, “use serde;” needed to be removed in num/rational.

Also, deserialization of `num/rational` needed to be fixed by adding type annotations.

This is in response to https://github.com/rust-num/num/pull/222#issuecomment-239957062 of issue https://github.com/rust-num/num/pull/222.

Also added a travis line, in response to https://github.com/rust-num/num/pull/222#issuecomment-239957062. Hope it works.
2016-08-18 03:59:26 +09:00
Richard Janis Goldschmidt a4ccb797cf Allow serde version in [0.7,0.9) 2016-08-17 12:20:08 +02:00
Richard Janis Goldschmidt eb486e8dc1 Add build test for serde feature 2016-08-17 12:19:51 +02:00
Richard Janis Goldschmidt 20360ebccf Fix deserialization by giving type annotations. 2016-08-17 12:05:09 +02:00
Richard Janis Goldschmidt 7339d6cb9a Remove redundant `use serde`; it is an external crate. 2016-08-17 12:05:09 +02:00
Homu ccdf307cee Auto merge of #220 - IvanUkhov:constant, r=cuviper
Add a trait for floating-point constants

The pull request is to address issue #194. In order to keep the library organized, I’ve introduced a new trait for the new functionality. The trait is supposed to closely follows the [`consts`](https://doc.rust-lang.org/std/f64/consts/index.html) module from the standard library. There are at least the following three open questions:

1. What should the name of the trait be? Currently, it’s `Constant`; an alternative is `Consts`.
2. What should the names of the getters be? Currently, they are lower-case versions of the constants defined in the `consts` module. Note that `Float` provides `log2` and `log10`, whereas `LOG_2` and `LOG_10` get translated into `log_2` and `log_10`, respectively.
3. Should `Float` require the new trait? Or should it be left up to the user?

Please let me know what you think. Thank you!

Regards,
Ivan
2016-08-16 10:29:20 +09:00
Ivan Ukhov 01aad702af Add a trait for floating-point constants 2016-08-15 06:38:08 +02:00