From c6f6101180f8f18008b819b4e438824048b90925 Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Wed, 30 Jan 2019 14:14:16 +0100 Subject: Allow #[repr(align(x))] on enums (#57996) --- src/libsyntax/feature_gate.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 28209248246..218a3f52ee0 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -461,6 +461,9 @@ declare_features! ( // #[optimize(X)] (active, optimize_attribute, "1.34.0", Some(54882), None), + + // #[repr(align(X))] on enums + (active, repr_align_enum, "1.34.0", Some(57996), None), ); declare_features! ( @@ -1697,6 +1700,17 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } + ast::ItemKind::Enum(..) => { + for attr in attr::filter_by_name(&i.attrs[..], "repr") { + for item in attr.meta_item_list().unwrap_or_else(Vec::new) { + if item.check_name("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, -- cgit 1.4.1-3-g733a5