3 ms·
Using references in unsafe Rust is harder than using raw pointers in C. Using raw pointers in unsafe Rust is easier than using raw pointers in C. The solution
by kibwen 2y ago
Using references in unsafe Rust is harder than using raw pointers in C.
Using raw pointers in unsafe Rust is easier than using raw pointers in C.
The solution is to not manipulate references in unsafe code. The problem is that in old versions of Rust this was tricky. Modern versions of Rust have addressed this by adding first-class facilities for producing pointers without needing temporary references: https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html#native-syntax-for-creating-a-raw-pointer https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html#nativ...