Stabilized #[repr(align(x))] attribute (RFC 1358)
This commit is contained in:
parent
fdc18b3067
commit
651ea8ea44
14 changed files with 20 additions and 65 deletions
|
|
@ -343,9 +343,6 @@ declare_features! (
|
|||
// Allows the `catch {...}` expression
|
||||
(active, catch_expr, "1.17.0", Some(31436)),
|
||||
|
||||
// Allows `repr(align(u16))` struct attribute (RFC 1358)
|
||||
(active, repr_align, "1.17.0", Some(33626)),
|
||||
|
||||
// Used to preserve symbols (see llvm.used)
|
||||
(active, used, "1.18.0", Some(40289)),
|
||||
|
||||
|
|
@ -546,6 +543,8 @@ declare_features! (
|
|||
// Allows the sysV64 ABI to be specified on all platforms
|
||||
// instead of just the platforms on which it is the C ABI
|
||||
(accepted, abi_sysv64, "1.24.0", Some(36167)),
|
||||
// Allows `repr(align(16))` struct attribute (RFC 1358)
|
||||
(accepted, repr_align, "1.24.0", Some(33626)),
|
||||
);
|
||||
|
||||
// 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> {
|
|||
}
|
||||
}
|
||||
|
||||
// allow attr_literals in #[repr(align(x))]
|
||||
let mut is_repr_align = false;
|
||||
if attr.path == "repr" {
|
||||
if let Some(content) = attr.meta_item_list() {
|
||||
is_repr_align = content.iter().any(|c| c.check_name("align"));
|
||||
}
|
||||
}
|
||||
|
||||
if self.context.features.proc_macro && attr::is_known(attr) {
|
||||
return
|
||||
}
|
||||
|
||||
let meta = panictry!(attr.parse_meta(self.context.parse_sess));
|
||||
if contains_novel_literal(&meta) {
|
||||
gate_feature_post!(&self, attr_literals, attr.span,
|
||||
"non-string literals in attributes, or string \
|
||||
literals in top-level positions, are experimental");
|
||||
if !is_repr_align {
|
||||
let meta = panictry!(attr.parse_meta(self.context.parse_sess));
|
||||
if contains_novel_literal(&meta) {
|
||||
gate_feature_post!(&self, attr_literals, attr.span,
|
||||
"non-string literals in attributes, or string \
|
||||
literals in top-level positions, are experimental");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1522,11 +1531,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||
gate_feature_post!(&self, repr_simd, attr.span,
|
||||
"SIMD types are experimental and possibly buggy");
|
||||
}
|
||||
if item.check_name("align") {
|
||||
gate_feature_post!(&self, repr_align, attr.span,
|
||||
"the struct `#[repr(align(u16))]` attribute \
|
||||
is experimental");
|
||||
}
|
||||
if item.check_name("transparent") {
|
||||
gate_feature_post!(&self, repr_transparent, attr.span,
|
||||
"the `#[repr(transparent)]` attribute \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue