~/talk

Re-inventing trait objects

Talkat RustWeek 2025 · 2025-05-13..05-17· [rust, compilers-and-language-design]
name:Waffle
links:none on file
slides:none on file

Trait objects store a data pointer and a pointer to a static vtable that holds method pointers plus drop, size and alignment (five pointer-sized fields originally), keeping per-(type,trait) metadata out of object memory. Super-trait casts optimize by arranging a subtrait’s vtable to prefix its supertrait’s entries so identity casts work; multiple supertraits use extra virtual pointers for non-prefixes. Associated constants aren’t in vtables today, vtables are emitted eagerly, and the layout is verified against the compiler implementation.

AI-written summary · about

  1. 0:00Introduction
  2. 1:21Memory layout constraints
  3. 5:40Advanced feature: supertraits
  4. 12:32Trait object upcasting
  5. 13:08Optimization techniques
  6. 13:21Final details and Q&A
  7. 20:37Closing remarks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.