@tenderlove @thisismissem if I understand how RB_GC_GUARD works, you could probably build something similar in Rust using a RAII wrapper/"smart pointer" placed around the VALUE's pointer and having it perform a `core::ptr::volatile_read` in the `Drop` handler, which would ensure it lives on the stack until dropped
@bascule @thisismissem I am not enough an expert in Rust (and the machine code it generates) to say whether or not you're right, but I trust you! 😆 A core issue though is that you need to know the machine code the compiler generates to know whether or not you need a guard. I feel like "knowing the machine code the Rust compiler generates" is not something people sign up for when writing a Rust extension, and that's where the danger is
@bascule @thisismissem I would probably replicate the same inline assembly that Ruby uses; that (when used with a stack slot) clearly marks the stack slot address as escaping, whereas I'm not quite so sure about volatile_read
@tenderlove it seems like somebody could build a reusable library providing a rb_gc_guard!() macro with the same function, no?