Re:Implementing tile encoding in rav1e
by mtgx on Thursday April 25, 2019 @11:30AM
(#19749166)
Could such a workaround come to the Rust language in the future. Maybe other programs will need a "safe" way to implement something similar that is currently impossible with the safe methods offered by Rust.
[ Parent
| on HN ]
Re:Implementing tile encoding in rav1e
by unrealhoang on Thursday April 25, 2019 @12:00PM
(#19749478)
But why? That’s is exactly the reason why unsafe exists: to open an escape hatch to do something that is impossible to do in safe Rust (and then wrap that under a safe interface). Your safe Rust, standard library, is constructed exactly the same way: based on unsafe.
Unsafe doesn’t magically make your code unsafe, it’s just that you tell the compiler to trust you to handle the problem correctly (usually by meddling directly with pointers).
For me the question was more, isn't Rust supposed to have fearless concurrency meaning no "unsafe" part to modify data between threads.
What would most likely here would be abstracting this problem into a library that could isolate "unsafe" in a place where it could be specified, tested and examined in isolation.