@@ -343,9 +343,6 @@ declare_features! (
343343 // Allows the `catch {...}` expression
344344 ( active, catch_expr, "1.17.0" , Some ( 31436 ) ) ,
345345
346- // Allows `repr(align(u16))` struct attribute (RFC 1358)
347- ( active, repr_align, "1.17.0" , Some ( 33626 ) ) ,
348-
349346 // Used to preserve symbols (see llvm.used)
350347 ( active, used, "1.18.0" , Some ( 40289 ) ) ,
351348
@@ -546,6 +543,8 @@ declare_features! (
546543 // Allows the sysV64 ABI to be specified on all platforms
547544 // instead of just the platforms on which it is the C ABI
548545 ( accepted, abi_sysv64, "1.24.0" , Some ( 36167 ) ) ,
546+ // Allows `repr(align(16))` struct attribute (RFC 1358)
547+ ( accepted, repr_align, "1.24.0" , Some ( 33626 ) ) ,
549548) ;
550549
551550// If you change this, please modify src/doc/unstable-book as well. You must
@@ -1456,15 +1455,25 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
14561455 }
14571456 }
14581457
1458+ // allow attr_literals in #[repr(align(x))]
1459+ let mut is_repr_align = false ;
1460+ if attr. path == "repr" {
1461+ if let Some ( content) = attr. meta_item_list ( ) {
1462+ is_repr_align = content. iter ( ) . any ( |c| c. check_name ( "align" ) ) ;
1463+ }
1464+ }
1465+
14591466 if self . context . features . proc_macro && attr:: is_known ( attr) {
14601467 return
14611468 }
14621469
1463- let meta = panictry ! ( attr. parse_meta( self . context. parse_sess) ) ;
1464- if contains_novel_literal ( & meta) {
1465- gate_feature_post ! ( & self , attr_literals, attr. span,
1466- "non-string literals in attributes, or string \
1467- literals in top-level positions, are experimental") ;
1470+ if !is_repr_align {
1471+ let meta = panictry ! ( attr. parse_meta( self . context. parse_sess) ) ;
1472+ if contains_novel_literal ( & meta) {
1473+ gate_feature_post ! ( & self , attr_literals, attr. span,
1474+ "non-string literals in attributes, or string \
1475+ literals in top-level positions, are experimental") ;
1476+ }
14681477 }
14691478 }
14701479
@@ -1522,11 +1531,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
15221531 gate_feature_post ! ( & self , repr_simd, attr. span,
15231532 "SIMD types are experimental and possibly buggy" ) ;
15241533 }
1525- if item. check_name ( "align" ) {
1526- gate_feature_post ! ( & self , repr_align, attr. span,
1527- "the struct `#[repr(align(u16))]` attribute \
1528- is experimental") ;
1529- }
15301534 if item. check_name ( "transparent" ) {
15311535 gate_feature_post ! ( & self , repr_transparent, attr. span,
15321536 "the `#[repr(transparent)]` attribute \
0 commit comments