Skip to content

Commit e922989

Browse files
authored
Merge pull request rust-lang#647 from RalfJung/sound
Define sound and unsound
2 parents 1528956 + 3597e8f commit e922989

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/behavior-considered-undefined.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
## Behavior considered undefined
22

3-
Rust code, including within `unsafe` blocks and `unsafe` functions is incorrect
4-
if it exhibits any of the behaviors in the following list. It is the
5-
programmer's responsibility when writing `unsafe` code that it is not possible
6-
to let `safe` code exhibit these behaviors.
3+
Rust code is incorrect if it exhibits any of the behaviors in the following
4+
list. This includes code within `unsafe` blocks and `unsafe` functions.
5+
`unsafe` only means that avoiding undefined behavior is on the programmer; it
6+
does not change anything about the fact that Rust programs must never cause
7+
undefined behavior.
8+
9+
It is the programmer's responsibility when writing `unsafe` code to ensure that
10+
any safe code interacting with the `unsafe` code cannot trigger these
11+
behaviors. `unsafe` code that satisfies this property for any safe client is
12+
called *sound*; if `unsafe` code can be misused by safe code to exhibit
13+
undefined behavior, it is *unsound*.
714

815
<div class="warning">
916

0 commit comments

Comments
 (0)