Unsafe for work

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

This post explores the concept of 'unsafe' code in Rust, clarifying misconceptions about its impact on safety features such as the borrow checker. It explains that while 'unsafe' Rust does not deactivate the borrow checker, it allows developers to perform certain low-level operations such as dereferencing raw pointers and calling unsafe functions. The use of unsafe code requires careful checks and is encouraged to be kept minimal and well-documented. Examples include creating raw pointers and handling them safely, using safe abstractions, and understanding the responsibilities that come with unsafe operations. The importance of tools like Miri for checking unsafe code is also highlighted.

18m read timeFrom oida.dev
Post cover image
Table of contents
What’s the deal with unsafe ? #A language superset #Raw pointers #unsafe blocks and functions #Safe abstractions #Unsafe for work #Unsafe is a safety feature #Related Articles

Sort: