-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documented the #[repr(align(x))]
attribute.
#182
Conversation
I thought I removed most of the verbiage of the You'll instead want to add a section ```The |
Ah OK, should I leave the text I added to |
It's better to just link to the full description of the representation attribute from the attributes.md page, so as to avoid duplicating information too much. I just forgot to clean up the attributes.md page when the type layout page landed. |
8e76a8b
to
2866fda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prose is good, just the paragraph structure feels off.
Also, since Github doesn't let me put a comment on lines you're not touching, on line 109 of type layout, you need to add align
to the list.
Also, Github doesn't notify me when there are new commits. Leave a comment or else I won't see it quickly.
src/type-layout.md
Outdated
@@ -264,13 +264,23 @@ For all other enumerations, the layout is unspecified. | |||
|
|||
Likewise, combining two primitive representations together is unspecified. | |||
|
|||
### The `packed` Representation | |||
### `align(x)` Representation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be called The `align` Representation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github ate most of my previous review comments. ;.; So here's a redo at the review.
src/type-layout.md
Outdated
two of type `u32`. The `align` representation cannot lower the alignment of a | ||
type. | ||
|
||
### `packed` Representation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got rid of the The
here.
|
||
The `packed` representation can only be used on `struct`s and `union`s. | ||
|
||
It modifies the representation (either the default or `C`) by removing any | ||
padding bytes and forcing the alignment of the type to `1`. | ||
|
||
The `align` and `packed` representations cannot be applied on the same type and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section should also be included in the align representation section.
src/type-layout.md
Outdated
### The `packed` Representation | ||
### `align(x)` Representation | ||
|
||
The `align(x)` representation can be used on `struct`s and `union`s to raise the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The paragraph structure here should mirror the packed representation section. So which categories of types it can be applied to should be one paragraph, and what it does should be another.
src/type-layout.md
Outdated
### The `packed` Representation | ||
### `align(x)` Representation | ||
|
||
The `align(x)` representation can be used on `struct`s and `union`s to raise the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the (x)
from the name. Instead, describe how it takes the alignment as a parameter in the paragraph describing how it works.
2866fda
to
4362137
Compare
Thanks @Havvy I think I've addressed your feedback. This stuff hasn't been stabilized quite yet so you might want to wait until that happens before accepting the PR I guess. |
Github shows that you did a force push, but I don't actually see any changes in the new commit. I even checked your branch and there's no difference there either. |
4362137
to
0e02e80
Compare
Whoops, I did a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting on stabilization in the compiler.
Even if it's a change used by one attribute, it should still be in the attribute grammar. Do you want to add it? If not, I'll do so in a separate PR. |
Sorry, I didn't see your comment about the grammar. I can look at adding it. |
0e02e80
to
c3ef805
Compare
Updated the grammar, hopefully I got it right! It looks like my stabilization PR is almost in. |
@bitshifter There's a merge conflict. 😢 |
c3ef805
to
e43e1ce
Compare
@Havvy the conflict was on a section on repr attributes that I removed as part of this review, had recently been updated by @yellow-apple. Thus I've removed the edit with the rest of the section, but perhaps @yellow-apple should check the |
💟 Thanks! |
Updated reference for stabilization of the
#[repr(align(x))]
attribute. See tracking issue comments rust-lang/rust#33626 (comment) for discussion.