paholg / dimensioned

Compile-time dimensional analysis for various unit systems using Rust's type system.
https://crates.io/crates/dimensioned
MIT License
300 stars 23 forks source link

Use from stable Rust #4

Closed brendanzab closed 7 years ago

brendanzab commented 8 years ago

Dimensioned currently only works in non-stable Rust. Is it possible to disable some features when building on the stable channel, or are those features fundamentally necessary for the library implementation?

    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading dimensioned v0.4.0
 Downloading peano v1.0.1
 Downloading num v0.1.28
   Compiling peano v1.0.1
   Compiling rustc-serialize v0.3.16
   Compiling winapi v0.2.5
   Compiling libc v0.2.2
   Compiling winapi-build v0.1.1
   Compiling advapi32-sys v0.1.2
   Compiling rand v0.3.12
   Compiling num v0.1.28
   Compiling dimensioned v0.4.0
/Users/brendan/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/dimensioned-0.4.0/src/lib.rs:13:1: 13:54 error: #[feature] may not be used on the stable release channel
/Users/brendan/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/dimensioned-0.4.0/src/lib.rs:13 #![feature(optin_builtin_traits, zero_one, const_fn)]
                                                                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brendan/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/dimensioned-0.4.0/src/lib.rs:14:1: 14:25 error: #[feature] may not be used on the stable release channel
/Users/brendan/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/dimensioned-0.4.0/src/lib.rs:14 #![feature(type_macros)]
                                                                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile `dimensioned`.

To learn more, run the command again with --verbose.
paholg commented 8 years ago

I can look into it, but there are some things that require unstable that I at least would not want to use dimensioned without, like the ability to multiply with scalars on the left or right.

brendanzab commented 8 years ago

Yeah, it would be nice. I would like to get it working with cgmath.

paholg commented 8 years ago

type macros have stabilized, which means we're down to using two unstable features. One is const functions which we could do without.

The other is optin_builtin_traits which was a hack I did to make multiplication work right. It could (and should) be replaced by specialization, but I'll also look into how much it cripples dimensioned if it's behind a feature flag.

paholg commented 7 years ago

Rust stable is now 1.13, so dimensioned works on stable now!

iliekturtles commented 7 years ago

:tada: