commit da37b3a1b3b6b126c6f841c1cfac42982805dde3
parent f86d3e5a2b91ce1b6e42b950440e4c2d6a1cb961
Author: Jan Varga <jan.varga@gmail.com>
Date: Thu, 16 Oct 2025 10:36:04 +0000
Bug 1991631 - Rename variant_attrs to css_variant_attrs in ToTyped derive; r=firefox-style-system-reviewers,dshin
This patch renames variant_attrs to css_variant_attrs in the ToTyped derive
implementation. The change prepares for the introduction of a new attribute set
used specifically by the derive, which will use unprefixed variable names.
Differential Revision: https://phabricator.services.mozilla.com/D268161
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/servo/components/style_derive/lib.rs b/servo/components/style_derive/lib.rs
@@ -82,7 +82,7 @@ pub fn derive_specified_value_info(stream: TokenStream) -> TokenStream {
specified_value_info::derive(input).into()
}
-#[proc_macro_derive(ToTyped)]
+#[proc_macro_derive(ToTyped, attributes(css))]
pub fn derive_to_typed(stream: TokenStream) -> TokenStream {
let input = syn::parse(stream).unwrap();
to_typed::derive(input).into()
diff --git a/servo/components/style_derive/to_typed.rs b/servo/components/style_derive/to_typed.rs
@@ -104,16 +104,16 @@ fn derive_variant_arm(variant: &synstructure::VariantInfo) -> TokenStream {
let identifier = &ast.ident;
// Parse any #[css(...)] attributes attached to this variant.
- let variant_attrs = cg::parse_variant_attrs_from_ast::<CssVariantAttrs>(&ast);
+ let css_variant_attrs = cg::parse_variant_attrs_from_ast::<CssVariantAttrs>(&ast);
// If the variant is explicitly marked #[css(skip)], don’t generate
// anything for it, always return None.
- if variant_attrs.skip {
+ if css_variant_attrs.skip {
return quote!(None);
}
assert!(
- variant_attrs.keyword.is_none(),
+ css_variant_attrs.keyword.is_none(),
"Unhandled keyword attribute"
);