about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-05 04:47:56 +0000
committerbors <bors@rust-lang.org>2015-05-05 04:47:56 +0000
commit31e3cb7c4e8895fff23aa67e1cd6b58d798cdac4 (patch)
tree5c8ab399eb799e89b424309a7e0226242340516a
parent0be117e2733423e70bccd8b0a46e8eccd1e1d1cc (diff)
parent135502ef0016fd6b17324cc1ed4e088863a97176 (diff)
downloadrust-31e3cb7c4e8895fff23aa67e1cd6b58d798cdac4.tar.gz
rust-31e3cb7c4e8895fff23aa67e1cd6b58d798cdac4.zip
Auto merge of #25111 - Manishearth:rollup, r=Manishearth
r? @Manishearth
-rw-r--r--src/doc/complement-lang-faq.md2
-rw-r--r--src/doc/trpl/error-handling.md4
-rw-r--r--src/doc/trpl/hello-cargo.md2
-rw-r--r--src/doc/trpl/installing-rust.md12
-rw-r--r--src/doc/trpl/nightly-rust.md12
-rwxr-xr-xsrc/etc/extract_grammar.py156
-rw-r--r--src/libcollections/str.rs4
-rw-r--r--src/libcollections/string.rs2
-rw-r--r--src/libcollections/vec.rs16
-rw-r--r--src/libcore/option.rs2
-rw-r--r--src/libcore/str/mod.rs2
-rw-r--r--src/librustc/middle/infer/higher_ranked/mod.rs2
-rw-r--r--src/librustc/middle/ty.rs2
-rw-r--r--src/libstd/collections/hash/map.rs21
-rw-r--r--src/libstd/collections/hash/set.rs20
-rw-r--r--src/libstd/macros.rs2
-rw-r--r--src/libstd/net/ip.rs3
-rw-r--r--src/libstd/path.rs2
-rw-r--r--src/libstd/sys/unix/ext/fs.rs6
-rw-r--r--src/libsyntax/ast.rs2
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/test/pretty/issue-25031.rs17
22 files changed, 81 insertions, 212 deletions
diff --git a/src/doc/complement-lang-faq.md b/src/doc/complement-lang-faq.md
index fa4e0304d1a..92e2fd93df4 100644
--- a/src/doc/complement-lang-faq.md
+++ b/src/doc/complement-lang-faq.md
@@ -109,7 +109,7 @@ This does mean that indexed access to a Unicode codepoint inside a `str` value i
 * Most "character oriented" operations on text only work under very restricted language assumptions sets such as "ASCII-range codepoints only". Outside ASCII-range, you tend to have to use a complex (non-constant-time) algorithm for determining linguistic-unit (glyph, word, paragraph) boundaries anyways. We recommend using an "honest" linguistically-aware, Unicode-approved algorithm.
 * The `char` type is UCS4. If you honestly need to do a codepoint-at-a-time algorithm, it's trivial to write a `type wstr = [char]`, and unpack a `str` into it in a single pass, then work with the `wstr`. In other words: the fact that the language is not "decoding to UCS4 by default" shouldn't stop you from decoding (or re-encoding any other way) if you need to work with that encoding.
 
-## Why are strings, vectors etc. built-in types rather than (say) special kinds of trait/impl?
+## Why are `str`s, slices, arrays etc. built-in types rather than (say) special kinds of trait/impl?
 
 In each case there is one or more operator, literal constructor, overloaded use or integration with a built-in control structure that makes us think it would be awkward to phrase the type in terms of more-general type constructors. Same as, say, with numbers! But this is partly an aesthetic call, and we'd be willing to look at a worked-out proposal for eliminating or rephrasing these special cases.
 
diff --git a/src/doc/trpl/error-handling.md b/src/doc/trpl/error-handling.md
index e261eb01dba..e4809214bd4 100644
--- a/src/doc/trpl/error-handling.md
+++ b/src/doc/trpl/error-handling.md
@@ -252,7 +252,7 @@ struct Info {
 }
 
 fn write_info(info: &Info) -> io::Result<()> {
-    let mut file = File::open("my_best_friends.txt").unwrap();
+    let mut file = File::create("my_best_friends.txt").unwrap();
 
     if let Err(e) = writeln!(&mut file, "name: {}", info.name) {
         return Err(e)
@@ -282,7 +282,7 @@ struct Info {
 }
 
 fn write_info(info: &Info) -> io::Result<()> {
-    let mut file = try!(File::open("my_best_friends.txt"));
+    let mut file = try!(File::create("my_best_friends.txt"));
 
     try!(writeln!(&mut file, "name: {}", info.name));
     try!(writeln!(&mut file, "age: {}", info.age));
diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md
index d547451fcce..cc8747d1fa7 100644
--- a/src/doc/trpl/hello-cargo.md
+++ b/src/doc/trpl/hello-cargo.md
@@ -5,7 +5,7 @@ projects. Cargo is currently in a pre-1.0 state, and so it is still a work in
 progress. However, it is already good enough to use for many Rust projects, and
 so it is assumed that Rust projects will use Cargo from the beginning.
 
-[cratesio]: https://doc.crates.io
+[cratesio]: http://doc.crates.io
 
 Cargo manages three things: building your code, downloading the dependencies
 your code needs, and building those dependencies. At first, your
diff --git a/src/doc/trpl/installing-rust.md b/src/doc/trpl/installing-rust.md
index 58d9e57dc51..b8230f060e0 100644
--- a/src/doc/trpl/installing-rust.md
+++ b/src/doc/trpl/installing-rust.md
@@ -6,16 +6,16 @@ or a Mac, all you need to do is this (note that you don't need to type in the
 `$`s, they just indicate the start of each command):
 
 ```bash
-$ curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh
+$ curl -sf -L https://static.rust-lang.org/rustup.sh | sh
 ```
 
 If you're concerned about the [potential insecurity][insecurity] of using `curl
-| sudo sh`, please keep reading and see our disclaimer below. And feel free to
+| sh`, please keep reading and see our disclaimer below. And feel free to
 use a two-step version of the installation and examine our installation script:
 
 ```bash
 $ curl -f -L https://static.rust-lang.org/rustup.sh -O
-$ sudo sh rustup.sh
+$ sh rustup.sh
 ```
 
 [insecurity]: http://curlpipesh.tumblr.com
@@ -40,13 +40,11 @@ If you used the Windows installer, just re-run the `.msi` and it will give you
 an uninstall option.
 
 Some people, and somewhat rightfully so, get very upset when we tell you to
-`curl | sudo sh`. Basically, when you do this, you are trusting that the good
+`curl | sh`. Basically, when you do this, you are trusting that the good
 people who maintain Rust aren't going to hack your computer and do bad things.
 That's a good instinct! If you're one of those people, please check out the
 documentation on [building Rust from Source][from source], or [the official
-binary downloads][install page]. And we promise that this method will not be
-the way to install Rust forever: it's just the easiest way to keep people
-updated while Rust is in its alpha state.
+binary downloads][install page].
 
 [from source]: https://github.com/rust-lang/rust#building-from-source
 [install page]: http://www.rust-lang.org/install.html
diff --git a/src/doc/trpl/nightly-rust.md b/src/doc/trpl/nightly-rust.md
index 1cb62e8b2d3..2f3055deb04 100644
--- a/src/doc/trpl/nightly-rust.md
+++ b/src/doc/trpl/nightly-rust.md
@@ -9,16 +9,16 @@ process, see ‘[Stability as a deliverable][stability]’.
 To install nightly Rust, you can use `rustup.sh`:
 
 ```bash
-$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
+$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
 ```
 
 If you're concerned about the [potential insecurity][insecurity] of using `curl
-| sudo sh`, please keep reading and see our disclaimer below. And feel free to
+| sh`, please keep reading and see our disclaimer below. And feel free to
 use a two-step version of the installation and examine our installation script:
 
 ```bash
 $ curl -f -L https://static.rust-lang.org/rustup.sh -O
-$ sudo sh rustup.sh --channel=nightly
+$ sh rustup.sh --channel=nightly
 ```
 
 [insecurity]: http://curlpipesh.tumblr.com
@@ -43,13 +43,11 @@ If you used the Windows installer, just re-run the `.msi` and it will give you
 an uninstall option.
 
 Some people, and somewhat rightfully so, get very upset when we tell you to
-`curl | sudo sh`. Basically, when you do this, you are trusting that the good
+`curl | sh`. Basically, when you do this, you are trusting that the good
 people who maintain Rust aren't going to hack your computer and do bad things.
 That's a good instinct! If you're one of those people, please check out the
 documentation on [building Rust from Source][from source], or [the official
-binary downloads][install page]. And we promise that this method will not be
-the way to install Rust forever: it's just the easiest way to keep people
-updated while Rust is in its alpha state.
+binary downloads][install page].
 
 [from source]: https://github.com/rust-lang/rust#building-from-source
 [install page]: http://www.rust-lang.org/install.html
diff --git a/src/etc/extract_grammar.py b/src/etc/extract_grammar.py
deleted file mode 100755
index a12c3298cb3..00000000000
--- a/src/etc/extract_grammar.py
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# This script is for extracting the grammar from the rust docs.
-
-import fileinput
-
-collections = {"gram": [],
-               "keyword": [],
-               "reserved": [],
-               "binop": [],
-               "unop": []}
-
-
-in_coll = False
-coll = ""
-
-for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8")):
-    if in_coll:
-        if line.startswith("~~~~"):
-            in_coll = False
-        else:
-            if coll in ["keyword", "reserved", "binop", "unop"]:
-                for word in line.split():
-                    if word not in collections[coll]:
-                        collections[coll].append(word)
-            else:
-                collections[coll].append(line)
-
-    else:
-        if line.startswith("~~~~"):
-            for cname in collections:
-                if ("." + cname) in line:
-                    coll = cname
-                    in_coll = True
-                    break
-
-# Define operator symbol-names here
-
-tokens = ["non_star", "non_slash", "non_eol",
-          "non_single_quote", "non_double_quote", "ident"]
-
-symnames = {
-    ".": "dot",
-    "+": "plus",
-    "-": "minus",
-    "/": "slash",
-    "*": "star",
-    "%": "percent",
-
-    "~": "tilde",
-    "@": "at",
-
-    "!": "not",
-    "&": "and",
-    "|": "or",
-    "^": "xor",
-
-    "<<": "lsl",
-    ">>": "lsr",
-    ">>>": "asr",
-
-    "&&": "andand",
-    "||": "oror",
-
-    "<": "lt",
-    "<=": "le",
-    "==": "eqeq",
-    ">=": "ge",
-    ">": "gt",
-
-    "=": "eq",
-
-    "+=": "plusequal",
-    "-=": "minusequal",
-    "/=": "divequal",
-    "*=": "starequal",
-    "%=": "percentequal",
-
-    "&=": "andequal",
-    "|=": "orequal",
-    "^=": "xorequal",
-
-    ">>=": "lsrequal",
-    ">>>=": "asrequal",
-    "<<=": "lslequal",
-
-    "::": "coloncolon",
-
-    "->": "rightarrow",
-    "<-": "leftarrow",
-    "<->": "swaparrow",
-
-    "//": "linecomment",
-    "/*": "openblockcomment",
-    "*/": "closeblockcomment",
-    "macro_rules": "macro_rules",
-    "=>": "eg",
-    "..": "dotdot",
-    ",": "comma"
-}
-
-lines = []
-
-for line in collections["gram"]:
-    line2 = ""
-    for word in line.split():
-        # replace strings with keyword-names or symbol-names from table
-        if word.startswith("\""):
-            word = word[1:-1]
-            if word in symnames:
-                word = symnames[word]
-            else:
-                for ch in word:
-                    if not ch.isalpha():
-                        raise Exception("non-alpha apparent keyword: "
-                                        + word)
-                if word not in tokens:
-                    if (word in collections["keyword"] or
-                            word in collections["reserved"]):
-                        tokens.append(word)
-                    else:
-                        raise Exception("unknown keyword/reserved word: "
-                                        + word)
-
-        line2 += " " + word
-    lines.append(line2)
-
-
-for word in collections["keyword"] + collections["reserved"]:
-    if word not in tokens:
-        tokens.append(word)
-
-for sym in collections["unop"] + collections["binop"] + symnames.keys():
-    word = symnames[sym]
-    if word not in tokens:
-        tokens.append(word)
-
-
-print("%start parser, token;")
-print("%%token %s ;" % ("\n\t, ".join(tokens)))
-for coll in ["keyword", "reserved"]:
-    print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])))
-for coll in ["binop", "unop"]:
-    print("%s: %s ; " % (coll, "\n\t| ".join([symnames[x]
-                                              for x in collections[coll]])))
-print("\n".join(lines))
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index db9f526a0f2..38431ab5bf1 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -713,7 +713,7 @@ impl str {
     /// is skipped if empty.
     ///
     /// This method can be used for string data that is _terminated_,
-    /// rather than _seperated_ by a pattern.
+    /// rather than _separated_ by a pattern.
     ///
     /// # Iterator behavior
     ///
@@ -760,7 +760,7 @@ impl str {
     /// skipped if empty.
     ///
     /// This method can be used for string data that is _terminated_,
-    /// rather than _seperated_ by a pattern.
+    /// rather than _separated_ by a pattern.
     ///
     /// # Iterator behavior
     ///
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index ad5ed1c89cd..3c668f7fe9b 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -757,7 +757,7 @@ impl FromUtf8Error {
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn into_bytes(self) -> Vec<u8> { self.bytes }
 
-    /// Accesss the underlying UTF8-error that was the cause of this error.
+    /// Access the underlying UTF8-error that was the cause of this error.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn utf8_error(&self) -> Utf8Error { self.error }
 }
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 935648099a7..a2be8b81219 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -15,13 +15,13 @@
 //!
 //! # Examples
 //!
-//! Explicitly creating a `Vec<T>` with `new()`:
+//! You can explicitly create a `Vec<T>` with `new()`:
 //!
 //! ```
 //! let xs: Vec<i32> = Vec::new();
 //! ```
 //!
-//! Using the `vec!` macro:
+//! ...or by using the `vec!` macro:
 //!
 //! ```
 //! let ys: Vec<i32> = vec![];
@@ -29,7 +29,7 @@
 //! let zs = vec![1i32, 2, 3, 4, 5];
 //! ```
 //!
-//! Push:
+//! You can `push` values onto the end of a vector (which will grow the vector as needed):
 //!
 //! ```
 //! let mut xs = vec![1i32, 2];
@@ -37,13 +37,21 @@
 //! xs.push(3);
 //! ```
 //!
-//! And pop:
+//! Popping values works in much the same way:
 //!
 //! ```
 //! let mut xs = vec![1i32, 2];
 //!
 //! let two = xs.pop();
 //! ```
+//!
+//! Vectors also support indexing (through the `Index` and `IndexMut` traits):
+//!
+//! ```
+//! let mut xs = vec![1i32, 2, 3];
+//! let three = xs[2];
+//! xs[1] = xs[1] + 5;
+//! ```
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index d1bc24bd9ba..8da28094be3 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -161,7 +161,7 @@ use slice;
 // `Iterator` is an enumeration with one type parameter and two variants,
 // which basically means it must be `Option`.
 
-/// The `Option` type. See [the module level documentation](../index.html) for more.
+/// The `Option` type. See [the module level documentation](index.html) for more.
 #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub enum Option<T> {
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 6b65d746256..c9bbcba31e9 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -421,7 +421,7 @@ macro_rules! derive_pattern_clone {
 /// wrapping an private internal one that makes use of the `Pattern` API.
 ///
 /// For all patterns `P: Pattern<'a>` the following items will be
-/// generated (generics ommitted):
+/// generated (generics omitted):
 ///
 /// struct $forward_iterator($internal_iterator);
 /// struct $reverse_iterator($internal_iterator);
diff --git a/src/librustc/middle/infer/higher_ranked/mod.rs b/src/librustc/middle/infer/higher_ranked/mod.rs
index f347d28b93c..b0940aa7ec0 100644
--- a/src/librustc/middle/infer/higher_ranked/mod.rs
+++ b/src/librustc/middle/infer/higher_ranked/mod.rs
@@ -461,7 +461,7 @@ impl<'a,'tcx> InferCtxtExt for InferCtxt<'a,'tcx> {
 
 /// Constructs and returns a substitution that, for a given type
 /// scheme parameterized by `generics`, will replace every generic
-/// parmeter in the type with a skolemized type/region (which one can
+/// parameter in the type with a skolemized type/region (which one can
 /// think of as a "fresh constant", except at the type/region level of
 /// reasoning).
 ///
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 94071ff9190..c80dba6d1fb 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -1908,7 +1908,7 @@ pub enum Predicate<'tcx> {
 }
 
 impl<'tcx> Predicate<'tcx> {
-    /// Performs a substituion suitable for going from a
+    /// Performs a substitution suitable for going from a
     /// poly-trait-ref to supertraits that must hold if that
     /// poly-trait-ref holds. This is slightly different from a normal
     /// substitution in terms of what happens with bound regions.  See
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index f82c1653be1..eedda3cf437 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -212,8 +212,9 @@ fn test_resize_policy() {
 /// overridden with one of the constructors.
 ///
 /// It is required that the keys implement the `Eq` and `Hash` traits, although
-/// this can frequently be achieved by using `#[derive(Eq, Hash)]`. If you
-/// implement these yourself, it is important that the following property holds:
+/// this can frequently be achieved by using `#[derive(PartialEq, Eq, Hash)]`.
+/// If you implement these yourself, it is important that the following
+/// property holds:
 ///
 /// ```text
 /// k1 == k2 -> hash(k1) == hash(k2)
@@ -250,26 +251,26 @@ fn test_resize_policy() {
 /// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot.");
 ///
 /// // check for a specific one.
-/// if !book_reviews.contains_key(&("Les Misérables")) {
+/// if !book_reviews.contains_key("Les Misérables") {
 ///     println!("We've got {} reviews, but Les Misérables ain't one.",
 ///              book_reviews.len());
 /// }
 ///
 /// // oops, this review has a lot of spelling mistakes, let's delete it.
-/// book_reviews.remove(&("The Adventures of Sherlock Holmes"));
+/// book_reviews.remove("The Adventures of Sherlock Holmes");
 ///
 /// // look up the values associated with some keys.
 /// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"];
-/// for book in to_find.iter() {
+/// for book in &to_find {
 ///     match book_reviews.get(book) {
-///         Some(review) => println!("{}: {}", *book, *review),
-///         None => println!("{} is unreviewed.", *book)
+///         Some(review) => println!("{}: {}", book, review),
+///         None => println!("{} is unreviewed.", book)
 ///     }
 /// }
 ///
 /// // iterate over everything.
-/// for (book, review) in book_reviews.iter() {
-///     println!("{}: \"{}\"", *book, *review);
+/// for (book, review) in &book_reviews {
+///     println!("{}: \"{}\"", book, review);
 /// }
 /// ```
 ///
@@ -300,7 +301,7 @@ fn test_resize_policy() {
 /// vikings.insert(Viking::new("Harald", "Iceland"), 12);
 ///
 /// // Use derived implementation to print the status of the vikings.
-/// for (viking, health) in vikings.iter() {
+/// for (viking, health) in &vikings {
 ///     println!("{:?} has {} hp", viking, health);
 /// }
 /// ```
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index f7e43b38539..d6754f10335 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -31,10 +31,12 @@ use super::state::HashState;
 // to get rid of it properly.
 
 /// An implementation of a hash set using the underlying representation of a
-/// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
-/// requires that the elements implement the `Eq` and `Hash` traits. This can
-/// frequently be achieved by using `#[derive(Eq, Hash)]`. If you implement
-/// these yourself, it is important that the following property holds:
+/// HashMap where the value is ().
+///
+/// As with the `HashMap` type, a `HashSet` requires that the elements
+/// implement the `Eq` and `Hash` traits. This can frequently be achieved by
+/// using `#[derive(PartialEq, Eq, Hash)]`. If you implement these yourself,
+/// it is important that the following property holds:
 ///
 /// ```text
 /// k1 == k2 -> hash(k1) == hash(k2)
@@ -64,17 +66,17 @@ use super::state::HashState;
 /// books.insert("The Great Gatsby");
 ///
 /// // Check for a specific one.
-/// if !books.contains(&("The Winds of Winter")) {
+/// if !books.contains("The Winds of Winter") {
 ///     println!("We have {} books, but The Winds of Winter ain't one.",
 ///              books.len());
 /// }
 ///
 /// // Remove a book.
-/// books.remove(&"The Odyssey");
+/// books.remove("The Odyssey");
 ///
 /// // Iterate over everything.
-/// for book in books.iter() {
-///     println!("{}", *book);
+/// for book in &books {
+///     println!("{}", book);
 /// }
 /// ```
 ///
@@ -98,7 +100,7 @@ use super::state::HashState;
 /// vikings.insert(Viking { name: "Harald", power: 8 });
 ///
 /// // Use derived implementation to print the vikings.
-/// for x in vikings.iter() {
+/// for x in &vikings {
 ///     println!("{:?}", x);
 /// }
 /// ```
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index fcebe9c5e98..362296cd133 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -434,7 +434,7 @@ pub mod builtin {
 
     /// Parse the current given file as an expression.
     ///
-    /// This is generally a bad idea, because it's going to behave unhygenically.
+    /// This is generally a bad idea, because it's going to behave unhygienically.
     ///
     /// # Examples
     ///
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index bdf81d8cd6a..bc13d966a10 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -142,7 +142,8 @@ impl Ipv4Addr {
 
     /// Returns true if this address is in a range designated for documentation.
     ///
-    /// This is defined in RFC 5737
+    /// This is defined in RFC 5737:
+    ///
     /// - 192.0.2.0/24 (TEST-NET-1)
     /// - 198.51.100.0/24 (TEST-NET-2)
     /// - 203.0.113.0/24 (TEST-NET-3)
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 2ceb60cc3aa..8ccc387c902 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -358,7 +358,7 @@ pub fn is_separator(c: char) -> bool {
     c.is_ascii() && is_sep_byte(c as u8)
 }
 
-/// The primary sperator for the current platform
+/// The primary separator for the current platform
 #[stable(feature = "rust1", since = "1.0.0")]
 pub const MAIN_SEPARATOR: char = platform::MAIN_SEP;
 
diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs
index 2e4ed38e50f..39910f509f9 100644
--- a/src/libstd/sys/unix/ext/fs.rs
+++ b/src/libstd/sys/unix/ext/fs.rs
@@ -138,11 +138,11 @@ impl Metadata {
     pub fn rdev(&self) -> raw::dev_t { self.0.raw().st_rdev as raw::dev_t }
     pub fn size(&self) -> raw::off_t { self.0.raw().st_size as raw::off_t }
     pub fn atime(&self) -> raw::time_t { self.0.raw().st_atime }
-    pub fn atime_nsec(&self) -> c_long { self.0.raw().st_atime }
+    pub fn atime_nsec(&self) -> c_long { self.0.raw().st_atime_nsec as c_long }
     pub fn mtime(&self) -> raw::time_t { self.0.raw().st_mtime }
-    pub fn mtime_nsec(&self) -> c_long { self.0.raw().st_mtime }
+    pub fn mtime_nsec(&self) -> c_long { self.0.raw().st_mtime_nsec as c_long }
     pub fn ctime(&self) -> raw::time_t { self.0.raw().st_ctime }
-    pub fn ctime_nsec(&self) -> c_long { self.0.raw().st_ctime }
+    pub fn ctime_nsec(&self) -> c_long { self.0.raw().st_ctime_nsec as c_long }
 
     pub fn blksize(&self) -> raw::blksize_t {
         self.0.raw().st_blksize as raw::blksize_t
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 3b7bfb1043a..e00cb82649b 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -595,7 +595,7 @@ pub enum Pat_ {
 
     /// An associated const named using the qualified path `<T>::CONST` or
     /// `<T as Trait>::CONST`. Associated consts from inherent impls can be
-    /// refered to as simply `T::CONST`, in which case they will end up as
+    /// referred to as simply `T::CONST`, in which case they will end up as
     /// PatEnum, and the resolver will have to sort that out.
     PatQPath(QSelf, Path),
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 87c164f7550..5c1f6cc12f5 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -903,10 +903,10 @@ impl<'a> State<'a> {
                 try!(self.print_generics(params));
                 try!(self.end()); // end the inner ibox
 
+                try!(self.print_where_clause(&params.where_clause));
                 try!(space(&mut self.s));
                 try!(self.word_space("="));
                 try!(self.print_type(&**ty));
-                try!(self.print_where_clause(&params.where_clause));
                 try!(word(&mut self.s, ";"));
                 try!(self.end()); // end the outer ibox
             }
diff --git a/src/test/pretty/issue-25031.rs b/src/test/pretty/issue-25031.rs
new file mode 100644
index 00000000000..6c5a847869e
--- /dev/null
+++ b/src/test/pretty/issue-25031.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// Testing that type items with where clauses output correctly.
+
+// pp-exact
+
+fn main() {
+    type Foo<T> where T: Copy = Box<T>;
+}