From a058142a2cd46d0ac704f1f6302b3431b4f9410d Mon Sep 17 00:00:00 2001 From: Ryan Stewart Date: Mon, 6 Apr 2015 11:06:54 -0700 Subject: [PATCH] Get cgmath building in beta by removing remaining unstable feature use. Benching is unstable and therefore only available on nightly; removed from travis in the interim. --- .travis.yml | 1 - src/angle.rs | 3 ++- src/lib.rs | 1 - src/rotation.rs | 1 - src/transform.rs | 6 +++++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 98bbf43..ef83cf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ env: script: - cargo build - cargo test - - cargo bench - cargo doc after_script: # the doc directory needs to be in the root for rust-ci diff --git a/src/angle.rs b/src/angle.rs index 70f30c8..e3a84b8 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -276,10 +276,11 @@ impl One for Deg { fn one() -> Deg { deg(one()) } } +const PI_2: f64 = f64::consts::PI * 2f64; impl Angle for Rad { #[inline] fn from>(theta: A) -> Rad { theta.to_rad() } - #[inline] fn full_turn() -> Rad { rad(cast(f64::consts::PI_2).unwrap()) } + #[inline] fn full_turn() -> Rad { rad(cast(PI_2).unwrap()) } } impl diff --git a/src/lib.rs b/src/lib.rs index 4d2fcbd..261d681 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,7 +15,6 @@ #![crate_type = "rlib"] #![crate_type = "dylib"] -#![feature(plugin, core, custom_derive)] //! Computer graphics-centric math. //! diff --git a/src/rotation.rs b/src/rotation.rs index d2335dc..cf3e689 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -133,7 +133,6 @@ pub trait Rotation3: Rotation, Point3> /// matrix: /// /// ```no_run -/// #![feature(core)] /// use cgmath::rad; /// use cgmath::Vector2; /// use cgmath::{Matrix, ToMatrix2}; diff --git a/src/transform.rs b/src/transform.rs index fc41c1e..aca4006 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -14,6 +14,7 @@ // limitations under the License. use std::fmt; +use std::marker::PhantomFn; use rust_num::{zero, one}; @@ -237,7 +238,10 @@ impl Transform3 for AffineMatrix3 {} /// A trait that allows extracting components (rotation, translation, scale) /// from an arbitrary transformations -pub trait ToComponents, P: Point, R: Rotation> { +// PhantomFn works around a beta bug in deteriming the usage of S/P, and should be safely removed +// when PhantomFn deprecation lands in stable. +pub trait ToComponents, P: Point, R: Rotation> + : PhantomFn + PhantomFn

{ /// Extract the (scale, rotation, translation) triple fn decompose(&self) -> (V, R, V); }