DioxusLabs/dioxus · error · syn::Error

css_module can only be applied to unit structs

Error message

css_module can only be applied to unit structs

What it means

Error "css_module can only be applied to unit structs" thrown in DioxusLabs/dioxus.

Source

Thrown at packages/manganis/manganis-macro/src/css_module.rs:47

        }

        let asset_parser = AssetParser {
            path_expr,
            asset,
            options,
        };

        Ok(Self { asset_parser })
    }
}

pub(crate) fn expand_css_module_struct(
    tokens: &mut proc_macro2::TokenStream,
    attribute: &CssModuleAttribute,
    item_struct: &ItemStruct,
) {
    if !item_struct.fields.is_empty() {
        let err = syn::Error::new(
            item_struct.fields.span(),
            "css_module can only be applied to unit structs",
        )
        .into_compile_error();
        tokens.append_all(err);
        return;
    }
    if !item_struct.generics.params.is_empty() {
        let err = syn::Error::new(
            item_struct.generics.span(),
            "css_module cannot be applied to generic structs",
        )
        .into_compile_error();
        tokens.append_all(err);
        return;
    }
    let struct_vis = &item_struct.vis;
    let struct_name = &item_struct.ident;

View on GitHub (pinned to 393d190a80)

When it happens

Trigger: Thrown at packages/manganis/manganis-macro/src/css_module.rs:47 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@393d190a80 (2026-08-16). Data as JSON: /api/errors/3dc7047c0d7ebcca. Report an issue: GitHub.