{"record":{"id":"a5bbf2808dd27e90","repo":"slint-ui/slint","slug":"unsupported-field-type-only-path-types-are-handled","errorCode":null,"errorMessage":"unsupported field type; only path types are handled","messagePattern":"unsupported field type; only path types are handled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/node/build.rs","lineNumber":636,"sourceCode":"            if let Ok(value) = meta.value()\n                && let Ok(text) = value.parse::<syn::LitStr>()\n                && is_match\n            {\n                found = Some(text.value());\n            }\n            Ok(())\n        });\n    }\n    found\n}\n\n/// The last segment of a type path, which is all the type maps need.\nfn type_name(ty: &syn::Type) -> String {\n    match ty {\n        syn::Type::Path(path) => {\n            path.path.segments.last().expect(\"empty type path\").ident.to_string()\n        }\n        _ => panic!(\"unsupported field type; only path types are handled\"),\n    }\n}\n\n/// Convert `snake_case` to `camelCase`, the way `#[napi(js_name = \"…\")]` spells fields.\nfn to_camel_case(s: &str) -> String {\n    let mut out = String::with_capacity(s.len());\n    let mut capitalize = false;\n    for c in s.chars() {\n        if c == '_' {\n            capitalize = true;\n        } else if capitalize {\n            out.extend(c.to_uppercase());\n            capitalize = false;\n        } else {\n            out.push(c);\n        }\n    }\n    out","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/build.rs#L618-L654","documentation":"type_name extracts the final path segment of a field's type, which is all the type maps need. It panics for any syn::Type that is not a Type::Path — e.g. references (&T), slices/arrays, tuples, or Option<...> written as a non-path? (actually Option is a path; this hits things like &str or [T; N]). It is a guard stating the generator only supports plain path-typed fields; a new field with a compound type trips it.","triggerScenarios":"Thrown at api/node/build.rs:636 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the WindowEvent field from a non-path type (e.g. reference, trait object, array, or fn pointer) to a plain path type in the Rust enum","Extend type_name in api/node/build.rs to handle the additional syn::Type variant and extract a usable name","If the field is an Option or Box wrapper, unwrap it in type_name before taking the last path segment"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}