@@ -343,9 +343,6 @@ declare_features! (
343
343
// Allows the `catch {...}` expression
344
344
( active, catch_expr, "1.17.0" , Some ( 31436 ) ) ,
345
345
346
- // Allows `repr(align(u16))` struct attribute (RFC 1358)
347
- ( active, repr_align, "1.17.0" , Some ( 33626 ) ) ,
348
-
349
346
// Used to preserve symbols (see llvm.used)
350
347
( active, used, "1.18.0" , Some ( 40289 ) ) ,
351
348
@@ -546,6 +543,8 @@ declare_features! (
546
543
// Allows the sysV64 ABI to be specified on all platforms
547
544
// instead of just the platforms on which it is the C ABI
548
545
( 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 ) ) ,
549
548
) ;
550
549
551
550
// 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> {
1456
1455
}
1457
1456
}
1458
1457
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
+
1459
1466
if self . context . features . proc_macro && attr:: is_known ( attr) {
1460
1467
return
1461
1468
}
1462
1469
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
+ }
1468
1477
}
1469
1478
}
1470
1479
@@ -1522,11 +1531,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
1522
1531
gate_feature_post ! ( & self , repr_simd, attr. span,
1523
1532
"SIMD types are experimental and possibly buggy" ) ;
1524
1533
}
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
- }
1530
1534
if item. check_name ( "transparent" ) {
1531
1535
gate_feature_post ! ( & self , repr_transparent, attr. span,
1532
1536
"the `#[repr(transparent)]` attribute \
0 commit comments