{"record":{"id":"d047f7f7be96445d","repo":"GraphiteEditor/Graphite","slug":"unsupported-type-format","errorCode":null,"errorMessage":"Unsupported type format","messagePattern":"Unsupported type format","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"proc-macros/src/message_handler_data_attr.rs","lineNumber":92,"sourceCode":"\n\t\t\t\t\t\t\t\tlet type_line_number = type_ident.span().start().line;\n\n\t\t\t\t\t\t\t\tlet tr = clean_rust_type_syntax(type_reference.to_token_stream().to_string());\n\t\t\t\t\t\t\t\tquote! {\n\t\t\t\t\t\t\t\t\t#input_item\n\t\t\t\t\t\t\t\t\timpl #message_type {\n\t\t\t\t\t\t\t\t\t\tpub fn message_handler_data_str() -> MessageData {\n\t\t\t\t\t\t\t\t\t\t\tMessageData::new(format!(\"{}\", #tr), #type_ident::field_types(), #type_ident::path(), #type_ident::line_number())\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tpub fn message_handler_str() -> MessageData {\n\t\t\t\t\t\t\t\t\t\t\tMessageData::new(format!(\"{}\", stringify!(#input_type)), #input_type::field_types(), #input_type::path(), #input_type::line_number())\n\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t_ => return Err(syn::Error::new(t.span(), \"Unsupported type format\")),\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t_ => quote! {\n\t\t\t\t\t\t#input_item\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn Ok(impl_item);\n\t\t\t}\n\t\t}\n\t}\n\tOk(input_item)\n}\n","sourceCodeStart":74,"sourceCodeEnd":106,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/proc-macros/src/message_handler_data_attr.rs#L74-L106","documentation":"The context type `C` in `MessageHandler<M, C>` under `#[message_handler_data]` must be one of: a type path, a tuple, or a reference. Any other type shape — arrays (`[u8; 4]`), slices (`[u8]`), pointers (`*const T`), `dyn Trait` trait objects, `impl Trait`, function pointers, or `never` — falls through the match and is rejected.","triggerScenarios":"Writing `impl MessageHandler<Msg, [u8; 4]> for …`, `impl MessageHandler<Msg, *mut Ctx>`, `impl MessageHandler<Msg, dyn Ctx>` or `impl MessageHandler<Msg, Box<dyn Ctx>>` — Box is a path, but `dyn Ctx` / array / slice / raw-pointer context types hit the catch-all arm.","commonSituations":"Performance-motivated switches to arrays or raw pointers for context data, or threading `dyn Trait` context objects through the handler in an attempt to abstract over tools.","solutions":["Wrap the unsupported type in a named struct or use the conventional `ToolMessageData` path type as C.","For fixed-size data, prefer a tuple `(u8, u8, u8, u8)` (supported) or a named struct instead of an array.","For dyn contexts, introduce a concrete newtype that implements the abstraction and pass its path."],"exampleFix":"// before\n#[message_handler_data]\nimpl MessageHandler<ToolMessage, [u8; 4]> for MyTool { ... }\n\n// after\n#[derive(ExtractField)]\nstruct ColorContext {\n\tr: u8, g: u8, b: u8, a: u8,\n}\n#[message_handler_data]\nimpl MessageHandler<ToolMessage, ColorContext> for MyTool { ... }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict context type C to path, tuple, or reference shapes; wrap arrays, slices, pointers, and dyn types in a named struct.","Prefer the conventional ToolMessageData struct as context."],"tags":["rust","proc-macro","message-handler","unsupported-type"],"backgroundTag":"proc-macro-input-validation","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}