about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorZach Pomerantz <zmp@umich.edu>2014-06-10 17:36:02 -0700
committerZach Pomerantz <zmp@umich.edu>2014-06-10 17:36:02 -0700
commit4f90025b68b41cc9e32bb8da7765ddae081a2ed7 (patch)
tree211ec715cc091fad4060c311e616bb49352d9769 /src
parentb1302f9c4f6619bf83fff39b305b990d8f628eb7 (diff)
downloadrust-4f90025b68b41cc9e32bb8da7765ddae081a2ed7.tar.gz
rust-4f90025b68b41cc9e32bb8da7765ddae081a2ed7.zip
Update description to reflect language changes
Previously, the type system's restrictions on borrowing were summarized as

> The previous example showed that the type system forbids any borrowing of owned boxes found in aliasable, mutable memory

This did not jive with the example, which allowed mutations so long as the borrowed reference had been returned. Also, the language has changed to no longer allow aliasable mutable locations. This changes the summary to read

> The previous example showed that the type system forbids mutations of owned boxed values while they are being borrowed. In general, the type system also forbids borrowing a value as mutable if it is already being borrowed - either as a mutable reference or an immutable one.

This adds more general information for the experienced reader as well, to offer a more complete understanding.
Diffstat (limited to 'src')
-rw-r--r--src/doc/guide-lifetimes.md6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/doc/guide-lifetimes.md b/src/doc/guide-lifetimes.md
index 65f37031674..552ecaf49cd 100644
--- a/src/doc/guide-lifetimes.md
+++ b/src/doc/guide-lifetimes.md
@@ -275,8 +275,10 @@ invalidate the pointer `owner_age`.
 
 # Borrowing and enums
 
-The previous example showed that the type system forbids any borrowing
-of owned boxes found in aliasable, mutable memory. This restriction
+The previous example showed that the type system forbids any mutations
+of owned boxed values while they are being borrowed. In general, the type
+system also forbids borrowing a value as mutable if it is already being
+borrowed - either as a mutable reference or an immutable one. This restriction
 prevents pointers from pointing into freed memory. There is one other
 case where the compiler must be very careful to ensure that pointers
 remain valid: pointers into the interior of an `enum`.