{"record":{"id":"dab374f207bb26a5","repo":"vosen/ZLUDA","slug":"unexpected-key-expected-repr-or-space","errorCode":null,"errorMessage":"Unexpected key `{}`, expected `repr` or `space","messagePattern":"Unexpected key `(.+?)`, expected `repr` or `space","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ptx_parser_macros_impl/src/lib.rs","lineNumber":599,"sourceCode":"                Ok(if lookahead.peek(Token![type]) {\n                    content.parse::<Token![type]>()?;\n                    content.parse::<Token![:]>()?;\n                    ExprOrPath::Type(content.parse::<Expr>()?)\n                } else if lookahead.peek(Ident) {\n                    let name_ident = content.parse::<Ident>()?;\n                    content.parse::<Token![:]>()?;\n                    match &*name_ident.to_string() {\n                        \"relaxed_type_check\" => {\n                            ExprOrPath::RelaxedTypeCheck(content.parse::<LitBool>()?.value)\n                        }\n                        \"repr\" => ExprOrPath::Repr(content.parse::<Type>()?),\n                        \"space\" => ExprOrPath::Space(content.parse::<Expr>()?),\n                        \"dst\" => {\n                            let ident = content.parse::<LitBool>()?;\n                            ExprOrPath::Dst(ident.value)\n                        }\n                        name => {\n                            return Err(syn::Error::new(\n                                name_ident.span(),\n                                format!(\"Unexpected key `{}`, expected `repr` or `space\", name),\n                            ))\n                        }\n                    }\n                } else {\n                    return Err(lookahead.error());\n                })\n            })?;\n        let mut repr = None;\n        let mut type_ = None;\n        let mut space = None;\n        let mut is_dst = None;\n        let mut relaxed_type_check = false;\n        for exp_or_path in all_fields {\n            match exp_or_path {\n                ExprOrPath::Repr(r) => repr = Some(r),\n                ExprOrPath::Type(t) => type_ = Some(t),","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/vosen/ZLUDA/blob/9c8b43f242985150f86a7f485218b7b82c3e96ca/ptx_parser_macros_impl/src/lib.rs#L581-L617","documentation":"A proc-macro parse error from `parse_block`: inside an instruction/operand attribute body, a key was encountered that is not `repr` or `space` (the message string is itself truncated, missing its closing backtick). The macro expects each entry in that block to use one of these two keys and fails compilation at the offending key's span otherwise. Keys like `dst` are accepted in sibling branches but not in this one.","triggerScenarios":"Writing e.g. `#[instruction { reg: u32 }]`, `type: ...`, or any other key in the block position handled by `parse_block`'s `ExprOrPath` parsing, where only `repr: <expr>` or `space: <expr>` are recognized.","commonSituations":"Typos (`reprs:`, `spce:`), mixing up which block level a key belongs to (using `dst` or `type` where only `repr`/`space` are valid), or following outdated DSL examples from an earlier macro version.","solutions":["Replace the key with `repr` or `space` as appropriate for that block","Fix spelling and casing of the key","Move the attribute to the correct nesting level if the key (e.g. `dst`) is valid elsewhere in the DSL","Compare against working examples in the ptx_parser test suite or macro docs"],"exampleFix":"// before\nOperand { kind: reg }\n// after\nOperand { repr: reg }","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Compile-time guard: only these keys are valid in this block position:\nconst VALID_BLOCK_KEYS: &[&str] = &[\"repr\", \"space\"];","tryCatchPattern":null,"preventionTips":["Use `repr:` or `space:` in this block; other keys like `dst` belong elsewhere","Match key names against existing passing macro invocations","Check the macro source match arms when unsure of the accepted key set"],"tags":["proc-macro","rust","syntax-error","compile-time","dsl"],"backgroundTag":"invalid-enum-argument","analyzedSha":"9c8b43f242985150f86a7f485218b7b82c3e96ca","analyzedAt":"2026-09-06T09:21:08.049Z","contentChangedAt":"2026-09-06T09:21:08.049Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}