{"record":{"id":"ddfcebae0bdd8da1","repo":"yewstack/yew","slug":"unsupported-literal","errorCode":null,"errorMessage":"unsupported literal","messagePattern":"unsupported literal","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/yew-macro/src/html_tree/html_node.rs","lineNumber":30,"sourceCode":"pub enum HtmlNode {\n    Literal(Box<Lit>),\n    Expression(Box<Expr>),\n}\n\nimpl Parse for HtmlNode {\n    fn parse(input: ParseStream) -> Result<Self> {\n        let node = if HtmlNode::peek(input.cursor()).is_some() {\n            let lit = input.parse()?;\n            match lit {\n                Lit::ByteStr(lit) => {\n                    return Err(syn::Error::new(\n                        lit.span(),\n                        \"byte-strings can't be converted to HTML text\n                         note: remove the `b` prefix or convert this to a `String`\",\n                    ));\n                }\n                Lit::Verbatim(lit) => {\n                    return Err(syn::Error::new(lit.span(), \"unsupported literal\"));\n                }\n                _ => (),\n            }\n            HtmlNode::Literal(Box::new(lit))\n        } else {\n            HtmlNode::Expression(Box::new(input.parse()?))\n        };\n\n        Ok(node)\n    }\n}\n\nimpl PeekValue<()> for HtmlNode {\n    fn peek(cursor: Cursor) -> Option<()> {\n        cursor.literal().map(|_| ()).or_else(|| {\n            let (ident, _) = cursor.ident()?;\n            match ident.to_string().as_str() {\n                \"true\" | \"false\" => Some(()),","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/yewstack/yew/blob/0e4a05472fac4e5fce1befe60fa4a1e43a36b6a3/packages/yew-macro/src/html_tree/html_node.rs#L12-L48","documentation":"`HtmlNode::parse` classifies each child literal; a token that lexes as a literal but cannot be parsed into a known kind lands in `Lit::Verbatim` and is rejected as 'unsupported literal' (html_node.rs:28-32). Typical inputs are numeric literals with unrecognized suffixes (e.g. `1u0`) — tokens rustc would also reject, but the macro reports them first with a span pinned to the literal itself.","triggerScenarios":"A child like `html! { 1u0 }` — an integer or float literal whose suffix is not a valid primitive suffix (`u8`, `i32`, `f64`, …), so syn cannot classify it.","commonSituations":"Typos in literal suffixes (`1u6`, `2.0f64x`), macro-generated code gluing a suffix onto a number, or pasting experimental literal syntax from elsewhere into a template.","solutions":["Fix the suffix to a valid one (`u8`, `i32`, `f64`, …) or remove it entirely","If the child is meant to be displayed text, quote it: `{ \"1\" }`","If the tokens come from your own macro, emit the number and suffix as separate, valid tokens instead of one malformed literal"],"exampleFix":"// before\nhtml! { <p>{ 1u0 }</p> }\n\n// after\nhtml! { <p>{ 1u8 }</p> }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only valid primitive suffixes on numeric literals in templates (`u8`, `i32`, `f64`, …) or none at all","Quote values meant as display text: `{ \"1\" }` instead of a bare numeric token","When generating `html!` input from another macro, emit separate well-formed tokens rather than concatenated literal-suffix hybrids"],"tags":["rust","yew","html-macro","literal","verbatim","invalid-suffix"],"backgroundTag":"unsupported-literal-type","analyzedSha":"0e4a05472fac4e5fce1befe60fa4a1e43a36b6a3","analyzedAt":"2026-08-22T21:16:31.212Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}