about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-04-27 14:45:43 +0000
committerbors <bors@rust-lang.org>2015-04-27 14:45:43 +0000
commit32f9f4276271bac1b8c3bc569ceed5cfaf992f29 (patch)
treeee1dacb85756e6fea3059a48f345317eb2986271
parentb772ce6342962792620e21623997d0d3b98164b7 (diff)
parent03f3b45ff0875926e245b1e6975d0578fd640468 (diff)
downloadrust-32f9f4276271bac1b8c3bc569ceed5cfaf992f29.tar.gz
rust-32f9f4276271bac1b8c3bc569ceed5cfaf992f29.zip
Auto merge of #24869 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24797, #24804, #24848, #24854, #24855, #24860, #24863, #24866, #24867, #24868
- Failed merges: 
-rw-r--r--src/doc/reference.md26
-rw-r--r--src/doc/trpl/hello-cargo.md7
-rw-r--r--src/doc/trpl/vectors.md5
-rw-r--r--src/libcollections/string.rs9
-rw-r--r--src/libcollections/vec.rs18
-rw-r--r--src/libcore/convert.rs4
-rw-r--r--src/librustdoc/html/render.rs2
-rw-r--r--src/librustdoc/html/static/main.css2
-rw-r--r--src/librustdoc/html/static/main.js16
-rw-r--r--src/libstd/thread/mod.rs3
10 files changed, 61 insertions, 31 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 7c9cca90edd..cec58d618ef 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -84,7 +84,7 @@ that does _not_ occur in the set of [keywords](#keywords).
 ## Comments
 
 Comments in Rust code follow the general C++ style of line (`//`) and
-block-comment (`/* ... */`) forms. Nested block comments are supported.
+block (`/* ... */`) comment forms. Nested block comments are supported.
 
 Line comments beginning with exactly _three_ slashes (`///`), and block
 comments beginning with exactly one repeated asterisk in the block-open
@@ -192,13 +192,13 @@ which must be _escaped_ by a preceding `U+005C` character (`\`).
 
 A _string literal_ is a sequence of any Unicode characters enclosed within two
 `U+0022` (double-quote) characters, with the exception of `U+0022` itself,
-which must be _escaped_ by a preceding `U+005C` character (`\`), or a _raw
-string literal_.
+which must be _escaped_ by a preceding `U+005C` character (`\`).
 
-A multi-line string literal may be defined by terminating each line with a
-`U+005C` character (`\`) immediately before the newline. This causes the
-`U+005C` character, the newline, and all whitespace at the beginning of the
-next line to be ignored.
+Line-break characters are allowed in string literals. Normally they represent
+themselves (i.e. no translation), but as a special exception, when a `U+005C`
+character (`\`) occurs immediately before the newline, the `U+005C` character,
+the newline, and all whitespace at the beginning of the next line are ignored.
+Thus `a` and `b` are equal:
 
 ```rust
 let a = "foobar";
@@ -366,11 +366,19 @@ A _floating-point literal_ has one of two forms:
   optionally followed by another decimal literal, with an optional _exponent_.
 * A single _decimal literal_ followed by an _exponent_.
 
-By default, a floating-point literal has a generic type, and, like integer
-literals, the type must be uniquely determined from the context. There are two valid
+Like integer literals, a floating-point literal may be followed by a
+suffix, so long as the pre-suffix part does not end with `U+002E` (`.`).
+The suffix forcibly sets the type of the literal. There are two valid
 _floating-point suffixes_, `f32` and `f64` (the 32-bit and 64-bit floating point
 types), which explicitly determine the type of the literal.
 
+The type of an _unsuffixed_ floating-point literal is determined by type
+inference. If a floating-point type can be _uniquely_ determined from the
+surrounding program context, the unsuffixed floating-point literal has that type.
+If the program context underconstrains the type, it defaults to double-precision `f64`;
+if the program context overconstrains the type, it is considered a static type
+error.
+
 Examples of floating-point literals of various forms:
 
 ```
diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md
index 6967532a447..d547451fcce 100644
--- a/src/doc/trpl/hello-cargo.md
+++ b/src/doc/trpl/hello-cargo.md
@@ -32,6 +32,13 @@ $ mkdir src
 $ mv main.rs src/main.rs
 ```
 
+Note that since we're creating an executable, we used `main.rs`. If we
+want to make a library instead, we should use `lib.rs`.
+Custom file locations for the entry point can be specified
+with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
+
+[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target
+
 Cargo expects your source files to live inside a `src` directory. That leaves
 the top level for other things, like READMEs, license information, and anything
 not related to your code. Cargo helps us keep our projects nice and tidy. A
diff --git a/src/doc/trpl/vectors.md b/src/doc/trpl/vectors.md
index 28d815c4eb7..6170bdb86ea 100644
--- a/src/doc/trpl/vectors.md
+++ b/src/doc/trpl/vectors.md
@@ -1,8 +1,9 @@
 % Vectors
 
 A ‘vector’ is a dynamic or ‘growable’ array, implemented as the standard
-library type [`Vec<T>`][vec]. That `<T>` is a [generic][generic], meaning we
-can have vectors of any type. Vectors always allocate their data on the heap.
+library type [`Vec<T>`][vec]. The `T` means that we can have vectors
+of any type (see the chapter on [generics][generic] for more).
+Vectors always allocate their data on the heap.
 You can create them with the `vec!` macro:
 
 ```rust
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index a37a26ef22a..be6405dc85a 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -951,12 +951,13 @@ impl<'a> Deref for DerefString<'a> {
 /// # #![feature(collections)]
 /// use std::string::as_string;
 ///
-/// fn string_consumer(s: String) {
-///     assert_eq!(s, "foo".to_string());
+/// // Let's pretend we have a function that requires `&String`
+/// fn string_consumer(s: &String) {
+///     assert_eq!(s, "foo");
 /// }
 ///
-/// let string = as_string("foo").clone();
-/// string_consumer(string);
+/// // Provide a `&String` from a `&str` without allocating
+/// string_consumer(&as_string("foo"));
 /// ```
 #[unstable(feature = "collections")]
 pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index c8a8498d2f9..b033c2d90e1 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -536,7 +536,7 @@ impl<T> Vec<T> {
     ///
     /// # Panics
     ///
-    /// Panics if `i` is out of bounds.
+    /// Panics if `index` is out of bounds.
     ///
     /// # Examples
     ///
@@ -1915,6 +1915,22 @@ impl<'a, T> Drop for DerefVec<'a, T> {
 }
 
 /// Converts a slice to a wrapper type providing a `&Vec<T>` reference.
+///
+/// # Examples
+///
+/// ```
+/// # #![feature(collections)]
+/// use std::vec::as_vec;
+///
+/// // Let's pretend we have a function that requires `&Vec<i32>`
+/// fn vec_consumer(s: &Vec<i32>) {
+///     assert_eq!(s, &[1, 2, 3]);
+/// }
+///
+/// // Provide a `&Vec<i32>` from a `&[i32]` without allocating
+/// let values = [1, 2, 3];
+/// vec_consumer(&as_vec(&values));
+/// ```
 #[unstable(feature = "collections")]
 pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> {
     unsafe {
diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs
index d9cda58d9eb..d3de77a9241 100644
--- a/src/libcore/convert.rs
+++ b/src/libcore/convert.rs
@@ -83,10 +83,8 @@ pub trait Into<T>: Sized {
 /// `String` implements `From<&str>`:
 ///
 /// ```
-/// let s = "hello";
 /// let string = "hello".to_string();
-///
-/// let other_string: String = From::from(s);
+/// let other_string = String::from("hello");
 ///
 /// assert_eq!(string, other_string);
 /// ```
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 1993f03efd1..a2cfb533c1a 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> {
         try!(write!(fmt, "<span class='out-of-band'>"));
         try!(write!(fmt,
         r##"<span id='render-detail'>
-            <a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
+            <a id="toggle-all-docs" href="#" title="collapse all docs">[&minus;]</a>
         </span>"##));
 
         // Write `src` tag
diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css
index c94dbc15103..b907e9e20b6 100644
--- a/src/librustdoc/html/static/main.css
+++ b/src/librustdoc/html/static/main.css
@@ -392,7 +392,7 @@ a {
     text-decoration: underline;
 }
 
-.content span.trait, .content a.trait, .block a.current.trait { color: #ed9603; }
+.content span.trait, .content a.trait, .block a.current.trait { color: #8866ff; }
 .content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; }
 .content span.enum, .content a.enum, .block a.current.enum { color: #5e9766; }
 .content span.struct, .content a.struct, .block a.current.struct { color: #e53700; }
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 56cea50a502..c2a59278a86 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -808,20 +808,20 @@
 
     $("#toggle-all-docs").on("click", function() {
         var toggle = $("#toggle-all-docs");
-        if (toggle.html() == "[-]") {
-            toggle.html("[+]");
+        if (toggle.html() == "[&minus;]") {
+            toggle.html("[&plus;]");
             toggle.attr("title", "expand all docs");
             $(".docblock").hide();
             $(".toggle-label").show();
             $(".toggle-wrapper").addClass("collapsed");
-            $(".collapse-toggle").children(".inner").html("+");
+            $(".collapse-toggle").children(".inner").html("&plus;");
         } else {
-            toggle.html("[-]");
+            toggle.html("[&minus;]");
             toggle.attr("title", "collapse all docs");
             $(".docblock").show();
             $(".toggle-label").hide();
             $(".toggle-wrapper").removeClass("collapsed");
-            $(".collapse-toggle").children(".inner").html("-");
+            $(".collapse-toggle").children(".inner").html("&minus;");
         }
     });
 
@@ -835,12 +835,12 @@
             if (relatedDoc.is(":visible")) {
                 relatedDoc.slideUp({duration:'fast', easing:'linear'});
                 toggle.parent(".toggle-wrapper").addClass("collapsed");
-                toggle.children(".inner").html("+");
+                toggle.children(".inner").html("&plus;");
                 toggle.children(".toggle-label").fadeIn();
             } else {
                 relatedDoc.slideDown({duration:'fast', easing:'linear'});
                 toggle.parent(".toggle-wrapper").removeClass("collapsed");
-                toggle.children(".inner").html("-");
+                toggle.children(".inner").html("&minus;");
                 toggle.children(".toggle-label").hide();
             }
         }
@@ -848,7 +848,7 @@
 
     $(function() {
         var toggle = $("<a/>", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'})
-            .html("[<span class='inner'>-</span>]");
+            .html("[<span class='inner'>&minus;</span>]");
 
         $(".method").each(function() {
             if ($(this).next().is(".docblock") ||
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 9168a716d43..383726b3e83 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -115,8 +115,7 @@
 //! ## Configuring threads
 //!
 //! A new thread can be configured before it is spawned via the `Builder` type,
-//! which currently allows you to set the name, stack size, and writers for
-//! `println!` and `panic!` for the child thread:
+//! which currently allows you to set the name and stack size for the child thread:
 //!
 //! ```rust
 //! # #![allow(unused_must_use)]