From 7c415692c33de97e9cce2eb36d9b241bb93533b9 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 23 Mar 2015 14:30:31 +0100 Subject: [PATCH] Update for rustc --- Cargo.toml | 2 +- src/structs/dvec_macros.rs | 6 +++--- src/structs/mat_macros.rs | 4 ++-- tests/assert.rs | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9fb6ad36..338e4c2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ arbitrary = ["quickcheck"] [dependencies] rustc-serialize = "*" -rand = "0.1" +rand = "0.2" [dependencies.quickcheck] optional = true diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index 79d6fc05..dfbc2d1f 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -23,14 +23,14 @@ macro_rules! dvec_impl( /// Slices this vector. #[inline] pub fn as_slice<'a>(&'a self) -> &'a [N] { - self.at.slice_to(self.len()) + &self.at[.. self.len()] } /// Mutably slices this vector. #[inline] pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [N] { let len = self.len(); - self.at.slice_to_mut(len) + &mut self.at[.. len] } } @@ -443,7 +443,7 @@ macro_rules! small_dvec_from_impl ( let mut at: [N; $dim] = [ $( $zeros, )* ]; - for n in at.slice_to_mut(dim).iter_mut() { + for n in &mut at[.. dim] { *n = elem; } diff --git a/src/structs/mat_macros.rs b/src/structs/mat_macros.rs index 064ce573..5ea2fce7 100644 --- a/src/structs/mat_macros.rs +++ b/src/structs/mat_macros.rs @@ -327,7 +327,7 @@ macro_rules! col_slice_impl( fn col_slice(&self, cid: usize, rstart: usize, rend: usize) -> $slice { let col = self.col(cid); - $slice::from_slice(rend - rstart, col.as_array().slice(rstart, rend)) + $slice::from_slice(rend - rstart, &col.as_array()[rstart .. rend]) } } ) @@ -368,7 +368,7 @@ macro_rules! row_slice_impl( fn row_slice(&self, rid: usize, cstart: usize, cend: usize) -> $slice { let row = self.row(rid); - $slice::from_slice(cend - cstart, row.as_array().slice(cstart, cend)) + $slice::from_slice(cend - cstart, &row.as_array()[cstart .. cend]) } } ) diff --git a/tests/assert.rs b/tests/assert.rs index ef90ee76..a0b3a8c1 100644 --- a/tests/assert.rs +++ b/tests/assert.rs @@ -14,7 +14,7 @@ fn assert_approx_eq_f64() { } #[test] -#[should_fail] +#[should_panic] fn assert_approx_eq_vec2_f32_fail() { let a = Vec2::new(1.0f32, 0.0); let b = Vec2::new(1.1f32, 0.1); @@ -28,7 +28,7 @@ fn assert_approx_eq_eps_f32() { } #[test] -#[should_fail] +#[should_panic] fn assert_approx_eq_eps_f64_fail() { assert_approx_eq_eps!(1.0f64, 1.1, 0.05); } @@ -43,7 +43,7 @@ fn assert_approx_eq_ulps_f32() { } #[test] -#[should_fail] +#[should_panic] fn assert_approx_eq_ulps_f32_fail() { let x = 1000000_f32; let y = 1000000.1_f32; @@ -59,7 +59,7 @@ fn assert_approx_eq_ulps_f64() { } #[test] -#[should_fail] +#[should_panic] fn assert_approx_eq_ulps_f64_fail() { let x = 1000000_f64; let y = 1000000.0000000003_f64;