slint-ui/slint · error · RuntimeError
unsupported NonNull layout in Slice
Error message
unsupported NonNull layout in Slice
What it means
Slice._data_pointer() unwraps the slice's NonNull to reach the data pointer for GDB pretty-printing. It recognizes the common Rust pointer field layouts (pointer, __0, tuple field 0); this error sentinel is yielded when the NonNull's type has none of those field names, i.e. a std layout change or an exotic NonNull representation the printer doesn't know. The input at fault is the GDB type of the ptr field, and the result is a '<error>' pseudo-child in the debugger view rather than a crash.
Solutions
- Update the pretty printer's _data_pointer to handle the new NonNull layout by checking candidate.type.code == gdb.TYPE_CODE_PTR before use and adding the new wrapper field name to the accepted list
- Print nn.type and its fields with 'info type' / ptype in GDB to identify the actual wrapper field and add it to ("pointer", "__0", "0")
- Fall back to the raw address: use nn.reinterpret_cast(elem_type.pointer()) when no recognized pointer field is found
- Verify the Rust std version; NonNull/Slice internal layouts changed across releases, so pin the debugger script expectations to the std version in use
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/core/gdb_pretty_printers.py:112 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/7723dfa97e781c4b.
Report an issue: GitHub.
Appendix: source
Thrown at internal/core/gdb_pretty_printers.py:112
elem_type = data_ptr.type.target()
for i in range(length):
yield f"[{i}]", (data_ptr + i).dereference()
except Exception as e:
yield "<error>", f"error reading elements: {e}"
def display_hint(self):
return "array"
def _data_pointer(self):
nn = self.val["ptr"]
if nn.type.code == gdb.TYPE_CODE_PTR:
return nn
for field in nn.type.fields():
if field.name in ("pointer", "__0", "0"):
candidate = nn[field]
if candidate.type.code == gdb.TYPE_CODE_PTR:
return candidate
raise RuntimeError("unsupported NonNull layout in Slice")
class SliceSubPrinter(gdb.printing.SubPrettyPrinter):
def __init__(self):
super().__init__("Slice")
def __call__(self, val):
if not self.enabled:
return None
t = val.type.strip_typedefs()
if t.code == gdb.TYPE_CODE_PTR: # also support reference to Slice
try:
val = val.dereference()
t = val.type.strip_typedefs()
except gdb.error:
return None
if (
t.code == gdb.TYPE_CODE_STRUCTView on GitHub (pinned to bb937076de)