about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgamazeps <gamaz3ps@gmail.com>2014-10-30 13:53:31 +0100
committergamazeps <gamaz3ps@gmail.com>2014-10-31 19:00:00 +0100
commit4ee0c4f3fb80b44305fba53c63734e8bc69aa7ae (patch)
treead8b81a37e5c98d08fabf314cddf1a96d07a0793
parent00cc6d24099eb93ecfeb9bf807ab9e5130a01749 (diff)
downloadrust-4ee0c4f3fb80b44305fba53c63734e8bc69aa7ae.tar.gz
rust-4ee0c4f3fb80b44305fba53c63734e8bc69aa7ae.zip
DOC: improves the str type explanation
Closes #18449
-rw-r--r--src/libcollections/str.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 901f8add73c..aea0d7f6d31 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -33,21 +33,18 @@
 //! }
 //! ```
 //!
-//! From the example above, you can see that Rust's string literals have the
+//! From the example above, you can guess that Rust's string literals have the
 //! `'static` lifetime. This is akin to C's concept of a static string.
-//!
-//! String literals are allocated statically in the rodata of the
-//! executable/library. The string then has the type `&'static str` meaning that
-//! the string is valid for the `'static` lifetime, otherwise known as the
-//! lifetime of the entire program. As can be inferred from the type, these static
-//! strings are not mutable.
+//! More precisely, string literals are immutable views with a 'static lifetime
+//! (otherwise known as the lifetime of the entire program), and thus have the
+//! type `&'static str`.
 //!
 //! # Representation
 //!
 //! Rust's string type, `str`, is a sequence of Unicode scalar values encoded as a
 //! stream of UTF-8 bytes. All strings are guaranteed to be validly encoded UTF-8
-//! sequences. Additionally, strings are not null-terminated and can contain null
-//! bytes.
+//! sequences. Additionally, strings are not null-terminated and can thus contain
+//! null bytes.
 //!
 //! The actual representation of strings have direct mappings to slices: `&str`
 //! is the same as `&[u8]`.