Is unsafe Rust worse than C?

โš“ Rust    ๐Ÿ“… 2026-05-27    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 1      

surdeus

I've been thinking of migrating from C to Rust, but with unsafe Rust I can't see much benefit as it's much less well defined than C from what I can see.

Looking at Behavior considered undefined - The Rust Reference :

The following list is not exhaustive; it may grow or shrink. There is no formal model of Rustโ€™s semantics for what is and is not allowed in unsafe code, so there may be more behavior considered unsafe.

Breaking the pointer aliasing rules. The exact aliasing rules are not determined yet, but here is an outline of the general principles

Violating assumptions of the Rust runtime. Most assumptions of the Rust runtime are currently not explicitly documented.

There's not many guides online about how to write unsafe Rust either, mostly 'it's really hard and you shouldn't do it'.

10 posts - 5 participants

Read full topic

๐Ÿท๏ธ Rust_feed