Skip to content
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

Stabilize #![feature(repr_align_enum)] in Rust 1.37.0 #61229

Merged
merged 2 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions src/doc/unstable-book/src/language-features/repr-align-enum.md

This file was deleted.

17 changes: 3 additions & 14 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,6 @@ declare_features! (
// Allows using `#[optimize(X)]`.
(active, optimize_attribute, "1.34.0", Some(54882), None),

// Allows using `#[repr(align(X))]` on enums.
(active, repr_align_enum, "1.34.0", Some(57996), None),

// Allows using C-variadics.
(active, c_variadic, "1.34.0", Some(44930), None),

Expand Down Expand Up @@ -833,6 +830,9 @@ declare_features! (
(accepted, extern_crate_self, "1.34.0", Some(56409), None),
// Allows arbitrary delimited token streams in non-macro attributes.
(accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None),
// Allows using `#[repr(align(X))]` on enums with equivalent semantics
// to wrapping an enum in a wrapper struct with `#[repr(align(X))]`.
(accepted, repr_align_enum, "1.37.0", Some(57996), None),

// -------------------------------------------------------------------------
// feature-group-end: accepted features
Expand Down Expand Up @@ -1995,17 +1995,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
}

ast::ItemKind::Enum(..) => {
for attr in attr::filter_by_name(&i.attrs[..], sym::repr) {
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
if item.check_name(sym::align) {
gate_feature_post!(&self, repr_align_enum, attr.span,
"`#[repr(align(x))]` on enums is experimental");
}
}
}
}

ast::ItemKind::Impl(_, polarity, defaultness, _, _, _, _) => {
if polarity == ast::ImplPolarity::Negative {
gate_feature_post!(&self, optin_builtin_traits,
Expand Down
1 change: 0 additions & 1 deletion src/test/codegen/align-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// min-llvm-version 7.0

#![crate_type = "lib"]
#![feature(repr_align_enum)]

#[repr(align(64))]
pub enum Align64 {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/structs-enums/align-enum.rs
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;

Expand Down
1 change: 0 additions & 1 deletion src/test/ui/attr-usage-repr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(repr_simd)]
#![feature(repr_align_enum)]

#[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
fn f() {}
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/attr-usage-repr.stderr
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
error[E0517]: attribute should be applied to struct, enum or union
--> $DIR/attr-usage-repr.rs:4:8
--> $DIR/attr-usage-repr.rs:3:8
|
LL | #[repr(C)]
| ^
LL | fn f() {}
| --------- not a struct, enum or union

error[E0517]: attribute should be applied to enum
--> $DIR/attr-usage-repr.rs:16:8
--> $DIR/attr-usage-repr.rs:15:8
|
LL | #[repr(i8)]
| ^^
LL | struct SInt(f64, f64);
| ---------------------- not an enum

error[E0517]: attribute should be applied to struct or union
--> $DIR/attr-usage-repr.rs:25:8
--> $DIR/attr-usage-repr.rs:24:8
|
LL | #[repr(packed)]
| ^^^^^^
LL | enum EPacked { A, B }
| --------------------- not a struct or union

error[E0517]: attribute should be applied to struct
--> $DIR/attr-usage-repr.rs:28:8
--> $DIR/attr-usage-repr.rs:27:8
|
LL | #[repr(simd)]
| ^^^^
Expand Down
10 changes: 0 additions & 10 deletions src/test/ui/feature-gates/feature-gate-repr_align_enum.rs

This file was deleted.

12 changes: 0 additions & 12 deletions src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr

This file was deleted.

20 changes: 14 additions & 6 deletions src/test/ui/repr/repr-align.rs
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() {}
22 changes: 17 additions & 5 deletions src/test/ui/repr/repr-align.stderr
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`.