@@ -64,15 +64,21 @@ should match the equivalent struct in C.
6464` #[repr(packed)] `  and ` #[repr(pack = "1")] `  should have identical behavior.
6565
6666Because this lowers the effective alignment of fields in the same way that
67- ` #[repr(packed)] `  does (which caused https://github.com/rust-lang/rust/issues/27060  ),
68- while accessing a field should be safe, borrowing a field should be unsafe.
67+ ` #[repr(packed)] `  does (which caused [ issue #27060  ] [ gh27060 ] ), while accessing a
68+ field should be safe, borrowing a field should be unsafe.
69+ 
70+ Specifying ` #[repr(packed)] `  and ` #[repr(pack = "N")] `  where N is not 1 should
71+ result in an error.
72+ 
73+ Specifying ` #[repr(pack = "A")] `  and ` #[repr(align = "B")] `  should still pack
74+ together fields with the packing specified, but then increase the overall
75+ alignment to the alignment specified. Depends on [ RFC #1358  ] [ rfc1358 ]  landing.
6976
7077# Drawbacks  
7178[ drawbacks ] : #drawbacks 
7279
73- This would unfortunately make my life easier even though one of the unstated
74- goals of Rust is to make my life as difficult as possible when doing FFI with
75- Windows API.
80+ Duplication in the language where ` #[repr(packed)] `  and ` #[repr(pack = "1")] ` 
81+ have identical behavior.
7682
7783# Alternatives  
7884[ alternatives ] : #alternatives 
@@ -91,3 +97,6 @@ Windows API.
9197  it match the behavior of other C/C++ compilers as well?
9298*  Should it still be safe to borrow fields whose alignment is less than or equal
9399  to the specified packing or should all field borrows be unsafe?
100+ 
101+ [ gh27060 ] : https://github.com/rust-lang/rust/issues/27060 
102+ [ rfc1358 ] : https://github.com/rust-lang/rfcs/pull/1358 
0 commit comments