From 5c6c37812850194847e1778322f3a17489e6dd05 Mon Sep 17 00:00:00 2001 From: Norbert Nemec Date: Sun, 1 Sep 2019 22:56:26 +0200 Subject: [PATCH] add "simd" test with nightly-2019-01-01 toolchain and get it working --- .travis.yml | 3 +++ Cargo.toml | 4 ++-- src/conv.rs | 10 ++++++---- src/macros.rs | 4 ++-- src/quaternion_simd.rs | 7 +++++++ src/vector_simd.rs | 7 +++++++ 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index dfac6df..0ef33bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,9 @@ matrix: env: CARGO_FEATURES="simd" - rust: nightly env: CARGO_FEATURES="serde simd" + - rust: nightly-2019-01-01 + # an old nightly build where "simd" still worked and "specialization" + env: CARGO_FEATURES="simd" allow_failures: - rust: nightly diff --git a/Cargo.toml b/Cargo.toml index dfebc25..1563bf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,8 +26,8 @@ mint = { version = "0.5", optional = true } num-traits = "0.2" rand = { version = "0.7", optional = true } serde = { version = "1.0", features = ["serde_derive"], optional = true } -simd = { version = "0.2", optional = true } +simd = { version = "0.2", optional = true } # works only in rust toolchain up to 1.32 [dev-dependencies] -glium = "0.23" +# glium = "0.23" # causes problems with nightly-2019-01-01 needed for testing "simd" serde_json = "1.0" diff --git a/src/conv.rs b/src/conv.rs index 833ebef..a6abd42 100644 --- a/src/conv.rs +++ b/src/conv.rs @@ -4,7 +4,8 @@ //! For example, when declaring `glium` uniforms, we need to convert to fixed //! length arrays. We can use the `Into` trait directly, but it is rather ugly! //! -//! ```rust +//! --- Doc-test disabled because glium causes problems with nightly-2019-01-01 needed for "simd" +//! ` ` `rust //! #[macro_use] //! extern crate glium; //! extern crate cgmath; @@ -22,11 +23,12 @@ //! // Yuck!! (ノಥ益ಥ)ノ ┻━┻ //! }; //! # } -//! ``` +//! ` ` ` //! //! Instead, we can use the conversion functions from the `conv` module: //! -//! ```rust +//! --- Doc-test disabled because glium causes problems nightly-2019-01-01 needed for "simd" +//! ` ` `rust //! #[macro_use] //! extern crate glium; //! extern crate cgmath; @@ -45,7 +47,7 @@ //! // ┬─┬ノ( º _ ºノ) //! }; //! # } -//! ``` +//! ` ` ` /// Force a conversion into a 2-element array. #[inline] diff --git a/src/macros.rs b/src/macros.rs index 8f9ba5d..bbcf924 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -17,12 +17,12 @@ #![macro_use] -#[cfg(feature = "specialization")] +#[cfg(feature = "simd")] macro_rules! default_fn { { $($tt:tt)* } => { default fn $( $tt )* }; } -#[cfg(not(feature = "specialization"))] +#[cfg(not(feature = "simd"))] macro_rules! default_fn { { $($tt:tt)* } => { fn $( $tt )* }; } diff --git a/src/quaternion_simd.rs b/src/quaternion_simd.rs index f513277..83ccad8 100644 --- a/src/quaternion_simd.rs +++ b/src/quaternion_simd.rs @@ -13,6 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use quaternion::*; + +use structure::*; + +use std::mem; +use std::ops::*; + use simd::f32x4 as Simdf32x4; impl From for Quaternion { diff --git a/src/vector_simd.rs b/src/vector_simd.rs index 7d89404..3c41d1a 100644 --- a/src/vector_simd.rs +++ b/src/vector_simd.rs @@ -13,6 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use vector::*; + +use structure::*; + +use std::mem; +use std::ops::*; + use simd::f32x4 as Simdf32x4; use simd::i32x4 as Simdi32x4; use simd::u32x4 as Simdu32x4;