about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2014-08-09 11:15:04 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2014-08-09 11:15:04 +0200
commit97e82cc2df6cba885ba5cc78b8736bde861bf770 (patch)
tree50efc89b09a68a166dd6bf4ee5f37054c0e31e47
parent0ba2d042244ba321258deb016d6d6e3a28546e0e (diff)
downloadrust-97e82cc2df6cba885ba5cc78b8736bde861bf770.tar.gz
rust-97e82cc2df6cba885ba5cc78b8736bde861bf770.zip
rust.md: Explicitly point out how special `'static` is.
Drive-by: fix description of `&content` to point out that `&'f type`
is (as of today) only for type expressions.
-rw-r--r--src/doc/rust.md8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/doc/rust.md b/src/doc/rust.md
index 9061a623c03..dc78faca320 100644
--- a/src/doc/rust.md
+++ b/src/doc/rust.md
@@ -1356,6 +1356,9 @@ A *static item* is a named _constant value_ stored in the global data section of
 Immutable static items are stored in the read-only data section.
 The constant value bound to a static item is, like all constant values, evaluated at compile time.
 Static items have the `static` lifetime, which outlives all other lifetimes in a Rust program.
+Only values stored in the global data section (such as string constants
+and static items) can have the `static` lifetime;
+dynamically constructed values cannot safely be assigned the `static` lifetime.
 Static items are declared with the `static` keyword.
 A static item must have a _constant expression_ giving its definition.
 
@@ -3621,7 +3624,10 @@ There are four varieties of pointer in Rust:
     References arise by (automatic) conversion from owning pointers, managed pointers,
     or by applying the borrowing operator `&` to some other value,
     including [lvalues, rvalues or temporaries](#lvalues,-rvalues-and-temporaries).
-    References are written `&content`, or in some cases `&'f content` for some lifetime-variable `f`,
+    A borrow expression is written `&content`.
+
+    A reference type is written `&'f type` for some lifetime-variable `f`,
+    or just `&type` when the lifetime can be elided;
     for example `&int` means a reference to an integer.
     Copying a reference is a "shallow" operation:
     it involves only copying the pointer itself.