diff --git a/crates/rune-macros/src/context.rs b/crates/rune-macros/src/context.rs index e9a7a7359..466b08fc2 100644 --- a/crates/rune-macros/src/context.rs +++ b/crates/rune-macros/src/context.rs @@ -479,28 +479,27 @@ impl Context { attr.from_value_params = Some(syn::punctuated::Punctuated::parse_terminated(&content)?); } else if meta.path == META_FIELDS { - if cfg!(not(feature = "dynamic_fields")) { - return Err(syn::Error::new_spanned( - &meta.path, - "Dynamic fields feature flag \"dynamic_fields\" is not enabled", - )); - } - meta.input.parse::()?; - let ty: syn::Ident = meta.input.parse()?; - let value = match ty.to_string().as_str() { - "never" => Some(format_ident!("Never")), - "first" => Some(format_ident!("First")), - "last" => Some(format_ident!("Last")), - "only" => Some(format_ident!("Only")), - _ => { - return Err(syn::Error::new_spanned( - &meta.path, - "Expected `never`, `only`, `first` or `last`", - )) - } - }; + #[cfg(not(feature = "dynamic_fields"))] + return Err(syn::Error::new_spanned( + &meta.path, + "Dynamic fields feature flag \"dynamic_fields\" is not enabled", + )); #[cfg(feature = "dynamic_fields")] { + meta.input.parse::()?; + let ty: syn::Ident = meta.input.parse()?; + let value = match ty.to_string().as_str() { + "never" => Some(format_ident!("Never")), + "first" => Some(format_ident!("First")), + "last" => Some(format_ident!("Last")), + "only" => Some(format_ident!("Only")), + _ => { + return Err(syn::Error::new_spanned( + &meta.path, + "Expected `never`, `only`, `first` or `last`", + )) + } + }; attr.meta_fields = value; } } else { diff --git a/crates/rune-macros/src/internals.rs b/crates/rune-macros/src/internals.rs index 71bdfdb72..d01435064 100644 --- a/crates/rune-macros/src/internals.rs +++ b/crates/rune-macros/src/internals.rs @@ -20,9 +20,6 @@ pub const NAME: Symbol = Symbol("name"); pub const ITEM: Symbol = Symbol("item"); pub const MODULE: Symbol = Symbol("module"); pub const INSTALL_WITH: Symbol = Symbol("install_with"); -#[cfg(feature = "dynamic_fields")] -pub const DYNAMIC_FIELDS: Symbol = Symbol("dynamic_fields"); - pub const CONSTRUCTOR: Symbol = Symbol("constructor"); pub const BUILTIN: Symbol = Symbol("builtin"); pub const STATIC_TYPE: Symbol = Symbol("static_type");