News for hackers. Stuff that matters.
Re:Why Rust helps even if you have to use a lot of `unsafe` by CodesInChaos on Wednesday August 02, 2023 @12:29PM (#36973149)
The problem with adding a non_null_unique_ptr<T> to C++ is that moving needs to leave behind a valid value.
Re:Why Rust helps even if you have to use a lot of `unsafe` by gpderetta on Wednesday August 02, 2023 @01:02PM (#36973607)
You are right, but you could make it not movable (and add destructive mode hooks for optional and containers).

It is still possible to return non-movable, non-copyable types from functions.

But I guess ergonomics would not be good.