about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-10-28 09:42:38 +0000
committerbors <bors@rust-lang.org>2017-10-28 09:42:38 +0000
commit7da9a5e178e28b2e387e6296aa1b0289acdf5781 (patch)
tree5af983a3ac9c36e9597311604c6376c975f21b7e
parent75277c72c0c6f603bb258383ad74d3082dc4a720 (diff)
parent0b0237761458d634b9082d4f863bbe18c64349e7 (diff)
downloadrust-7da9a5e178e28b2e387e6296aa1b0289acdf5781.tar.gz
rust-7da9a5e178e28b2e387e6296aa1b0289acdf5781.zip
Auto merge of #45589 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

- Successful merges: #45421, #45449, #45505, #45535, #45549, #45574, #45585
- Failed merges:
-rw-r--r--src/Cargo.lock17
-rw-r--r--src/bootstrap/flags.rs7
-rw-r--r--src/doc/unstable-book/src/language-features/on-unimplemented.md8
-rw-r--r--src/librustc/diagnostics.rs12
-rw-r--r--src/librustc/session/mod.rs7
-rw-r--r--src/librustdoc/Cargo.toml2
-rw-r--r--src/librustdoc/html/markdown.rs6
-rw-r--r--src/libstd/net/udp.rs37
8 files changed, 54 insertions, 42 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index c09bd6096a3..d762b96d05c 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -111,11 +111,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "bitflags"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "bitflags"
 version = "0.9.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
@@ -1320,14 +1315,6 @@ dependencies = [
 
 [[package]]
 name = "pulldown-cmark"
-version = "0.0.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "pulldown-cmark"
 version = "0.0.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
@@ -1945,7 +1932,7 @@ dependencies = [
  "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "html-diff 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "pulldown-cmark 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -2624,7 +2611,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983"
 "checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661"
 "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
-"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4"
 "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
 "checksum bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cde24d1b2e2216a726368b2363a273739c91f4e3eb4e0dd12d672d396ad989"
 "checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
@@ -2729,7 +2715,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
 "checksum procedural-masquerade 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9ae21842e88415394f6b6fccf1f4af4c98a5bfb3eab92188f2e83409cda0c995"
 "checksum psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "abcd5d1a07d360e29727f757a9decb3ce8bc6e0efa8969cfaad669a8317a2478"
-"checksum pulldown-cmark 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ab1e588ef8efd702c7ed9d2bd774db5e6f4d878bb5a1a9f371828fbdff6973"
 "checksum pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "378e941dbd392c101f2cb88097fa4d7167bc421d4b88de3ff7dbee503bc3233b"
 "checksum pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a656fdb8b6848f896df5e478a0eb9083681663e37dcb77dd16981ff65329fe8b"
 "checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4"
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index df378188b4a..b5d51598fab 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -136,9 +136,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
         let subcommand = match subcommand {
             Some(s) => s,
             None => {
-                // No subcommand -- show the general usage and subcommand help
+                // No or an invalid subcommand -- show the general usage and subcommand help
+                // An exit code will be 0 when no subcommand is given, and 1 in case of an invalid
+                // subcommand.
                 println!("{}\n", subcommand_help);
-                process::exit(1);
+                let exit_code = if args.is_empty() { 0 } else { 1 };
+                process::exit(exit_code);
             }
         };
 
diff --git a/src/doc/unstable-book/src/language-features/on-unimplemented.md b/src/doc/unstable-book/src/language-features/on-unimplemented.md
index 9eea3fccbbc..70c7c110b78 100644
--- a/src/doc/unstable-book/src/language-features/on-unimplemented.md
+++ b/src/doc/unstable-book/src/language-features/on-unimplemented.md
@@ -15,8 +15,8 @@ For example:
 ```rust,compile_fail
 #![feature(on_unimplemented)]
 
-#[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an \
-                          iterator over elements of type `{A}`"]
+#[rustc_on_unimplemented="an iterator over elements of type `{A}` \
+    cannot be built from a collection of type `{Self}`"]
 trait MyIterator<A> {
     fn next(&mut self) -> A;
 }
@@ -37,9 +37,9 @@ error[E0277]: the trait bound `&[{integer}]: MyIterator<char>` is not satisfied
   --> <anon>:14:5
    |
 14 |     iterate_chars(&[1, 2, 3][..]);
-   |     ^^^^^^^^^^^^^ the trait `MyIterator<char>` is not implemented for `&[{integer}]`
+   |     ^^^^^^^^^^^^^ an iterator over elements of type `char` cannot be built from a collection of type `&[{integer}]`
    |
-   = note: a collection of type `&[{integer}]` cannot be built from an iterator over elements of type `char`
+   = help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
    = note: required by `iterate_chars`
 
 error: aborting due to previous error
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 26f56ffacae..2b6e1d85568 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -401,16 +401,6 @@ fn bar(x: &str, y: &str) -> &str { }
 fn baz<'a>(x: &'a str, y: &str) -> &str { }
 ```
 
-Here's an example that is currently an error, but may work in a future version
-of Rust:
-
-```compile_fail,E0106
-struct Foo<'a>(&'a str);
-
-trait Quux { }
-impl Quux for Foo { }
-```
-
 Lifetime elision in implementation headers was part of the lifetime elision
 RFC. It is, however, [currently unimplemented][iss15872].
 
@@ -1875,7 +1865,7 @@ fn main() {
 "##,
 
 E0601: r##"
-No `main` function was found in a binary crate. To fix this error, just add a
+No `main` function was found in a binary crate. To fix this error, add a
 `main` function. For example:
 
 ```
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 42c633dc83f..c87881341da 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -776,7 +776,12 @@ pub fn build_session_(sopts: config::Options,
     let print_fuel_crate = sopts.debugging_opts.print_fuel.clone();
     let print_fuel = Cell::new(0);
 
-    let working_dir = env::current_dir().unwrap().to_string_lossy().into_owned();
+    let working_dir = match env::current_dir() {
+        Ok(dir) => dir.to_string_lossy().into_owned(),
+        Err(e) => {
+            panic!(p_s.span_diagnostic.fatal(&format!("Current directory is invalid: {}", e)))
+        }
+    };
     let working_dir = file_path_mapping.map_prefix(working_dir);
 
     let sess = Session {
diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml
index e168222058f..988cc084335 100644
--- a/src/librustdoc/Cargo.toml
+++ b/src/librustdoc/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
 [dependencies]
 env_logger = { version = "0.4", default-features = false }
 log = "0.3"
-pulldown-cmark = { version = "0.0.14", default-features = false }
+pulldown-cmark = { version = "0.1.0", default-features = false }
 html-diff = "0.0.4"
 
 [build-dependencies]
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 80d1f0b01cc..001e773098e 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -371,7 +371,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
             match self.inner.next() {
                 Some(Event::FootnoteReference(ref reference)) => {
                     let entry = self.get_entry(&reference);
-                    let reference = format!("<sup id=\"supref{0}\"><a href=\"#ref{0}\">{0}\
+                    let reference = format!("<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{0}\
                                              </a></sup>",
                                             (*entry).1);
                     return Some(Event::Html(reference.into()));
@@ -394,7 +394,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
                         v.sort_by(|a, b| a.1.cmp(&b.1));
                         let mut ret = String::from("<div class=\"footnotes\"><hr><ol>");
                         for (mut content, id) in v {
-                            write!(ret, "<li id=\"ref{}\">", id).unwrap();
+                            write!(ret, "<li id=\"fn{}\">", id).unwrap();
                             let mut is_paragraph = false;
                             if let Some(&Event::End(Tag::Paragraph)) = content.last() {
                                 content.pop();
@@ -402,7 +402,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
                             }
                             html::push_html(&mut ret, content.into_iter());
                             write!(ret,
-                                   "&nbsp;<a href=\"#supref{}\" rev=\"footnote\">↩</a>",
+                                   "&nbsp;<a href=\"#fnref{}\" rev=\"footnote\">↩</a>",
                                    id).unwrap();
                             if is_paragraph {
                                 ret.push_str("</p>");
diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs
index 870d11298fe..84ceaa65951 100644
--- a/src/libstd/net/udp.rs
+++ b/src/libstd/net/udp.rs
@@ -721,16 +721,45 @@ impl UdpSocket {
 
     /// Moves this UDP socket into or out of nonblocking mode.
     ///
-    /// On Unix this corresponds to calling fcntl, and on Windows this
-    /// corresponds to calling ioctlsocket.
+    /// This will result in `recv`, `recv_from`, `send`, and `send_to`
+    /// operations becoming nonblocking, i.e. immediately returning from their
+    /// calls. If the IO operation is successful, `Ok` is returned and no
+    /// further action is required. If the IO operation could not be completed
+    /// and needs to be retried, an error with kind
+    /// [`io::ErrorKind::WouldBlock`] is returned.
+    ///
+    /// On Unix platforms, calling this method corresponds to calling `fcntl`
+    /// `FIONBIO`. On Windows calling this method corresponds to calling
+    /// `ioctlsocket` `FIONBIO`.
+    ///
+    /// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock
     ///
     /// # Examples
     ///
+    /// Create a UDP socket bound to `127.0.0.1:7878` and read bytes in
+    /// nonblocking mode:
+    ///
     /// ```no_run
+    /// use std::io;
     /// use std::net::UdpSocket;
     ///
-    /// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
-    /// socket.set_nonblocking(true).expect("set_nonblocking call failed");
+    /// let socket = UdpSocket::bind("127.0.0.1:7878").unwrap();
+    /// socket.set_nonblocking(true).unwrap();
+    ///
+    /// # fn wait_for_fd() { unimplemented!() }
+    /// let mut buf = [0; 10];
+    /// let (num_bytes_read, _) = loop {
+    ///     match socket.recv_from(&mut buf) {
+    ///         Ok(n) => break n,
+    ///         Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
+    ///             // wait until network socket is ready, typically implemented
+    ///             // via platform-specific APIs such as epoll or IOCP
+    ///             wait_for_fd();
+    ///         }
+    ///         Err(e) => panic!("encountered IO error: {}", e),
+    ///     }
+    /// };
+    /// println!("bytes: {:?}", &buf[..num_bytes_read]);
     /// ```
     #[stable(feature = "net2_mutators", since = "1.9.0")]
     pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {