News for hackers. Stuff that matters.
Re:Effective Rust by pornel on Thursday June 15, 2023 @12:10PM (#36342634)
BTW, overcommit/oomkiller aside, recovery from allocation failure in Rust can be easy and reliable.

There is an assumption carried over from C that code paths handling OOM errors are untested and likely broken. However, Rust doesn't have manually-written error handling paths like that. It has `Drop` which is always correctly inserted by the compiler, and regularly tested on normal function exits.

Re:Effective Rust by ridiculous_fish on Thursday June 15, 2023 @03:24PM (#36345268)
Rust does have manually-written error handling paths like that. See for example the panic handling in Vec.retain_mut: https://doc.rust-lang.org/src/alloc/vec/mod.rs.html#1577

I doubt most crates handle these scenarios correctly.

Re:Effective Rust by pornel on Thursday June 15, 2023 @09:45PM (#36349878)
This is limited to unsafe code, and the "exception safety" is a known problem to deal with. It can be tested without having to trigger OOM.