DioxusLabs/dioxus · error · syn::Error

Only string, int, float, and bool literals are supported

Error message

Only string, int, float, and bool literals are supported

What it means

A literal used where the RSX hot-reload literal parser expects a hot-reloadable value is of an unsupported kind (e.g. a byte string or char literal). Only strings, integers, floats, and bools can be hot-reloaded.

Solutions

  1. Use only string, integer, float, or boolean literals in this RSX position; other literal kinds (chars, byte strings, etc.) are not supported.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/rsx/src/literal.rs:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/32bcfaa7afead28c. Report an issue: GitHub.

Appendix: source

Thrown at packages/rsx/src/literal.rs:57

    Int(LitInt),

    /// A bool literal
    ///
    /// true
    Bool(LitBool),
}

impl Parse for HotLiteral {
    fn parse(input: ParseStream) -> syn::Result<Self> {
        let raw = input.parse::<Lit>()?;

        let value = match raw.clone() {
            Lit::Int(a) => HotLiteral::Int(a),
            Lit::Bool(a) => HotLiteral::Bool(a),
            Lit::Float(a) => HotLiteral::Float(a),
            Lit::Str(a) => HotLiteral::Fmted(IfmtInput::new_litstr(a)?.into()),
            _ => {
                return Err(syn::Error::new(
                    raw.span(),
                    "Only string, int, float, and bool literals are supported",
                ));
            }
        };

        Ok(value)
    }
}

impl ToTokens for HotLiteral {
    fn to_tokens(&self, out: &mut proc_macro2::TokenStream) {
        match &self {
            HotLiteral::Fmted(f) => {
                f.formatted_input.to_tokens(out);
            }
            HotLiteral::Float(f) => f.to_tokens(out),
            HotLiteral::Int(f) => f.to_tokens(out),

View on GitHub (pinned to 24f6a829df)