Skip to content

Commit

Permalink
Remove unnecessary uses of #[repr(packed)].
Browse files Browse the repository at this point in the history
These structs are laid out the same way with or without `packed`, since
they're just repeats of a single element type. That is, they're always
going to be three contiguous `f32`s.

The removal is good because there's some correctness issues with it, so
there may be breaking changes to it in future and removing it now will
avoid them all together. See
rust-lang/rust#27060.
  • Loading branch information
huonw committed Jul 24, 2015
1 parent 2e0366b commit a973376
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Error;

/// A 3D vector.
#[derive(PartialEq, Copy, Clone, Debug)]
#[repr(C, packed)]
#[repr(C)]
pub struct Vector {
/// The x.
pub x: f32,
Expand All @@ -17,17 +17,17 @@ pub struct Vector {

/// A 3D vector representing position.
#[derive(PartialEq, Copy, Clone, Debug)]
#[repr(C, packed)]
#[repr(C)]
pub struct Position(pub Vector);

/// A 3D vector representing direction.
#[derive(PartialEq, Copy, Clone, Debug)]
#[repr(C, packed)]
#[repr(C)]
pub struct Direction(pub Vector);

/// A 3D vector representing velocity.
#[derive(PartialEq, Copy, Clone, Debug)]
#[repr(C, packed)]
#[repr(C)]
pub struct Velocity(pub Vector);

/// Two 3D vectors representing orientation.
Expand Down

0 comments on commit a973376

Please sign in to comment.