News for hackers. Stuff that matters.
Re:How Our Rust-to-Zig Rewrite Is Going by tadfisher on Thursday July 16, 2026 @02:19PM (#48938181)
Because they view "unsafe" as an escape hatch instead of a feature. It's a way to encapsulate dangerous behavior, tightly, with clear postcondiitions. Sometimes it's the only way to do things like interact with inherently unsafe FFI code, or hardware.
Re:How Our Rust-to-Zig Rewrite Is Going by MaulingMonkey on Thursday July 16, 2026 @04:57PM (#48940144)
I adore unsafe, appreciate it as a feature... but it is an escape hatch. One that is sometimes necessary, one that is sometimes not necessary but might still be (ab)used for performance, or initial 1:1 porting of C/C++ code. There are a lot of cases where that escape hatch should probably welded shut though. Fortunately, the Rust ecosystem has tools like `cargo geiger`, and straight out of the box I can also write:

    // src\lib.rs
    #![forbid(unsafe_code)]
Re:How Our Rust-to-Zig Rewrite Is Going by duped on Thursday July 16, 2026 @06:32PM (#48941158)
I feel like this perpetuates a bad mental model. Unsafe is not an escape hatch. Code within unsafe blocks must uphold the same semantics as code outside it but the compiler cannot guarantee that those semantics are upheld.

If we're using analogies, `unsafe` is like a "hard hat required" sign. There's nothing intrinsically different about the space inside or outside of it, other than that you can't be sure a brick isn't going to fall on your head once you cross over. So it's on you to wear a hard hat. And to not drop any bricks and trust other people to do their best not to drop any bricks.

You wouldn't call that an escape hatch.

Re:How Our Rust-to-Zig Rewrite Is Going by silon42 on Friday July 17, 2026 @01:48AM (#48943728)
It can be abused as an escape hatch, but it really shouldn't be.
Re:How Our Rust-to-Zig Rewrite Is Going by tialaramex on Friday July 17, 2026 @03:42AM (#48944401)
Yeah, I'd have more sympathy for the "It's an escape hatch" model of this feature if the C++ approaches to this problem didn't keep adding actual escape hatches and waving away concerns as "Rust does this too so it's fine".