From 86d9e2c5766fc3742286ec27a5dcd5019c6abab7 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 20 Jul 2019 17:13:51 +0200 Subject: [PATCH] Define 'producing' --- src/what-unsafe-does.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/what-unsafe-does.md b/src/what-unsafe-does.md index b26951c..18d99f5 100644 --- a/src/what-unsafe-does.md +++ b/src/what-unsafe-does.md @@ -21,7 +21,7 @@ language cares about is preventing the following things: `enum`/`struct`/array/slice/tuple field address * Reading [uninitialized memory][] * Breaking the [pointer aliasing rules][] -* Producing/obtaining invalid primitive values: +* Producing invalid primitive values: * dangling/null/unaligned references * null `fn` pointers * a `bool` that isn't 0 or 1 @@ -33,6 +33,9 @@ language cares about is preventing the following things: * Unwinding into another language * Causing a [data race][race] +"Producing" a value happens any time a value is assigned, passed to a +function/primitive operation or returned from a function/primitive operation. + That's it. That's all the causes of Undefined Behavior baked into Rust. Of course, unsafe functions and traits are free to declare arbitrary other constraints that a program must maintain to avoid Undefined Behavior. For