As I understand it, the core of the Rust GC support functionality will be a function that looks like fn gimme_roots() -> Vec<..>
or fn walk_roots<F>(f: F) where F: Fn(..)
. This can be implemented via LLVM stack roots and then walking them.
The first question is: What does the compiler identify as a root? On the flipside, how do GC library writers tell the compiler that something should be included in walk_roots
?
(this solution is flawed, skip to the trace trait one if you want)
One way to do this is an attribute, #[root]
or something.