slint-ui/slint · error
path elements should have a native_type
Error message
path elements should have a native_type
What it means
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.
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.
Example fix
// before (contributor fix in builtin element table)
native_class: NativeClass { builtin_struct: None, .. };
// after
native_class: NativeClass { builtin_struct: Some(BuiltinStruct::LineTo), .. }; Defensive patterns
Strategy: validation
Validate before calling
// Pre-check .slint source for path elements before compiling
fn uses_builtin_path_elements(src: &str) -> bool {
src.contains("Path") || src.contains("MoveTo") || src.contains("LineTo")
}
// Only pass well-formed path markup to the compiler; strip or fix anything custom. Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- named struct declarations have symbol counters
- Component should cleanly upgrade here
- constraint must have binding
- EmbedTextures builds the shared font collection
- internal compiler error: more than one strong reference…
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/6dd2b33b65e6e1b2.
Report an issue: GitHub.
Appendix: source
Thrown at internal/compiler/llr/lower_expression.rs:882
match path {
crate::expression_tree::Path::Elements(elements) => {
let converted_elements = elements
.iter()
.map(|element| {
let element_type = Arc::new(Struct::new(
element
.element_type
.properties
.iter()
.map(|(k, v)| (k.clone(), v.ty.clone()))
.collect(),
StructName::Builtin(
element
.element_type
.native_class
.builtin_struct
.clone()
.expect("path elements should have a native_type"),
),
));
llr_Expression::Struct {
ty: element_type,
values: element
.element_type
.properties
.iter()
.map(|(element_field_name, element_property)| {
(
element_field_name.clone(),
element.bindings.get(element_field_name).map_or_else(
|| {
llr_Expression::default_value_for_type(
&element_property.ty,
)
.unwrap()View on GitHub (pinned to bb937076de)