-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #61229 - Centril:stabilize-repr_align_enum, r=nagisa
Stabilize #![feature(repr_align_enum)] in Rust 1.37.0 On an `enum` item, you may now write: ```rust #[repr(align(X))] enum Foo { // ... } ``` This has equivalent effects to first defining: ```rust #[repr(align(X))] struct AlignX<T>(T); ``` and then using `AlignX<Foo>` in `Foo`'s stead. r? @nagisa
- Loading branch information
Showing
10 changed files
with
38 additions
and
96 deletions.
There are no files selected for viewing
42 changes: 0 additions & 42 deletions
42
src/doc/unstable-book/src/language-features/repr-align-enum.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// run-pass | ||
#![allow(dead_code)] | ||
#![feature(repr_align_enum)] | ||
|
||
use std::mem; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
#![feature(repr_align_enum)] | ||
#![allow(dead_code)] | ||
|
||
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer | ||
struct A(i32); | ||
struct S0(i32); | ||
|
||
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two | ||
struct B(i32); | ||
struct S1(i32); | ||
|
||
#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 | ||
struct C(i32); | ||
struct S2(i32); | ||
|
||
#[repr(align(536870912))] // ok: this is the largest accepted alignment | ||
struct D(i32); | ||
struct S3(i32); | ||
|
||
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer | ||
enum E0 { A, B } | ||
|
||
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two | ||
enum E { Left, Right } | ||
enum E1 { A, B } | ||
|
||
#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 | ||
enum E2 { A, B } | ||
|
||
#[repr(align(536870912))] // ok: this is the largest accepted alignment | ||
enum E3 { A, B } | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer | ||
--> $DIR/repr-align.rs:4:8 | ||
--> $DIR/repr-align.rs:3:8 | ||
| | ||
LL | #[repr(align(16.0))] | ||
| ^^^^^^^^^^^ | ||
|
||
error[E0589]: invalid `repr(align)` attribute: not a power of two | ||
--> $DIR/repr-align.rs:7:8 | ||
--> $DIR/repr-align.rs:6:8 | ||
| | ||
LL | #[repr(align(15))] | ||
| ^^^^^^^^^ | ||
|
||
error[E0589]: invalid `repr(align)` attribute: larger than 2^29 | ||
--> $DIR/repr-align.rs:10:8 | ||
--> $DIR/repr-align.rs:9:8 | ||
| | ||
LL | #[repr(align(4294967296))] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer | ||
--> $DIR/repr-align.rs:15:8 | ||
| | ||
LL | #[repr(align(16.0))] | ||
| ^^^^^^^^^^^ | ||
|
||
error[E0589]: invalid `repr(align)` attribute: not a power of two | ||
--> $DIR/repr-align.rs:16:8 | ||
--> $DIR/repr-align.rs:18:8 | ||
| | ||
LL | #[repr(align(15))] | ||
| ^^^^^^^^^ | ||
|
||
error: aborting due to 4 previous errors | ||
error[E0589]: invalid `repr(align)` attribute: larger than 2^29 | ||
--> $DIR/repr-align.rs:21:8 | ||
| | ||
LL | #[repr(align(4294967296))] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0589`. |