Three GC pointers: Gc<T>
, GcRef<'a, T>
, and GcMove<T>
(aka GcRoot<T>
). T: Trace
for all three
GcRef<'a, T>
is really just &'a Gc<T>
without the extra indirection. Moving on.
Gc<T>
is never to be used on the stack. it is only to be used inside struct fields. It implements Trace
. On the stack, it must be referred to via GcRef or &Gc
We abuse the fact that rust doesn't let one move out of a borrow to enforce this. The only thing that is allowed is taking borrows of it.
The idea is: