fail -> panic

This commit is contained in:
Steve Klabnik 2014-10-30 00:25:47 -04:00
parent f998368fd7
commit 426ba307ab
5 changed files with 32 additions and 32 deletions

View File

@ -227,7 +227,7 @@ Rotation<Vec3<N>> for Rot3<N> {
if denom.is_zero() { if denom.is_zero() {
// XXX: handle that properly // XXX: handle that properly
// fail!("Internal error: singularity.") // panic!("Internal error: singularity.")
Zero::zero() Zero::zero()
} }
else { else {
@ -338,37 +338,37 @@ impl<N: Float + Clone>
Rotation<Vec4<N>> for Rot4<N> { Rotation<Vec4<N>> for Rot4<N> {
#[inline] #[inline]
fn rotation(&self) -> Vec4<N> { fn rotation(&self) -> Vec4<N> {
fail!("Not yet implemented") panic!("Not yet implemented")
} }
#[inline] #[inline]
fn inv_rotation(&self) -> Vec4<N> { fn inv_rotation(&self) -> Vec4<N> {
fail!("Not yet implemented") panic!("Not yet implemented")
} }
#[inline] #[inline]
fn append_rotation(&mut self, _: &Vec4<N>) { fn append_rotation(&mut self, _: &Vec4<N>) {
fail!("Not yet implemented") panic!("Not yet implemented")
} }
#[inline] #[inline]
fn append_rotation_cpy(_: &Rot4<N>, _: &Vec4<N>) -> Rot4<N> { fn append_rotation_cpy(_: &Rot4<N>, _: &Vec4<N>) -> Rot4<N> {
fail!("Not yet implemented") panic!("Not yet implemented")
} }
#[inline] #[inline]
fn prepend_rotation(&mut self, _: &Vec4<N>) { fn prepend_rotation(&mut self, _: &Vec4<N>) {
fail!("Not yet implemented") panic!("Not yet implemented")
} }
#[inline] #[inline]
fn prepend_rotation_cpy(_: &Rot4<N>, _: &Vec4<N>) -> Rot4<N> { fn prepend_rotation_cpy(_: &Rot4<N>, _: &Vec4<N>) -> Rot4<N> {
fail!("Not yet implemented") panic!("Not yet implemented")
} }
#[inline] #[inline]
fn set_rotation(&mut self, _: Vec4<N>) { fn set_rotation(&mut self, _: Vec4<N>) {
fail!("Not yet implemented") panic!("Not yet implemented")
} }
} }

View File

@ -51,27 +51,27 @@ impl<V: Zero> Translation<V> for mat::Identity {
#[inline] #[inline]
fn append_translation(&mut self, _: &V) { fn append_translation(&mut self, _: &V) {
fail!("Attempted to translate the identity matrix.") panic!("Attempted to translate the identity matrix.")
} }
#[inline] #[inline]
fn append_translation_cpy(_: &mat::Identity, _: &V) -> mat::Identity { fn append_translation_cpy(_: &mat::Identity, _: &V) -> mat::Identity {
fail!("Attempted to translate the identity matrix.") panic!("Attempted to translate the identity matrix.")
} }
#[inline] #[inline]
fn prepend_translation(&mut self, _: &V) { fn prepend_translation(&mut self, _: &V) {
fail!("Attempted to translate the identity matrix.") panic!("Attempted to translate the identity matrix.")
} }
#[inline] #[inline]
fn prepend_translation_cpy(_: &mat::Identity, _: &V) -> mat::Identity { fn prepend_translation_cpy(_: &mat::Identity, _: &V) -> mat::Identity {
fail!("Attempted to translate the identity matrix.") panic!("Attempted to translate the identity matrix.")
} }
#[inline] #[inline]
fn set_translation(&mut self, _: V) { fn set_translation(&mut self, _: V) {
fail!("Attempted to translate the identity matrix.") panic!("Attempted to translate the identity matrix.")
} }
} }
@ -100,27 +100,27 @@ impl<V: Zero> Rotation<V> for mat::Identity {
#[inline] #[inline]
fn append_rotation(&mut self, _: &V) { fn append_rotation(&mut self, _: &V) {
fail!("Attempted to rotate the identity matrix.") panic!("Attempted to rotate the identity matrix.")
} }
#[inline] #[inline]
fn append_rotation_cpy(_: &mat::Identity, _: &V) -> mat::Identity { fn append_rotation_cpy(_: &mat::Identity, _: &V) -> mat::Identity {
fail!("Attempted to rotate the identity matrix.") panic!("Attempted to rotate the identity matrix.")
} }
#[inline] #[inline]
fn prepend_rotation(&mut self, _: &V) { fn prepend_rotation(&mut self, _: &V) {
fail!("Attempted to rotate the identity matrix.") panic!("Attempted to rotate the identity matrix.")
} }
#[inline] #[inline]
fn prepend_rotation_cpy(_: &mat::Identity, _: &V) -> mat::Identity { fn prepend_rotation_cpy(_: &mat::Identity, _: &V) -> mat::Identity {
fail!("Attempted to rotate the identity matrix.") panic!("Attempted to rotate the identity matrix.")
} }
#[inline] #[inline]
fn set_rotation(&mut self, _: V) { fn set_rotation(&mut self, _: V) {
fail!("Attempted to rotate the identity matrix.") panic!("Attempted to rotate the identity matrix.")
} }
} }
@ -156,27 +156,27 @@ impl<M: One> Transformation<M> for mat::Identity {
#[inline] #[inline]
fn append_transformation(&mut self, _: &M) { fn append_transformation(&mut self, _: &M) {
fail!("Attempted to transform the identity matrix.") panic!("Attempted to transform the identity matrix.")
} }
#[inline] #[inline]
fn append_transformation_cpy(_: &mat::Identity, _: &M) -> mat::Identity { fn append_transformation_cpy(_: &mat::Identity, _: &M) -> mat::Identity {
fail!("Attempted to transform the identity matrix.") panic!("Attempted to transform the identity matrix.")
} }
#[inline] #[inline]
fn prepend_transformation(&mut self, _: &M) { fn prepend_transformation(&mut self, _: &M) {
fail!("Attempted to transform the identity matrix.") panic!("Attempted to transform the identity matrix.")
} }
#[inline] #[inline]
fn prepend_transformation_cpy(_: &mat::Identity, _: &M) -> mat::Identity { fn prepend_transformation_cpy(_: &mat::Identity, _: &M) -> mat::Identity {
fail!("Attempted to transform the identity matrix.") panic!("Attempted to transform the identity matrix.")
} }
#[inline] #[inline]
fn set_transformation(&mut self, _: M) { fn set_transformation(&mut self, _: M) {
fail!("Attempted to transform the identity matrix.") panic!("Attempted to transform the identity matrix.")
} }
} }

View File

@ -144,7 +144,7 @@ impl<N: Clone> Row<Vec3<N>> for Mat3<N> {
0 => Vec3::new(self.m11.clone(), self.m12.clone(), self.m13.clone()), 0 => Vec3::new(self.m11.clone(), self.m12.clone(), self.m13.clone()),
1 => Vec3::new(self.m21.clone(), self.m22.clone(), self.m23.clone()), 1 => Vec3::new(self.m21.clone(), self.m22.clone(), self.m23.clone()),
2 => Vec3::new(self.m31.clone(), self.m32.clone(), self.m33.clone()), 2 => Vec3::new(self.m31.clone(), self.m32.clone(), self.m33.clone()),
_ => fail!(format!("Index out of range: 3d matrices do not have {} rows.", i)) _ => panic!(format!("Index out of range: 3d matrices do not have {} rows.", i))
} }
} }
@ -166,7 +166,7 @@ impl<N: Clone> Row<Vec3<N>> for Mat3<N> {
self.m32 = r.y.clone(); self.m32 = r.y.clone();
self.m33 = r.z; self.m33 = r.z;
}, },
_ => fail!(format!("Index out of range: 3d matrices do not have {} rows.", i)) _ => panic!(format!("Index out of range: 3d matrices do not have {} rows.", i))
} }
} }
@ -184,7 +184,7 @@ impl<N: Clone> Col<Vec3<N>> for Mat3<N> {
0 => Vec3::new(self.m11.clone(), self.m21.clone(), self.m31.clone()), 0 => Vec3::new(self.m11.clone(), self.m21.clone(), self.m31.clone()),
1 => Vec3::new(self.m12.clone(), self.m22.clone(), self.m32.clone()), 1 => Vec3::new(self.m12.clone(), self.m22.clone(), self.m32.clone()),
2 => Vec3::new(self.m13.clone(), self.m23.clone(), self.m33.clone()), 2 => Vec3::new(self.m13.clone(), self.m23.clone(), self.m33.clone()),
_ => fail!(format!("Index out of range: 3d matrices do not have {} cols.", i)) _ => panic!(format!("Index out of range: 3d matrices do not have {} cols.", i))
} }
} }
@ -206,7 +206,7 @@ impl<N: Clone> Col<Vec3<N>> for Mat3<N> {
self.m23 = r.y.clone(); self.m23 = r.y.clone();
self.m33 = r.z; self.m33 = r.z;
}, },
_ => fail!(format!("Index out of range: 3d matrices do not have {} cols.", i)) _ => panic!(format!("Index out of range: 3d matrices do not have {} cols.", i))
} }
} }

View File

@ -53,7 +53,7 @@ impl<N: Clone> Row<Vec1<N>> for Vec2<N> {
match i { match i {
0 => Vec1::new(self.x.clone()), 0 => Vec1::new(self.x.clone()),
1 => Vec1::new(self.y.clone()), 1 => Vec1::new(self.y.clone()),
_ => fail!(format!("Index out of range: 2d vectors do not have {} rows. ", i)) _ => panic!(format!("Index out of range: 2d vectors do not have {} rows. ", i))
} }
} }
@ -62,7 +62,7 @@ impl<N: Clone> Row<Vec1<N>> for Vec2<N> {
match i { match i {
0 => self.x = r.x, 0 => self.x = r.x,
1 => self.y = r.x, 1 => self.y = r.x,
_ => fail!(format!("Index out of range: 2d vectors do not have {} rows.", i)) _ => panic!(format!("Index out of range: 2d vectors do not have {} rows.", i))
} }
} }
@ -213,7 +213,7 @@ impl<N: Cast<f32> + Clone> UniformSphereSample for Vec3<N> {
impl<N: Cast<f32> + Clone> UniformSphereSample for Vec4<N> { impl<N: Cast<f32> + Clone> UniformSphereSample for Vec4<N> {
#[inline(always)] #[inline(always)]
fn sample(_: |Vec4<N>| -> ()) { fn sample(_: |Vec4<N>| -> ()) {
fail!("UniformSphereSample::<Vec4<N>>::sample : Not yet implemented.") panic!("UniformSphereSample::<Vec4<N>>::sample : Not yet implemented.")
// for sample in SAMPLES_3_F32.iter() { // for sample in SAMPLES_3_F32.iter() {
// f(Cast::from(*sample)) // f(Cast::from(*sample))
// } // }

View File

@ -10,7 +10,7 @@ use structs::vec;
impl<N> Indexable<uint, N> for vec::Vec0<N> { impl<N> Indexable<uint, N> for vec::Vec0<N> {
#[inline] #[inline]
fn at(&self, _: uint) -> N { fn at(&self, _: uint) -> N {
fail!("Cannot index a Vec0.") panic!("Cannot index a Vec0.")
} }
#[inline] #[inline]
@ -28,7 +28,7 @@ impl<N> Indexable<uint, N> for vec::Vec0<N> {
#[inline] #[inline]
unsafe fn unsafe_at(&self, _: uint) -> N { unsafe fn unsafe_at(&self, _: uint) -> N {
fail!("Cannot index a Vec0.") panic!("Cannot index a Vec0.")
} }
#[inline] #[inline]