Brussels / 1 & 2 February 2025

schedule

Abusing reborrowing for fun, profit, and a safepoint garbage collector


Rust's references adhere to a strict "one exclusive XOR many shared" model, which gives the language much of its greatest safety guarantees. Reborrowing is a feature that seems on surface to break this rule: An exclusive reference can be turned into shared references and those shared references can be used together with the exclusive reference as long as these are all used as if they were shared references. Only once the exclusive reference is used as exclusive, all the derived or "reborrowed" shared references are invalidated. The XOR rule is upheld, but in a way that breaks a literal reading of the rule.

Usually reborrowing is used temporarily but what if we make it our modus operandi? This talk explores using and slightly abusing reborrowing and comes out the other side with an awkward but functional safepoint garbage collector built upon reborrowing a ZST marker and a whole load of typed indexes. The garbage collector is part of the Nova JavaScript engine.

https://trynova.dev/

Speakers

Aapo Alasuutari