about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandeep Datta <datta.sandeep@gmail.com>2016-02-13 18:40:24 +0530
committerSandeep Datta <datta.sandeep@gmail.com>2016-02-13 18:40:24 +0530
commit37a952a672ca79bfcc41795e378a710c196a557a (patch)
tree57561ef4c4ece3ccb4c11592441efcad25d9167e
parenta6fedc85bfec568a404c4a78d9c7faef12937695 (diff)
downloadrust-37a952a672ca79bfcc41795e378a710c196a557a.tar.gz
rust-37a952a672ca79bfcc41795e378a710c196a557a.zip
Fixed build error as per steveklabnik's suggestion and expanded on the ills of doing out of bounds accesses.
-rw-r--r--src/doc/book/ownership.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/doc/book/ownership.md b/src/doc/book/ownership.md
index cf6a43b1f13..3d67e20388b 100644
--- a/src/doc/book/ownership.md
+++ b/src/doc/book/ownership.md
@@ -166,6 +166,8 @@ Rust’s safety guarantees by introducing a data race if one could access both
 For example if we truncated the vector to just two elements through `v2`:
 
 ```rust
+# let v = vec![1, 2, 3];
+# let v2 = v;
 v2.truncate(2);
 ```
 
@@ -174,7 +176,9 @@ would not know that the heap data has been truncated. Now, the part of the
 vector `v1` on the stack does not agree with the corresponding part on the
 heap. `v1` still thinks there are three elements in the vector and will
 happily let us access the non existent element `v1[2]` but as you might
-already know this is a recipe for disaster (might lead to a segfault).
+already know this is a recipe for disaster. Especially because it might lead
+to a segmentation fault or worse allow an unauthorized user to read from
+memory to which they don't have access.
 
 This is why Rust forbids using `v` after we’ve done the move.