diff options
| author | Corey Richardson <corey@octayn.net> | 2014-05-26 23:56:52 -0700 |
|---|---|---|
| committer | Corey Richardson <corey@octayn.net> | 2014-08-20 21:02:23 -0400 |
| commit | 6e8ff999589a7b4c7f62f7128f3e028a7b3ea64f (patch) | |
| tree | 71eb65a9aefa3503f15b4bd8245f36081f658c27 /src/test/debuginfo | |
| parent | 54bd9e6323742de87a526931a15558319db30604 (diff) | |
| download | rust-6e8ff999589a7b4c7f62f7128f3e028a7b3ea64f.tar.gz rust-6e8ff999589a7b4c7f62f7128f3e028a7b3ea64f.zip | |
librustc: handle repr on structs, require it for ffi, unify with packed
As of RFC 18, struct layout is undefined. Opting into a C-compatible struct layout is now down with #[repr(C)]. For consistency, specifying a packed layout is now also down with #[repr(packed)]. Both can be specified. To fix errors caused by this, just add #[repr(C)] to the structs, and change #[packed] to #[repr(packed)] Closes #14309 [breaking-change]
Diffstat (limited to 'src/test/debuginfo')
| -rw-r--r-- | src/test/debuginfo/c-style-enum-in-composite.rs | 2 | ||||
| -rw-r--r-- | src/test/debuginfo/packed-struct-with-destructor.rs | 10 | ||||
| -rw-r--r-- | src/test/debuginfo/packed-struct.rs | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/test/debuginfo/c-style-enum-in-composite.rs b/src/test/debuginfo/c-style-enum-in-composite.rs index f7351728290..ef23e7ee876 100644 --- a/src/test/debuginfo/c-style-enum-in-composite.rs +++ b/src/test/debuginfo/c-style-enum-in-composite.rs @@ -87,7 +87,7 @@ struct PaddedStruct { e: i16 } -#[packed] +#[repr(packed)] struct PackedStruct { a: i16, b: AnEnum, diff --git a/src/test/debuginfo/packed-struct-with-destructor.rs b/src/test/debuginfo/packed-struct-with-destructor.rs index 215d961b71b..00a560edbf0 100644 --- a/src/test/debuginfo/packed-struct-with-destructor.rs +++ b/src/test/debuginfo/packed-struct-with-destructor.rs @@ -77,7 +77,7 @@ #![allow(unused_variable)] -#[packed] +#[repr(packed)] struct Packed { x: i16, y: i32, @@ -88,7 +88,7 @@ impl Drop for Packed { fn drop(&mut self) {} } -#[packed] +#[repr(packed)] struct PackedInPacked { a: i32, b: Packed, @@ -113,7 +113,7 @@ impl Drop for Unpacked { fn drop(&mut self) {} } -#[packed] +#[repr(packed)] struct UnpackedInPacked { a: i16, b: Unpacked, @@ -121,7 +121,7 @@ struct UnpackedInPacked { d: i64 } -#[packed] +#[repr(packed)] struct PackedInPackedWithDrop { a: i32, b: Packed, @@ -144,7 +144,7 @@ impl Drop for PackedInUnpackedWithDrop { fn drop(&mut self) {} } -#[packed] +#[repr(packed)] struct UnpackedInPackedWithDrop { a: i16, b: Unpacked, diff --git a/src/test/debuginfo/packed-struct.rs b/src/test/debuginfo/packed-struct.rs index 8201afe3a01..bf2213509cf 100644 --- a/src/test/debuginfo/packed-struct.rs +++ b/src/test/debuginfo/packed-struct.rs @@ -63,14 +63,14 @@ #![allow(unused_variable)] -#[packed] +#[repr(packed)] struct Packed { x: i16, y: i32, z: i64 } -#[packed] +#[repr(packed)] struct PackedInPacked { a: i32, b: Packed, @@ -95,7 +95,7 @@ struct Unpacked { } // layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd -#[packed] +#[repr(packed)] struct UnpackedInPacked { a: i16, b: Unpacked, |
