diff --git a/crates/header-translator/src/stmt.rs b/crates/header-translator/src/stmt.rs index 2a4f05b25..7d3b00fed 100644 --- a/crates/header-translator/src/stmt.rs +++ b/crates/header-translator/src/stmt.rs @@ -1199,11 +1199,11 @@ impl fmt::Display for Stmt { writeln!(f, "{macro_name}!(")?; writeln!(f, " #[underlying({ty})]")?; write!(f, "{availability}")?; - write!(f, " pub enum ",)?; - if let Some(name) = &id.name { - write!(f, "{name} ")?; - } - writeln!(f, "{{")?; + writeln!( + f, + " pub enum {} {{", + id.name.as_deref().unwrap_or("__anonymous__") + )?; for (name, availability, expr) in variants { write!(f, "{availability}")?; writeln!(f, " {name} = {expr},")?; diff --git a/crates/icrate/src/generated b/crates/icrate/src/generated index d42ddf885..633c1479b 160000 --- a/crates/icrate/src/generated +++ b/crates/icrate/src/generated @@ -1 +1 @@ -Subproject commit d42ddf885916a9aabfb0f59567e6c2bad9a5478a +Subproject commit 633c1479bd9d530bf936f27dd628c23ee897a164 diff --git a/crates/icrate/src/macros.rs b/crates/icrate/src/macros.rs index 89e2865ff..5096000be 100644 --- a/crates/icrate/src/macros.rs +++ b/crates/icrate/src/macros.rs @@ -40,21 +40,17 @@ macro_rules! extern_enum { ( #[underlying($ty:ty)] $(#[$m:meta])* - $v:vis enum $name:ident { + $v:vis enum __anonymous__ { $( $(#[$field_m:meta])* $field:ident = $value:expr ),* $(,)? } ) => { - // TODO: Improve type-safety - $(#[$m])* - $v type $name = $ty; - extern_enum! { @__inner @($v) - @($name) + @($ty) @($( $(#[$field_m])* $field = $value, @@ -64,17 +60,21 @@ macro_rules! extern_enum { ( #[underlying($ty:ty)] $(#[$m:meta])* - $v:vis enum { + $v:vis enum $name:ident { $( $(#[$field_m:meta])* $field:ident = $value:expr ),* $(,)? } ) => { + // TODO: Improve type-safety + $(#[$m])* + $v type $name = $ty; + extern_enum! { @__inner @($v) - @($ty) + @($name) @($( $(#[$field_m])* $field = $value,