From f475822d9bfccfb695212e511bf7742e6113b414 Mon Sep 17 00:00:00 2001 From: Mark Hintz Date: Thu, 25 Aug 2016 15:41:39 +0200 Subject: [PATCH] Removes #[repr(packed)] from all structs where it was specified. This is intended as a partial fix for #375. It doesn't also remove #[repr(C)], since it's a bit unclear whether that's necessary. --- src/angle.rs | 8 ++++---- src/euler.rs | 4 ++-- src/matrix.rs | 12 ++++++------ src/point.rs | 12 ++++++------ src/quaternion.rs | 4 ++-- src/vector.rs | 16 ++++++++-------- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/angle.rs b/src/angle.rs index 926c996..c1fa517 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -30,8 +30,8 @@ use num::BaseFloat; /// An angle, in radians. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(Copy, Clone, PartialEq, PartialOrd)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -39,8 +39,8 @@ pub struct Rad(pub S); /// An angle, in degrees. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(Copy, Clone, PartialEq, PartialOrd)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] diff --git a/src/euler.rs b/src/euler.rs index 82a879c..60bcbd7 100644 --- a/src/euler.rs +++ b/src/euler.rs @@ -25,7 +25,7 @@ use num::BaseFloat; /// A set of [Euler angles] representing a rotation in three-dimensional space. /// -/// This type is marked as `#[repr(C, packed)]`. +/// This type is marked as `#[repr(C)]`. /// /// The axis rotation sequence is XYZ. That is, the rotation is first around /// the X axis, then the Y axis, and lastly the Z axis (using intrinsic @@ -72,7 +72,7 @@ use num::BaseFloat; /// [Euler angles]: https://en.wikipedia.org/wiki/Euler_angles /// [gimbal lock]: https://en.wikipedia.org/wiki/Gimbal_lock#Gimbal_lock_in_applied_mathematics /// [convert]: #defining-rotations-using-euler-angles -#[repr(C, packed)] +#[repr(C)] #[derive(Copy, Clone, Debug)] #[derive(PartialEq, Eq)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] diff --git a/src/matrix.rs b/src/matrix.rs index 20068b0..9d3acdf 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -33,8 +33,8 @@ use vector::{Vector2, Vector3, Vector4}; /// A 2 x 2, column major matrix /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(Copy, Clone, PartialEq)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -47,8 +47,8 @@ pub struct Matrix2 { /// A 3 x 3, column major matrix /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(Copy, Clone, PartialEq)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -63,8 +63,8 @@ pub struct Matrix3 { /// A 4 x 4, column major matrix /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(Copy, Clone, PartialEq)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] diff --git a/src/point.rs b/src/point.rs index 80ced1a..a81312c 100644 --- a/src/point.rs +++ b/src/point.rs @@ -29,8 +29,8 @@ use vector::{Vector1, Vector2, Vector3, Vector4}; /// A point in 1-dimensional space. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -40,8 +40,8 @@ pub struct Point1 { /// A point in 2-dimensional space. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -52,8 +52,8 @@ pub struct Point2 { /// A point in 3-dimensional space. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] diff --git a/src/quaternion.rs b/src/quaternion.rs index b08b8b6..c97aea6 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -34,8 +34,8 @@ use vector::Vector3; /// A [quaternion](https://en.wikipedia.org/wiki/Quaternion) in scalar/vector /// form. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] diff --git a/src/vector.rs b/src/vector.rs index 10369f1..dbab97b 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -27,8 +27,8 @@ use num::{BaseNum, BaseFloat, PartialOrd}; /// A 1-dimensional vector. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -39,8 +39,8 @@ pub struct Vector1 { /// A 2-dimensional vector. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -53,8 +53,8 @@ pub struct Vector2 { /// A 3-dimensional vector. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))] @@ -69,8 +69,8 @@ pub struct Vector3 { /// A 4-dimensional vector. /// -/// This type is marked as `#[repr(C, packed)]`. -#[repr(C, packed)] +/// This type is marked as `#[repr(C)]`. +#[repr(C)] #[derive(PartialEq, Eq, Copy, Clone, Hash)] #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))] #[cfg_attr(feature = "eders", derive(Serialize, Deserialize))]