slint-ui/slint · warning · RuntimeError

unsupported NonNull layout in Slice

Error message

unsupported NonNull layout in Slice

What it means

Part of Slint's GDB pretty printers: for a Slice value, the printer reads the `ptr` field (a NonNull) and expects either a direct pointer or a wrapped field named pointer/__0/0 holding the pointer. If the NonNull layout in the debug info has none of those shapes, it raises RuntimeError 'unsupported NonNull layout in Slice' and the value is not pretty-printed.

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_STRUCT

View on GitHub (pinned to a9ea814a58)

Solutions

  1. Update the Slint pretty printers to the revision matching the binary.
  2. Debug with rust-gdb of the same toolchain version.
  3. Workaround: `disable pretty-printer slint Slice` and read ptr/slice_len fields manually.
  4. Report the layout upstream if versions already match.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Printing a Slice (`p some_slice`) or a reference to one in GDB with the Slint pretty printers enabled, when the NonNull wrapper's field layout is unrecognized for the current toolchain/build.

Common situations: Version skew between the slint printers and the rustc that produced the debug info; different codegen settings (e.g. -Zbuild-std, newer enum layout niches); using plain gdb without the rust pretty-printing setup.

Related errors


AI-assisted analysis of slint-ui/slint@a9ea814a58 (2026-08-16). Data as JSON: /api/errors/7723dfa97e781c4b. Report an issue: GitHub.