slint-ui/slint · warning · RuntimeError

unsupported MaybeUninit layout for SharedVector element type

Error message

unsupported MaybeUninit layout for SharedVector element type

What it means

Slint registers GDB pretty printers for its internal types (loaded via rust-gdb). When printing a SharedVector, the printer descends into the element type wrapped in core::mem::MaybeUninit and recognizes only known field layouts (a `value` field whose struct again has value/__0/0-style fields, or the value type directly). If the debug info layout does not match — typically because a different rustc version changed MaybeUninit's field naming — the printer raises this RuntimeError instead of printing the value.

Source

Thrown at internal/core/gdb_pretty_printers.py:49

                yield f"[{i}]", (data_ptr + i).dereference()
        except Exception as e:
            yield "<error>", f"error reading elements: {e}"

    def display_hint(self):
        return "array"

    @staticmethod
    def _element_type(maybe_uninit_val):
        ty = maybe_uninit_val.type
        for field in ty.fields():
            if field.name == "value":
                val_type = field.type
                if val_type.code == gdb.TYPE_CODE_STRUCT:
                    for sub in val_type.fields():
                        if sub.name in ("value", "__0", "0"):
                            return sub.type
                return val_type
        raise RuntimeError(
            "unsupported MaybeUninit layout for SharedVector element type"
        )


class SharedVectorSubPrinter(gdb.printing.SubPrettyPrinter):
    def __init__(self):
        super().__init__("SharedVector")

    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 SharedVector
            try:
                val = val.dereference()
                t = val.type.strip_typedefs()
            except gdb.error:
                return None

View on GitHub (pinned to a9ea814a58)

Solutions

  1. Update to the pretty printers matching your build (source internal/core/gdb_pretty_printers.py from the same slint revision).
  2. Use rust-gdb from the same toolchain as the binary being debugged so debug info layouts line up.
  3. As a workaround, disable the printer and inspect raw fields: `disable pretty-printer slint SharedVector`, then print the struct directly.
  4. If it persists on matching versions, report the type layout upstream so the printer can learn it.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Executing `p some_shared_vector` (or letting GDB auto-print it) in rust-gdb/gdb with the Slint pretty printers registered, where the element's MaybeUninit layout is not one of the recognized shapes.

Common situations: Pretty printers from an older slint release used with a newer Rust toolchain (or vice versa); plain gdb instead of rust-gdb; a rustc nightly that restructured MaybeUninit internals.

Related errors


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