{"record":{"id":"84f153661c64ae3b","repo":"yewstack/yew","slug":"missing-expression-for-match","errorCode":null,"errorMessage":"missing expression for `match`","messagePattern":"missing expression for `match`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/yew-macro/src/html_tree/html_match.rs","lineNumber":55,"sourceCode":"        deprecations: TokenStream,\n    },\n}\n\nimpl PeekValue<()> for HtmlMatch {\n    fn peek(cursor: Cursor) -> Option<()> {\n        let (ident, _) = cursor.ident()?;\n        (ident == \"match\").then_some(())\n    }\n}\n\nimpl Parse for HtmlMatch {\n    fn parse(input: ParseStream) -> syn::Result<Self> {\n        let match_token = input.parse::<Token![match]>()?;\n        let expr = Box::new(input.call(Expr::parse_without_eager_brace)?);\n\n        if let Expr::Block(syn::ExprBlock { block, .. }) = &*expr {\n            if block.stmts.is_empty() {\n                return Err(syn::Error::new(\n                    expr.span(),\n                    \"missing expression for `match`\",\n                ));\n            }\n        }\n\n        if input.is_empty() {\n            return Err(syn::Error::new(\n                expr.span(),\n                \"this `match` expression has a scrutinee, but no body\",\n            ));\n        }\n\n        let content;\n        let brace = braced!(content in input);\n\n        let mut arms = Vec::new();\n        while !content.is_empty() {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/yewstack/yew/blob/0e4a05472fac4e5fce1befe60fa4a1e43a36b6a3/packages/yew-macro/src/html_tree/html_match.rs#L37-L73","documentation":"`HtmlMatch::parse` parses the scrutinee with `Expr::parse_without_eager_brace` (html_match.rs:53); if the result is an empty block `{}`, no expression was actually provided and this error is raised on the scrutinee's span (html_match.rs:56-61). It mirrors the equivalent guards for `if` and `while` inside `html!`.","triggerScenarios":"`html! { match {} { _ => <p/> } }` — an empty block where the matched expression should be, followed by the arm braces.","commonSituations":"A placeholder scrutinee left by a snippet, moving the real expression out during refactoring and leaving `{}` behind, or misunderstanding match syntax inside the macro.","solutions":["Put the real expression before the brace body: `match msg { … }`","Bind complex scrutinees to a variable before `html!` and match on that identifier","If there is genuinely nothing to match on, use `if`/`else` instead"],"exampleFix":"// before\nhtml! { match {} { _ => <p/> } }\n\n// after\nhtml! { match msg { Msg::Ping => <p/>, _ => <span/> } }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Type the scrutinee before the braces in the same edit as the arms","Bind large scrutinees to a variable in plain Rust and match on the identifier","Fill snippet placeholders (like `{}`) before running `cargo check`"],"tags":["rust","yew","html-macro","match-expression","syntax"],"backgroundTag":"incomplete-match-expression","analyzedSha":"0e4a05472fac4e5fce1befe60fa4a1e43a36b6a3","analyzedAt":"2026-08-22T21:16:31.212Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}