RFC: Add #[repr(pack = "N")]#1399
Conversation
Signed-off-by: Peter Atashian <retep998@gmail.com>
Signed-off-by: Peter Atashian <retep998@gmail.com>
Signed-off-by: Peter Atashian <retep998@gmail.com>
text/0000-repr-pack.md
Outdated
Signed-off-by: Peter Atashian <retep998@gmail.com>
text/0000-repr-pack.md
Outdated
There was a problem hiding this comment.
Please remove this paragraph.
Signed-off-by: Peter Atashian <retep998@gmail.com>
There was a problem hiding this comment.
This must be resolved. Verify against the behavior of clang (or gcc).
There was a problem hiding this comment.
Specifically clang or gcc on a platform other than Windows. On Windows they are supposed to match the msvc ABI.
|
The feature is necessary. If this behavior is in line with common C compilers, |
text/0000-repr-pack.md
Outdated
There was a problem hiding this comment.
s/effectivally/effectively/
|
For reference, here's an example of Clang doing this. |
Signed-off-by: Peter Atashian <retep998@gmail.com>
Signed-off-by: Peter Atashian <retep998@gmail.com>
|
See this comment for an interesting interaction edge case with the alignment RFC regarding required alignment. |
|
Hear ye, hear ye! This RFC is now entering final comment period. |
|
This seems right to have. I think the best is |
|
@ubsan It could become valid with #1559, though, or as @nrc mentions in a comment, the procedural macros RFC. |
|
I don't mind the syntax either way, as long as I can have this attribute at all. |
|
I think it should just extend |
|
Hmm, I think I too prefer |
|
One area the RFC did not (explicitly) address -- or I missed it -- is what to do if there are multiple Is there any reason one might want multiple specifiers? Like, independent macros might add tighter and tighter requirements? (However, unlike with alignment, it's not obvious to me whether you would want the max or min packing that was specified.) |
|
I think if we did allow specifying the packing multiple times, that the right thing to do would be to use the smallest packing specified. The alignment of any given field is As for the align RFC, there'd need to be a decision on how it interacts with packing. Whether it does the msvc style |
|
Huzzah! The @rust-lang/lang team has decided to accept this RFC, with the caveat that the attribute be renamed to We discussed a few other things:
|
|
Tracking issue: rust-lang/rust#33158 If you'd like to keep following the development of this feature, please subscribe to that issue, thanks! :) |
also adjust from `#[repr(pack = "N")]` to `#[repr(packed = "N")]`
Rendered