{"record":{"id":"6dd2b33b65e6e1b2","repo":"slint-ui/slint","slug":"path-elements-should-have-a-native-type","errorCode":null,"errorMessage":"path elements should have a native_type","messagePattern":"path elements should have a native_type","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/compiler/llr/lower_expression.rs","lineNumber":882,"sourceCode":"    match path {\n        crate::expression_tree::Path::Elements(elements) => {\n            let converted_elements = elements\n                .iter()\n                .map(|element| {\n                    let element_type = Arc::new(Struct::new(\n                        element\n                            .element_type\n                            .properties\n                            .iter()\n                            .map(|(k, v)| (k.clone(), v.ty.clone()))\n                            .collect(),\n                        StructName::Builtin(\n                            element\n                                .element_type\n                                .native_class\n                                .builtin_struct\n                                .clone()\n                                .expect(\"path elements should have a native_type\"),\n                        ),\n                    ));\n\n                    llr_Expression::Struct {\n                        ty: element_type,\n                        values: element\n                            .element_type\n                            .properties\n                            .iter()\n                            .map(|(element_field_name, element_property)| {\n                                (\n                                    element_field_name.clone(),\n                                    element.bindings.get(element_field_name).map_or_else(\n                                        || {\n                                            llr_Expression::default_value_for_type(\n                                                &element_property.ty,\n                                            )\n                                            .unwrap()","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/compiler/llr/lower_expression.rs#L864-L900","documentation":"This panic comes from an `expect` in `compile_path` (internal/compiler/llr/lower_expression.rs:882) while lowering a path element to LLR. When a path element's type is a builtin struct, the compiler expects the element's `native_class` to carry a `builtin_struct`; if it is `None`, the compiler's internal invariant is broken. This is a compiler-internal panic, not a user-facing diagnostic, so hitting it means either a Slint compiler bug or an invalid path element that an earlier pass should have rejected.","triggerScenarios":"Compiling a .slint file whose `Path` element (e.g. inside a `Path`/`path` property literal or a builtin path element) resolves to a `StructName::Builtin` whose element_type has a native_class with no `builtin_struct`. Practically: declaring a path element with a type that is marked builtin but was not registered as a builtin struct, typically after modifying builtin element definitions or via a compiler regression.","commonSituations":"Slint compiler contributors changing builtin element/native class registration; custom builds of the compiler with modified `builtin_struct` tables; edge-case .slint path markup that slips past validation during compiler development.","solutions":["Check the .slint path markup: ensure path elements use supported builtin element types (e.g. `Path`, `MoveTo`, `LineTo`) and remove any unusual/custom element types.","Verify the `native_class.builtin_struct` registration for the element type in internal/compiler (builtin definitions) was not removed or renamed — restore it.","Reduce the .slint file to a minimal reproducer and file a bug at github.com/slint-ui/slint with the compiler version.","Pin/upgrade to a released Slint compiler version where this regression is fixed."],"exampleFix":"// before (contributor fix in builtin element table)\nnative_class: NativeClass { builtin_struct: None, .. };\n// after\nnative_class: NativeClass { builtin_struct: Some(BuiltinStruct::LineTo), .. };","handlingStrategy":"validation","validationCode":"// Pre-check .slint source for path elements before compiling\nfn uses_builtin_path_elements(src: &str) -> bool {\n    src.contains(\"Path\") || src.contains(\"MoveTo\") || src.contains(\"LineTo\")\n}\n// Only pass well-formed path markup to the compiler; strip or fix anything custom.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep path markup to documented builtin element types only.","When hacking on the compiler, always keep native_class.builtin_struct in sync with builtin element definitions.","Add compiler-side validation to reject builtin path elements without builtin_struct before LLR lowering."],"tags":["rust","compiler","internal-panic","slint"],"backgroundTag":"internal-invariant-violation","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"}