{"record":{"id":"4831b162aefc959b","repo":"GraphiteEditor/Graphite","slug":"failed-to-parse-input-type-for-implementation","errorCode":null,"errorMessage":"Failed to parse input type for #[implementation(...)]. Expected a valid Rust type.\nError: {}","messagePattern":"Failed to parse input type for #\\[implementation\\(\\.\\.\\.\\)\\]\\. Expected a valid Rust type\\.\nError: (.+?)","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"node-graph/node-macro/src/parsing.rs","lineNumber":355,"sourceCode":"\tpub input_type: Type,\n\tpub output_type: Type,\n\t/// The peeled `Item` element of `output_type`, if the lazy input's `Output` is declared `Item<T>`.\n\tpub output_element: Option<Type>,\n\tpub implementations: Punctuated<Implementation, Comma>,\n}\n\n#[derive(Clone, Debug)]\npub(crate) struct Input {\n\tpub(crate) pat_ident: PatIdent,\n\tpub(crate) ty: Type,\n\tpub(crate) implementations: Punctuated<Type, Comma>,\n\tpub(crate) context_features: Vec<Ident>,\n}\n\nimpl Parse for Implementation {\n\tfn parse(input: ParseStream) -> syn::Result<Self> {\n\t\tlet input_type: Type = input.parse().map_err(|e| {\n\t\t\tError::new(\n\t\t\t\tinput.span(),\n\t\t\t\tformatdoc!(\n\t\t\t\t\t\"Failed to parse input type for #[implementation(...)]. Expected a valid Rust type.\n\t\t\t\t\tError: {}\",\n\t\t\t\t\te,\n\t\t\t\t),\n\t\t\t)\n\t\t})?;\n\t\tlet arrow: RArrow = input.parse().map_err(|_| {\n\t\t\tError::new(\n\t\t\t\tinput.span(),\n\t\t\t\tindoc!(\n\t\t\t\t\t\"Expected `->` arrow after input type in #[implementations(...)] on a field of type `impl Node`.\n\t\t\t\t\tThe correct syntax is `InputType -> OutputType`.\"\n\t\t\t\t),\n\t\t\t)\n\t\t})?;\n\t\tlet output_type: Type = input.parse().map_err(|e| {","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/node-graph/node-macro/src/parsing.rs#L337-L373","documentation":"Inside the node-graph macro, each entry of #[implementations(...)] on a node parameter is parsed by syn as `Type -> Type`. This error wraps syn's failure for the tokens before the `->`: they must form a valid Rust type. It is spanned to the attribute and appends syn's own message, which names the offending token.","triggerScenarios":"#[implementations(-> f64)] with the input type omitted; a literal or expression where a type belongs, e.g. #[implementations(3 -> f64)]; a typo'd or out-of-scope type path; unclosed generics such as Vec< before the arrow.","commonSituations":"Hand-authoring a new node's implementation list; porting nodes written against an older macro grammar; generic type paths referencing parameters not in scope where the node is defined.","solutions":["Rewrite the entry as `InputType -> OutputType`, e.g. #[implementations(f32 -> f64)]","Read the appended \"Error: {e}\" line — syn names the exact token it could not parse","Confirm the input type is a real, in-scope Rust type where the node is defined","Compare against a known-good list like #[implementations(i32 -> f64, String -> Vec<u8>)]"],"exampleFix":"// before\n#[implementations(-> f64)]\nfn my_node(input: f64) -> f64 { /* ... */ }\n\n// after\n#[implementations(f64 -> f64)]\nfn my_node(input: f64) -> f64 { /* ... */ }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Follow the pair grammar strictly: InputType -> OutputType, comma-separated","Copy a known-good #[implementations(...)] from a sibling node as a template","Run cargo check immediately after writing node attributes so macro errors surface early"],"tags":["proc-macro","rust","node-graph","compile-time","syn"],"backgroundTag":"proc-macro-syntax-error","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}