Skip to main content

Module trace_impls

Module trace_impls 

Source
Expand description

Trace implementations for GC-rooted types defined in this crate. Types in lua-types (LuaValue, LuaString, UpVal) have their Trace impls in lua-types/src/trace_impls.rs because of Rust’s orphan rule.

Guidance for adding a new impl (Trace impls have subtle invariants, so change one type at a time):

  1. Read the type definition; enumerate every field
  2. For every Gc<T>, GcRef<T>, or container (Vec/Option/HashMap) thereof, call m.mark(field) or field.trace(m) appropriately
  3. Skip non-GC fields (primitives, String, Vec<u8>)
  4. Skip “intentionally not traced” fields (weak refs)
  5. Reference lgc.c’s reallymarkobject for the C original’s approach