{"record":{"id":"e7bb546da51c053b","repo":"slint-ui/slint","slug":"unsupported-maybeuninit-layout-for-sharedvector-element-type","errorCode":null,"errorMessage":"unsupported MaybeUninit layout for SharedVector element type","messagePattern":"unsupported MaybeUninit layout for SharedVector element type","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"internal/core/gdb_pretty_printers.py","lineNumber":49,"sourceCode":"                yield f\"[{i}]\", (data_ptr + i).dereference()\n        except Exception as e:\n            yield \"<error>\", f\"error reading elements: {e}\"\n\n    def display_hint(self):\n        return \"array\"\n\n    @staticmethod\n    def _element_type(maybe_uninit_val):\n        ty = maybe_uninit_val.type\n        for field in ty.fields():\n            if field.name == \"value\":\n                val_type = field.type\n                if val_type.code == gdb.TYPE_CODE_STRUCT:\n                    for sub in val_type.fields():\n                        if sub.name in (\"value\", \"__0\", \"0\"):\n                            return sub.type\n                return val_type\n        raise RuntimeError(\n            \"unsupported MaybeUninit layout for SharedVector element type\"\n        )\n\n\nclass SharedVectorSubPrinter(gdb.printing.SubPrettyPrinter):\n    def __init__(self):\n        super().__init__(\"SharedVector\")\n\n    def __call__(self, val):\n        if not self.enabled:\n            return None\n        t = val.type.strip_typedefs()\n        if t.code == gdb.TYPE_CODE_PTR:  # also support reference to SharedVector\n            try:\n                val = val.dereference()\n                t = val.type.strip_typedefs()\n            except gdb.error:\n                return None","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/core/gdb_pretty_printers.py#L31-L67","documentation":"The GDB pretty printer for Rust's SharedVector cannot extract the element type from the vector's internal MaybeUninit storage layout. It expects a struct field named value, __0, or 0 inside the element type; the compiled layout (variant of Rust stdlib version / debug info) doesn't match, so the printer aborts.","triggerScenarios":"Debugging (gdb with the slint pretty printers loaded) a process whose debug info presents SharedVector's raw internal buffer with an unexpected MaybeUninit layout — typically after a Rust/nightly stdlib change altering std::mem::MaybeUninit or RawVec internals.","commonSituations":"Using an older slint gdb_pretty_printers.py with a newer Rust toolchain whose layout changed; printing SharedVector values in optimized builds with incomplete debug info; nightly stdlib churn.","solutions":["Update to the latest Slint version so the pretty printer matches your Rust stdlib layout.","If you must patch locally, extend the field-name list in _element_type (gdb_pretty_printers.py) to match your stdlib's actual field names (`ptype raw_buf` in gdb reveals them).","Debug with a stable toolchain matching the one the pretty printers were written against, or inspect the vector manually via its raw pointer/length fields."],"exampleFix":"// before (in gdb_pretty_printers.py _element_type)\nfor sub in val_type.fields():\n    if sub.name in (\"value\", \"__0\", \"0\"):\n        return sub.type\n\n// after: add the layout your stdlib uses\nfor sub in val_type.fields():\n    if sub.name in (\"value\", \"__0\", \"0\", \"manual\"):\n        return sub.type","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the gdb pretty printers in sync with the Rust toolchain you debug with.","Pin the debugger and compiler toolchain versions in the development environment.","When it fires, inspect SharedVector via its raw pointer/length fields manually."],"tags":["gdb","debugging","rust","pretty-printer"],"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"}