Skip to content

Commit a973376

Browse files
committed
Remove unnecessary uses of #[repr(packed)].
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.
1 parent 2e0366b commit a973376

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use Error;
33

44
/// A 3D vector.
55
#[derive(PartialEq, Copy, Clone, Debug)]
6-
#[repr(C, packed)]
6+
#[repr(C)]
77
pub struct Vector {
88
/// The x.
99
pub x: f32,
@@ -17,17 +17,17 @@ pub struct Vector {
1717

1818
/// A 3D vector representing position.
1919
#[derive(PartialEq, Copy, Clone, Debug)]
20-
#[repr(C, packed)]
20+
#[repr(C)]
2121
pub struct Position(pub Vector);
2222

2323
/// A 3D vector representing direction.
2424
#[derive(PartialEq, Copy, Clone, Debug)]
25-
#[repr(C, packed)]
25+
#[repr(C)]
2626
pub struct Direction(pub Vector);
2727

2828
/// A 3D vector representing velocity.
2929
#[derive(PartialEq, Copy, Clone, Debug)]
30-
#[repr(C, packed)]
30+
#[repr(C)]
3131
pub struct Velocity(pub Vector);
3232

3333
/// Two 3D vectors representing orientation.

0 commit comments

Comments
 (0)