{"record":{"id":"839d535e5ee68039","repo":"vosen/ZLUDA","slug":"unexpected-key-expected-type-data-arg","errorCode":null,"errorMessage":"Unexpected key `{}`. Expected `type`, `data`, `arguments`, `visit, `visit_mut` or `map`.","messagePattern":"Unexpected key `(.+?)`\\. Expected `type`, `data`, `arguments`, `visit, `visit_mut` or `map`\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ptx_parser_macros_impl/src/lib.rs","lineNumber":481,"sourceCode":"                }\n                \"visit\" => {\n                    input.parse::<Token![:]>()?;\n                    VariantProperty::Visit(input.parse::<Expr>()?)\n                }\n                \"visit_mut\" => {\n                    input.parse::<Token![:]>()?;\n                    VariantProperty::VisitMut(input.parse::<Expr>()?)\n                }\n                \"display\" => {\n                    input.parse::<Token![:]>()?;\n                    VariantProperty::Display(input.parse::<Expr>()?)\n                }\n                \"map\" => {\n                    input.parse::<Token![:]>()?;\n                    VariantProperty::Map(input.parse::<Expr>()?)\n                }\n                x => {\n                    return Err(syn::Error::new(\n                        key.span(),\n                        format!(\n                            \"Unexpected key `{}`. Expected `type`, `data`, `arguments`, `visit, `visit_mut` or `map`.\",\n                            x\n                        ),\n                    ))\n                }\n            }\n        } else {\n            return Err(lookahead.error());\n        })\n    }\n}\n\npub enum Arguments {\n    Decl(Type),\n    Def(InstructionArguments),\n}","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/vosen/ZLUDA/blob/9c8b43f242985150f86a7f485218b7b82c3e96ca/ptx_parser_macros_impl/src/lib.rs#L463-L499","documentation":"This is a compile-time error from the `parse` function of a proc-macro DSL (`ptx_parser_macros`). When parsing a variant's attribute body, an unknown identifier key was found where only `type`, `data`, `arguments`, `visit`, `visit_mut`, or `map` are accepted. The `syn::Error` points at the offending key's span so rustc underlines it in the source. Note the message itself has a typo (missing closing backtick after `visit`).","triggerScenarios":"Writing an attribute like `#[variant(display_name: \"...\")]`, `kind: ...`, or a misspelled key (`types:`, `argumnts:`, `Visits:`) inside a variant body handled by `VariantProperty::parse`. Case-sensitivity matters, so `Map:` or `MAP` also fail.","commonSituations":"Typos in macro attribute keys, copying DSL syntax from an older/newer version of the macro where the key set differed, or inventing keys assuming the DSL accepts arbitrary properties.","solutions":["Rename the key to one of the supported ones: `type`, `data`, `arguments`, `visit`, `visit_mut`, `map`","Fix casing — keys are matched exactly (`visit_mut`, not `VisitMut` or `Visit`)","Check the macro's documentation or the match arms in ptx_parser_macros_impl/src/lib.rs:434-489 for the current key set; if a needed key is missing, upstream the change","If you intended a key like `display`, note it is accepted elsewhere but not in this position — verify you are on the right attribute"],"exampleFix":"// before\nMyVariant { foo: expr() } => ...\n// after\nMyVariant { map: expr() } => ...","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Compile-time guard: the proc macro rejects unknown keys at compile time,\n// so the only defense is sticking to the accepted key set:\n// type | data | arguments | visit | visit_mut | map\nconst VALID_KEYS: &[&str] = &[\"type\", \"data\", \"arguments\", \"visit\", \"visit_mut\", \"map\"];","tryCatchPattern":null,"preventionTips":["Copy key names from a working example in the codebase instead of from memory","Remember keys are case-sensitive and use snake_case","Read the error span rustc prints — it underlines the exact offending key","If the macro recently changed, check the macro changelog for added/removed keys"],"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-14T05:17:10.506Z"}