Skip to content

Commit de1e1ad

Browse files
committed
Stabilize repr_align_enum in 1.37.0.
1 parent ed2a511 commit de1e1ad

File tree

10 files changed

+11
-90
lines changed

10 files changed

+11
-90
lines changed

src/doc/unstable-book/src/language-features/repr-align-enum.md

-42
This file was deleted.

src/libsyntax/feature_gate.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,6 @@ declare_features! (
548548
// Allows using `#[optimize(X)]`.
549549
(active, optimize_attribute, "1.34.0", Some(54882), None),
550550

551-
// Allows using `#[repr(align(X))]` on enums.
552-
(active, repr_align_enum, "1.34.0", Some(57996), None),
553-
554551
// Allows using C-variadics.
555552
(active, c_variadic, "1.34.0", Some(44930), None),
556553

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

837837
// -------------------------------------------------------------------------
838838
// feature-group-end: accepted features
@@ -1995,17 +1995,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
19951995
}
19961996
}
19971997

1998-
ast::ItemKind::Enum(..) => {
1999-
for attr in attr::filter_by_name(&i.attrs[..], sym::repr) {
2000-
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
2001-
if item.check_name(sym::align) {
2002-
gate_feature_post!(&self, repr_align_enum, attr.span,
2003-
"`#[repr(align(x))]` on enums is experimental");
2004-
}
2005-
}
2006-
}
2007-
}
2008-
20091998
ast::ItemKind::Impl(_, polarity, defaultness, _, _, _, _) => {
20101999
if polarity == ast::ImplPolarity::Negative {
20112000
gate_feature_post!(&self, optin_builtin_traits,

src/test/codegen/align-enum.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// min-llvm-version 7.0
44

55
#![crate_type = "lib"]
6-
#![feature(repr_align_enum)]
76

87
#[repr(align(64))]
98
pub enum Align64 {

src/test/run-pass/structs-enums/align-enum.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
#![allow(dead_code)]
3-
#![feature(repr_align_enum)]
43

54
use std::mem;
65

src/test/ui/attr-usage-repr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(repr_simd)]
2-
#![feature(repr_align_enum)]
32

43
#[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
54
fn f() {}

src/test/ui/attr-usage-repr.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error[E0517]: attribute should be applied to struct, enum or union
2-
--> $DIR/attr-usage-repr.rs:4:8
2+
--> $DIR/attr-usage-repr.rs:3:8
33
|
44
LL | #[repr(C)]
55
| ^
66
LL | fn f() {}
77
| --------- not a struct, enum or union
88

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

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

2525
error[E0517]: attribute should be applied to struct
26-
--> $DIR/attr-usage-repr.rs:28:8
26+
--> $DIR/attr-usage-repr.rs:27:8
2727
|
2828
LL | #[repr(simd)]
2929
| ^^^^

src/test/ui/feature-gates/feature-gate-repr_align_enum.rs

-10
This file was deleted.

src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr

-12
This file was deleted.

src/test/ui/repr/repr-align.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(repr_align_enum)]
21
#![allow(dead_code)]
32

43
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer

src/test/ui/repr/repr-align.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
2-
--> $DIR/repr-align.rs:4:8
2+
--> $DIR/repr-align.rs:3:8
33
|
44
LL | #[repr(align(16.0))]
55
| ^^^^^^^^^^^
66

77
error[E0589]: invalid `repr(align)` attribute: not a power of two
8-
--> $DIR/repr-align.rs:7:8
8+
--> $DIR/repr-align.rs:6:8
99
|
1010
LL | #[repr(align(15))]
1111
| ^^^^^^^^^
1212

1313
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
14-
--> $DIR/repr-align.rs:10:8
14+
--> $DIR/repr-align.rs:9:8
1515
|
1616
LL | #[repr(align(4294967296))]
1717
| ^^^^^^^^^^^^^^^^^
1818

1919
error[E0589]: invalid `repr(align)` attribute: not a power of two
20-
--> $DIR/repr-align.rs:16:8
20+
--> $DIR/repr-align.rs:15:8
2121
|
2222
LL | #[repr(align(15))]
2323
| ^^^^^^^^^

0 commit comments

Comments
 (0)