// Ensure that `path` attributes on modules are recorded as used (c.f. #35584).
attr::first_attr_value_str_by_name(&item.attrs, "path");
}
+ ItemKind::Union(ref vdata, _) => {
+ if !vdata.is_struct() {
+ self.err_handler().span_err(item.span,
+ "tuple and unit unions are not permitted");
+ }
+ if vdata.fields().len() == 0 {
+ self.err_handler().span_err(item.span,
+ "unions cannot have zero fields");
+ }
+ }
_ => {}
}
/// A union definition (`union` or `pub union`).
///
/// E.g. `union Foo<A, B> { x: A, y: B }`
- Union(VariantData, Generics), // FIXME: not yet implemented
+ Union(VariantData, Generics),
/// A Trait declaration (`trait` or `pub trait`).
///
/// E.g. `trait Foo { .. }` or `trait Foo<T> { .. }`
})
}
+#[macro_export]
+macro_rules! unimplemented_unions {
+ () => ({
+ panic!("unions are not fully implemented");
+ })
+}
+
#[macro_export]
macro_rules! register_diagnostics {
($($code:tt),*) => (