kyren / gc-arena

Incremental garbage collection from safe Rust
Creative Commons Zero v1.0 Universal
438 stars 36 forks source link

Allow Gc and GcCell pointers to be reconstituted from raw pointers #29

Closed redacted-moose closed 1 year ago

redacted-moose commented 1 year ago

This adds a from_raw method on the Gc and GcCell types to allow garbage-collected pointers to be round-tripped through raw pointers. This is useful to allow these types to participate in e.g. pointer tagging and NaN boxing schemes.

This also fixes a soundness issue (detected by miri) regarding stacked borrows in Gc's as_ptr implementation.

kyren commented 1 year ago

WELL, I just merged #55 which adds this feature. I didn't actually realize it, but I guess there was already an open PR!

I am sorry I wasn't really active with the project at the time you opened your PR, I completely missed it. I even found the same stacked borrows issue that you did.

Closing as it is already implemented, I'm sorry I wasn't more responsive here.