From c98e46c7cabd44a306ac52c95d961bcebd899b0f Mon Sep 17 00:00:00 2001 From: Alexis Beingessner Date: Fri, 26 Jun 2015 11:44:02 -0700 Subject: [PATCH 1/2] accessing private fields is not safe, and io isn't scary --- src/doc/reference.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index a3e13acccae28..7e28651c6aafb 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1047,11 +1047,8 @@ This is a list of behavior not considered *unsafe* in Rust terms, but that may be undesired. * Deadlocks -* Reading data from private fields (`std::repr`) * Leaks of memory and other resources * Exiting without calling destructors -* Sending signals -* Accessing/modifying the file system * Integer overflow - Overflow is considered "unexpected" behavior and is always user-error, unless the `wrapping` primitives are used. In non-optimized builds, the compiler From 9001da658ae020199b479f416b21eb71d0d48492 Mon Sep 17 00:00:00 2001 From: Alexis Beingessner Date: Fri, 26 Jun 2015 12:06:05 -0700 Subject: [PATCH 2/2] make book match reference --- src/doc/trpl/unsafe.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/doc/trpl/unsafe.md b/src/doc/trpl/unsafe.md index fdb9c33a2b0b5..e8f1b829061c2 100644 --- a/src/doc/trpl/unsafe.md +++ b/src/doc/trpl/unsafe.md @@ -12,7 +12,7 @@ two contexts. The first one is to mark a function as unsafe: ```rust unsafe fn danger_will_robinson() { - // scary stuff + // scary stuff } ``` @@ -68,11 +68,8 @@ Whew! That’s a bunch of stuff. It’s also important to notice all kinds of behaviors that are certainly bad, but are expressly _not_ unsafe: * Deadlocks -* Reading data from private fields -* Leaks due to reference count cycles +* Leaks of memory or other resources * Exiting without calling destructors -* Sending signals -* Accessing/modifying the file system * Integer overflow Rust cannot prevent all kinds of software problems. Buggy code can and will be