Skip to content

Allow #[repr(align(x))] on enums (#57996) - #57998

Merged
bors merged 4 commits into
rust-lang:masterfrom
niklasf:align-enum
Feb 7, 2019
Merged

Allow #[repr(align(x))] on enums (#57996)#57998
bors merged 4 commits into
rust-lang:masterfrom
niklasf:align-enum

Conversation

@niklasf

@niklasfniklasf commented Jan 30, 2019

Copy link
Copy Markdown
Contributor

Tracking issue: #57996

Implements an extension of RFC 1358 behind a feature flag (repr_align_enum). Originally introduced here for structs: #39999.

It seems like only HIR-level changes are required, since enums are already aware of their alignment (due to alignment of their limbs).

cc @bitshifter

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 30, 2019
@Centril

Copy link
Copy Markdown
Contributor

r? @nagisa cc @eddyb@alexcrichton

Comment threadsrc/test/run-pass/structs-enums/align-enum.rs
@CentrilCentril added I-nominated T-lang Relevant to the language team labels Jan 31, 2019
@aturon

Copy link
Copy Markdown
Contributor

We discussed this PR briefly in the Lang Team meeting today. Folks generally feel comfortable with this addition (especially since it's unstable). The one question was: is this equivalent to wrapping in a struct with an alignment? Modulo clarifying that part of the spec, we are 👍

@niklasf

Copy link
Copy Markdown
ContributorAuthor

Awesome.

is this equivalent to wrapping in a struct with an alignment?

Yes, that is the intent. I added this to the docs.

@CentrilCentril removed the T-lang Relevant to the language team label Jan 31, 2019
@nagisa

Copy link
Copy Markdown
Member

This needs a codegen test IMO. Otherwise looks good.

@niklasf

Copy link
Copy Markdown
ContributorAuthor

Makes sense. Added a very basic codegen test (a6fd6ec).

@nagisa

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Feb 5, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit a6fd6ec has been approved by nagisa

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 5, 2019
@bors

bors commented Feb 6, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit a6fd6ec with merge ff672da096df7ab05d7e7374eeadb299e6a6347e...

@bors

bors commented Feb 6, 2019

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-appveyor

@borsbors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 6, 2019
@kennytm

Copy link
Copy Markdown
Member

@bors retry #58025

@borsbors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 6, 2019
@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 6, 2019
@bors

bors commented Feb 6, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit a6fd6ec with merge 631a162...

bors added a commit that referenced this pull request Feb 6, 2019
Allow #[repr(align(x))] on enums (#57996)
Tracking issue: #57996
Implements an extension of [RFC 1358](https://github.com/rust-lang/rfcs/blob/master/text/1358-repr-align.md) behind a feature flag (`repr_align_enum`). Originally introduced here for structs: #39999.
It seems like only HIR-level changes are required, since enums are already aware of their alignment (due to alignment of their limbs).
cc @bitshifter
@bors

bors commented Feb 6, 2019

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-appveyor

@borsbors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 6, 2019
@kennytm

Copy link
Copy Markdown
Member

@bors retry #58160

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 6, 2019
@bors

bors commented Feb 7, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit a6fd6ec with merge 825f355...

bors added a commit that referenced this pull request Feb 7, 2019
Allow #[repr(align(x))] on enums (#57996)
Tracking issue: #57996
Implements an extension of [RFC 1358](https://github.com/rust-lang/rfcs/blob/master/text/1358-repr-align.md) behind a feature flag (`repr_align_enum`). Originally introduced here for structs: #39999.
It seems like only HIR-level changes are required, since enums are already aware of their alignment (due to alignment of their limbs).
cc @bitshifter
@bors

bors commented Feb 7, 2019

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-travis, status-appveyor
Approved by: nagisa
Pushing 825f355 to master...

@bors
bors merged commit a6fd6ec into rust-lang:masterFeb 7, 2019
@borsbors mentioned this pull request Feb 7, 2019
@emilyalbiniemilyalbini added the merged-by-bors This PR was explicitly merged by bors. label Feb 7, 2019
@niklasf
niklasf deleted the align-enum branch June 21, 2026 20:55
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@niklasf@rust-highfive@Centril@aturon@nagisa@bors@kennytm@steveklabnik@emilyalbini