No bug - Revendor rust dependencies
authorServo VCS Sync <servo-vcs-sync@mozilla.com>
Fri, 06 Apr 2018 13:23:37 +0000
changeset 412112 3c5dbe504e151a4f29033403fc8e7b746ab5e06d
parent 412111 466539192a40c3b529be848923d799385b73b2a0
child 412113 effaf62f3423dfed70794254fa613f3cdfcfe9f4
push id33784
push usernerli@mozilla.com
push dateFri, 06 Apr 2018 21:54:36 +0000
treeherdermozilla-central@0e0ec6c01e25 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
No bug - Revendor rust dependencies
Cargo.lock
third_party/rust/same-file/.cargo-checksum.json
third_party/rust/same-file/.travis.yml
third_party/rust/same-file/Cargo.toml
third_party/rust/same-file/README.md
third_party/rust/same-file/examples/is_same_file.rs
third_party/rust/same-file/examples/is_stderr.rs
third_party/rust/same-file/src/lib.rs
third_party/rust/same-file/src/unix.rs
third_party/rust/same-file/src/win.rs
third_party/rust/walkdir/.cargo-checksum.json
third_party/rust/walkdir/.travis.yml
third_party/rust/walkdir/Cargo.toml
third_party/rust/walkdir/README.md
third_party/rust/walkdir/examples/walkdir.rs
third_party/rust/walkdir/src/lib.rs
third_party/rust/walkdir/src/tests.rs
third_party/rust/walkdir/src/unix.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1687,21 +1687,20 @@ source = "registry+https://github.com/ru
 
 [[package]]
 name = "safemem"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "same-file"
-version = "0.1.3"
+version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "scoped-tls"
 version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -1893,17 +1892,17 @@ dependencies = [
  "style_derive 0.0.1",
  "style_traits 0.0.1",
  "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "uluru 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "style_derive"
 version = "0.0.1"
 dependencies = [
  "darling 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2234,22 +2233,21 @@ source = "registry+https://github.com/ru
 
 [[package]]
 name = "void"
 version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "walkdir"
-version = "1.0.7"
+version = "2.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "webdriver"
 version = "0.35.0"
 dependencies = [
  "cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2613,17 +2611,17 @@ dependencies = [
 "checksum redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "ab105df655884ede59d45b7070c8a65002d921461ee813a024558ca16030eea0"
 "checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
 "checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
 "checksum ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "da06feaa07f69125ab9ddc769b11de29090122170b402547f64b86fe16ebc399"
 "checksum runloop 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d79b4b604167921892e84afbbaad9d5ad74e091bf6c511d9dbfb0593f09fabd"
 "checksum rust-ini 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "22dab655e8122ccb15db25a56852ce62506f1486cdefd37e86371bf34ea8f601"
 "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
 "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
-"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
+"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"
 "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
 "checksum scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c79eb2c3ac4bc2507cda80e7f3ac5b88bd8eae4c0914d5663e6a8933994be918"
 "checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
 "checksum serde 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "800fdb0a894572994f3970035a8a5f65d8ec2cd40e6cdf7d8cd9001d7b30648e"
 "checksum serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "adb6e51a6b3696b301bc221d785f898b4457c619b51d7ce195a6d20baecb37b3"
 "checksum serde_derive 1.0.35 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)" = "<none>"
 "checksum serde_derive_internals 0.22.1 (git+https://github.com/servo/serde?branch=deserialize_from_enums5)" = "<none>"
@@ -2667,17 +2665,17 @@ dependencies = [
 "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
 "checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
 "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
 "checksum uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "78c590b5bd79ed10aad8fb75f078a59d8db445af6c743e55c4a53227fc01c13f"
 "checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
 "checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
 "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
 "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
-"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
+"checksum walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369"
 "checksum webidl 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc14e4b71f94b5bb4c6d696e3b3be4d2e9ee6750a60870ecae09ff7138a131a7"
 "checksum which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4be6cfa54dab45266e98b5d7be2f8ce959ddd49abd141a05d52dce4b07f803bb"
 "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
 "checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
 "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767"
--- a/third_party/rust/same-file/.cargo-checksum.json
+++ b/third_party/rust/same-file/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"6a895f292f66275f93130c18595c210654778e113779143a3d3b14b37979053b","COPYING":"7ca1297d23644e30bd489193a82a33f324e5fe33f25df4195649b91b883df967","Cargo.toml":"6191fe9baeaa414b5339d7c248ed277d0eefc387e1919c5c27eced327f1f63e0","README.md":"dbedb77a4c03aaddce2e907fcbfb0af4ddc1dd6074f48403040e2cb010df9c67","appveyor.yml":"d273c4f1531255fc19b5808f951159c797a934bf444b7a2f0e8adb6d35f2076b","examples/is_same_file.rs":"08a34217f72b7b48e1cdb7490555af15e758e95777bf9d4a1799c652fdcfec14","examples/is_stderr.rs":"a2fbe307c47a3c1da5d83b69524561d780e4f6c05deff3c71cd161dc41c23503","src/lib.rs":"41df53e6e0524025d69f279ddc6a25e80709f7e482e1ddd80bb7cd4e8ac187a5","src/unix.rs":"530b43f42c94791c8860cf94d3f97440f2ba08efc44281e9f4a3df086e2cc770","src/win.rs":"6440fc7a9c1391c9423016f5437b1e925867f172b668124b12d36a5e6f33f053"},"package":"d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"}
\ No newline at end of file
+{"files":{".travis.yml":"cafb96675fff81a04a3c01278a87480fa45069a3f83bf3ec60089b1ee1973283","COPYING":"7ca1297d23644e30bd489193a82a33f324e5fe33f25df4195649b91b883df967","Cargo.toml":"ce5e3df16b1d2d7b4a6ff8f281105e51bc044d103b7f0007a19dd7fe2bc68d67","README.md":"ac8eb57fecc2fe81dfd97ceb2c6b04db0e0af7a097508d407c248dca51fe38af","appveyor.yml":"d273c4f1531255fc19b5808f951159c797a934bf444b7a2f0e8adb6d35f2076b","examples/is_same_file.rs":"f8fdd8870bf508268dfa0505deaec55bc64fc0e7cd9e527b5a7581a06313b8cb","examples/is_stderr.rs":"3646a0eb120ded24c5fba612ab77866ae987ae8b6d1925a139d3ea572adfa298","src/lib.rs":"682661b425e0d1a5161097171bde840efcae85c8814acdf0231b00b1dfd46e02","src/unix.rs":"f3b74e112d372378dc57c1ac42e64958c9b7d35ea8ac306025387e96178723b5","src/win.rs":"2f588a9dd0ca69bf1699896e7b732b52eaf9159d1fc2a5959bb8c6c4bd72da69"},"package":"cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"}
\ No newline at end of file
--- a/third_party/rust/same-file/.travis.yml
+++ b/third_party/rust/same-file/.travis.yml
@@ -1,14 +1,22 @@
+dist: trusty
 language: rust
-rust:
-  - 1.10.0
-  - stable
-  - beta
-  - nightly
+matrix:
+  include:
+    - os: linux
+      rust: 1.17.0
+    - os: linux
+      rust: stable
+    - os: linux
+      rust: beta
+    - os: linux
+      rust: nightly
+    - os: osx
+      rust: nightly
 script:
   - cargo build --verbose
   - cargo test --verbose
   - cargo doc
   - if [ "$TRAVIS_RUST_VERSION" = "nightly" ]; then
       cargo bench --verbose;
     fi
 branches:
--- a/third_party/rust/same-file/Cargo.toml
+++ b/third_party/rust/same-file/Cargo.toml
@@ -1,20 +1,28 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "same-file"
-version = "0.1.3"  #:version
+version = "1.0.2"
 authors = ["Andrew Gallant <jamslam@gmail.com>"]
-description = """
-A simple crate for determining whether two file paths point to the same file.
-"""
+description = "A simple crate for determining whether two file paths point to the same file.\n"
+homepage = "https://github.com/BurntSushi/same-file"
 documentation = "https://docs.rs/same-file"
-homepage = "https://github.com/BurntSushi/same-file"
-repository = "https://github.com/BurntSushi/same-file"
 readme = "README.md"
 keywords = ["same", "file", "equal", "inode"]
 license = "Unlicense/MIT"
-
-[target.'cfg(windows)'.dependencies]
-kernel32-sys = "0.2"
-winapi = "0.2"
-
-[dev-dependencies]
-rand = "0.3"
+repository = "https://github.com/BurntSushi/same-file"
+[dev-dependencies.rand]
+version = "0.4"
+[target."cfg(windows)".dependencies.winapi]
+version = "0.3"
+features = ["std", "fileapi", "minwindef", "processenv", "winbase"]
--- a/third_party/rust/same-file/README.md
+++ b/third_party/rust/same-file/README.md
@@ -14,17 +14,17 @@ Dual-licensed under MIT or the [UNLICENS
 https://docs.rs/same-file
 
 ### Usage
 
 Add this to your `Cargo.toml`:
 
 ```toml
 [dependencies]
-same-file = "0.1"
+same-file = "1"
 ```
 
 and this to your crate root:
 
 ```rust
 extern crate same_file;
 ```
 
--- a/third_party/rust/same-file/examples/is_same_file.rs
+++ b/third_party/rust/same-file/examples/is_same_file.rs
@@ -1,7 +1,13 @@
 extern crate same_file;
 
+use std::error::Error;
 use same_file::is_same_file;
 
+fn try_main() -> Result<(), Box<Error>> {
+    assert!(is_same_file("/bin/sh", "/usr/bin/sh")?);
+    Ok(()) 
+}
+
 fn main() {
-    assert!(is_same_file("/bin/sh", "/usr/bin/sh").unwrap());
+    try_main().unwrap();
 }
--- a/third_party/rust/same-file/examples/is_stderr.rs
+++ b/third_party/rust/same-file/examples/is_stderr.rs
@@ -15,19 +15,19 @@ fn main() {
 fn run() -> io::Result<()> {
     // Run with `cargo run is_stderr 2> examples/stderr` to see
     // interesting output.
     let candidates = &[
         "examples/is_same_file.rs",
         "examples/is_stderr.rs",
         "examples/stderr",
     ];
-    let stderr_handle = try!(Handle::stderr());
+    let stderr_handle = Handle::stderr()?;
     for candidate in candidates {
-        let handle = try!(Handle::from_path(candidate));
+        let handle = Handle::from_path(candidate)?;
         if stderr_handle == handle {
             println!("{:?} is stderr!", candidate);
         } else {
             println!("{:?} is NOT stderr!", candidate);
         }
     }
     Ok(())
 }
--- a/third_party/rust/same-file/src/lib.rs
+++ b/third_party/rust/same-file/src/lib.rs
@@ -1,61 +1,79 @@
 /*!
 This crate provides a safe and simple **cross platform** way to determine
 whether two file paths refer to the same file or directory.
 
-Most uses of this crate should be limited to the top-level `is_same_file`
+Most uses of this crate should be limited to the top-level [`is_same_file`]
 function, which takes two file paths and returns true if they refer to the
 same file or directory:
 
 ```rust,no_run
-# fn example() -> ::std::io::Result<()> {
+# use std::error::Error;
 use same_file::is_same_file;
 
-assert!(try!(is_same_file("/bin/sh", "/usr/bin/sh")));
-# Ok(()) } example().unwrap();
+# fn try_main() -> Result<(), Box<Error>> {
+assert!(is_same_file("/bin/sh", "/usr/bin/sh")?);
+#    Ok(())
+# }
+#
+# fn main() {
+#    try_main().unwrap();
+# }
 ```
 
-Additionally, this crate provides a `Handle` type that permits a more efficient
+Additionally, this crate provides a [`Handle`] type that permits a more efficient
 equality check depending on your access pattern. For example, if one wanted to
-checked whether any path in a list of paths corresponded to the process' stdout
+check whether any path in a list of paths corresponded to the process' stdout
 handle, then one could build a handle once for stdout. The equality check for
 each file in the list then only requires one stat call instead of two. The code
 might look like this:
 
 ```rust,no_run
-# fn example() -> ::std::io::Result<()> {
+# use std::error::Error;
 use same_file::Handle;
 
+# fn try_main() -> Result<(), Box<Error>> {
 let candidates = &[
     "examples/is_same_file.rs",
     "examples/is_stderr.rs",
     "examples/stderr",
 ];
-let stdout_handle = try!(Handle::stdout());
+let stdout_handle = Handle::stdout()?;
 for candidate in candidates {
-    let handle = try!(Handle::from_path(candidate));
+    let handle = Handle::from_path(candidate)?;
     if stdout_handle == handle {
         println!("{:?} is stdout!", candidate);
     } else {
         println!("{:?} is NOT stdout!", candidate);
     }
 }
-# Ok(()) } example().unwrap();
+#    Ok(())
+# }
+#
+# fn main() {
+#     try_main().unwrap();
+# }
 ```
 
-See `examples/is_stderr.rs` for a runnable example. Compare the output of
-`cargo run is_stderr 2> examples/stderr` and `cargo run is_stderr`.
+See [`examples/is_stderr.rs`] for a runnable example and compare the output of:
+
+- `cargo run is_stderr 2> examples/stderr` and
+- `cargo run is_stderr`.
+
+[`is_same_file`]: fn.is_same_file.html
+[`Handle`]: struct.Handle.html
+[`examples/is_stderr.rs`]: https://github.com/BurntSushi/same-file/blob/master/examples/is_same_file.rs
+
 */
 
+#![doc(html_root_url = "https://docs.rs/same-file/1.0.0")]
 #![deny(missing_docs)]
 
 #[cfg(windows)]
-extern crate kernel32;
-#[cfg(windows)]
 extern crate winapi;
 
 use std::fs::File;
 use std::io;
 use std::path::Path;
 
 #[cfg(any(target_os = "redox", unix))]
 use unix as imp;
@@ -70,95 +88,291 @@ mod win;
 /// A handle to a file that can be tested for equality with other handles.
 ///
 /// If two files are the same, then any two handles of those files will compare
 /// equal. If two files are not the same, then any two handles of those files
 /// will compare not-equal.
 ///
 /// A handle consumes an open file resource as long as it exists.
 ///
-/// Note that it's possible for comparing two handles to produce a false
-/// positive on some platforms. Namely, two handles can compare equal even if
-/// the two handles *don't* point to the same file.
+/// Equality is determined by comparing inode numbers on Unix and a combination
+/// of identifier, volume serial, and file size on Windows. Note that it's
+/// possible for comparing two handles to produce a false positive on some
+/// platforms. Namely, two handles can compare equal even if the two handles
+/// *don't* point to the same file. Check the [source] for specific
+/// implementation details.
+///
+/// [source]: https://github.com/BurntSushi/same-file/tree/master/src
 #[derive(Debug, Eq, PartialEq)]
 pub struct Handle(imp::Handle);
 
 impl Handle {
     /// Construct a handle from a path.
     ///
-    /// Note that the underlying `File` is opened in read-only mode on all
+    /// Note that the underlying [`File`] is opened in read-only mode on all
     /// platforms.
+    ///
+    /// [`File`]: https://doc.rust-lang.org/std/fs/struct.File.html
+    ///
+    /// # Errors
+    /// This method will return an [`io::Error`] if the path cannot
+    /// be opened, or the file's metadata cannot be obtained.
+    /// The most common reasons for this are: the path does not
+    /// exist, or there were not enough permissions.
+    ///
+    /// [`io::Error`]: https://doc.rust-lang.org/std/io/struct.Error.html
+    ///
+    /// # Examples
+    /// Check that two paths are not the same file:
+    ///
+    /// ```rust,no_run
+    /// # use std::error::Error;
+    /// use same_file::Handle;
+    ///
+    /// # fn try_main() -> Result<(), Box<Error>> {
+    /// let source = Handle::from_path("./source")?;
+    /// let target = Handle::from_path("./target")?;
+    /// assert_ne!(source, target, "The files are the same.");
+    /// # Ok(())
+    /// # }
+    /// #
+    /// # fn main() {
+    /// #     try_main().unwrap();
+    /// # }
+    /// ```
     pub fn from_path<P: AsRef<Path>>(p: P) -> io::Result<Handle> {
         imp::Handle::from_path(p).map(Handle)
     }
 
     /// Construct a handle from a file.
+    ///
+    /// # Errors
+    /// This method will return an [`io::Error`] if the metadata for
+    /// the given [`File`] cannot be obtained.
+    ///
+    /// [`io::Error`]: https://doc.rust-lang.org/std/io/struct.Error.html
+    /// [`File`]: https://doc.rust-lang.org/std/fs/struct.File.html
+    ///
+    /// # Examples
+    /// Check that two files are not in fact the same file:
+    ///
+    /// ```rust,no_run
+    /// # use std::error::Error;
+    /// # use std::fs::File;
+    /// use same_file::Handle;
+    ///
+    /// # fn try_main() -> Result<(), Box<Error>> {
+    /// let source = File::open("./source")?;
+    /// let target = File::open("./target")?;
+    ///
+    /// assert_ne!(
+    ///     Handle::from_file(source)?,
+    ///     Handle::from_file(target)?,
+    ///     "The files are the same."
+    /// );
+    /// #     Ok(())
+    /// # }
+    /// #
+    /// # fn main() {
+    /// #     try_main().unwrap();
+    /// # }
+    /// ```
     pub fn from_file(file: File) -> io::Result<Handle> {
         imp::Handle::from_file(file).map(Handle)
     }
 
     /// Construct a handle from stdin.
+    ///
+    /// # Errors
+    /// This method will return an [`io::Error`] if stdin cannot
+    /// be opened due to any I/O-related reason.
+    ///
+    /// [`io::Error`]: https://doc.rust-lang.org/std/io/struct.Error.html
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// # use std::error::Error;
+    /// use same_file::Handle;
+    ///
+    /// # fn try_main() -> Result<(), Box<Error>> {
+    /// let stdin = Handle::stdin()?;
+    /// let stdout = Handle::stdout()?;
+    /// let stderr = Handle::stderr()?;
+    ///
+    /// if stdin == stdout {
+    ///     println!("stdin == stdout");
+    /// }
+    /// if stdin == stderr {
+    ///     println!("stdin == stderr");
+    /// }
+    /// if stdout == stderr {
+    ///     println!("stdout == stderr");
+    /// }
+    /// #
+    /// #     Ok(())
+    /// # }
+    /// #
+    /// # fn main() {
+    /// #     try_main().unwrap();
+    /// # }
+    /// ```
+    ///
+    /// The output differs depending on the platform.
+    ///
+    /// On Linux:
+    ///
+    /// ```text
+    /// $ ./example
+    /// stdin == stdout
+    /// stdin == stderr
+    /// stdout == stderr
+    /// $ ./example > result
+    /// $ cat result
+    /// stdin == stderr
+    /// $ ./example > result 2>&1
+    /// $ cat result
+    /// stdout == stderr
+    /// ```
+    ///
+    /// Windows:
+    ///
+    /// ```text
+    /// > example
+    /// > example > result 2>&1
+    /// > type result
+    /// stdout == stderr
+    /// ```
     pub fn stdin() -> io::Result<Handle> {
         imp::Handle::stdin().map(Handle)
     }
 
     /// Construct a handle from stdout.
+    ///
+    /// # Errors
+    /// This method will return an [`io::Error`] if stdout cannot
+    /// be opened due to any I/O-related reason.
+    ///
+    /// [`io::Error`]: https://doc.rust-lang.org/std/io/struct.Error.html
+    ///
+    /// # Examples
+    /// See the example for [`stdin()`].
+    ///
+    /// [`stdin()`]: #method.stdin
     pub fn stdout() -> io::Result<Handle> {
         imp::Handle::stdout().map(Handle)
     }
 
     /// Construct a handle from stderr.
+    ///
+    /// # Errors
+    /// This method will return an [`io::Error`] if stderr cannot
+    /// be opened due to any I/O-related reason.
+    ///
+    /// [`io::Error`]: https://doc.rust-lang.org/std/io/struct.Error.html
+    ///
+    /// # Examples
+    /// See the example for [`stdin()`].
+    ///
+    /// [`stdin()`]: #method.stdin
     pub fn stderr() -> io::Result<Handle> {
         imp::Handle::stderr().map(Handle)
     }
 
     /// Return a reference to the underlying file.
+    ///
+    /// # Examples
+    /// Ensure that the target file is not the same as the source one,
+    /// and copy the data to it:
+    ///
+    /// ```rust,no_run
+    /// # use std::error::Error;
+    /// use std::io::prelude::*;
+    /// use std::io::Write;
+    /// use std::fs::File;
+    /// use same_file::Handle;
+    ///
+    /// # fn try_main() -> Result<(), Box<Error>> {
+    /// let source = File::open("source")?;
+    /// let target = File::create("target")?;
+    ///
+    /// let source_handle = Handle::from_file(source)?;
+    /// let mut target_handle = Handle::from_file(target)?;
+    /// assert_ne!(source_handle, target_handle, "The files are the same.");
+    ///
+    /// let mut source = source_handle.as_file();
+    /// let target = target_handle.as_file_mut();
+    ///
+    /// let mut buffer = Vec::new();
+    /// // data copy is simplified for the purposes of the example
+    /// source.read_to_end(&mut buffer)?;
+    /// target.write_all(&buffer)?;
+    /// #
+    /// #    Ok(())
+    /// # }
+    /// #
+    /// # fn main() {
+    /// #    try_main().unwrap();
+    /// # }
+    /// ```
     pub fn as_file(&self) -> &File {
         self.0.as_file()
     }
 
     /// Return a mutable reference to the underlying file.
+    ///
+    /// # Examples
+    /// See the example for [`as_file()`].
+    ///
+    /// [`as_file()`]: #method.as_file
     pub fn as_file_mut(&mut self) -> &mut File {
         self.0.as_file_mut()
     }
 
     /// Return the underlying device number of this handle.
+    ///
+    /// Note that this only works on unix platforms.
     #[cfg(any(target_os = "redox", unix))]
     pub fn dev(&self) -> u64 {
         self.0.dev()
     }
 
     /// Return the underlying inode number of this handle.
+    ///
+    /// Note that this only works on unix platforms.
     #[cfg(any(target_os = "redox", unix))]
     pub fn ino(&self) -> u64 {
         self.0.ino()
     }
 }
 
 /// Returns true if the two file paths may correspond to the same file.
 ///
-/// If there was a problem accessing either file path, then an error is
-/// returned.
-///
 /// Note that it's possible for this to produce a false positive on some
 /// platforms. Namely, this can return true even if the two file paths *don't*
 /// resolve to the same file.
+/// # Errors
+/// This function will return an [`io::Error`] if any of the two paths cannot
+/// be opened. The most common reasons for this are: the path does not exist,
+/// or there were not enough permissions.
+///
+/// [`io::Error`]: https://doc.rust-lang.org/std/io/struct.Error.html
 ///
 /// # Example
 ///
 /// ```rust,no_run
 /// use same_file::is_same_file;
 ///
 /// assert!(is_same_file("./foo", "././foo").unwrap_or(false));
 /// ```
 pub fn is_same_file<P, Q>(
     path1: P,
     path2: Q,
 ) -> io::Result<bool> where P: AsRef<Path>, Q: AsRef<Path> {
-    Ok(try!(Handle::from_path(path1)) == try!(Handle::from_path(path2)))
+    Ok(Handle::from_path(path1)? == Handle::from_path(path2)?)
 }
 
 #[cfg(test)]
 mod tests {
     extern crate rand;
 
     use std::env;
     use std::fs::{self, File};
@@ -296,9 +510,21 @@ mod tests {
     fn same_dir_soft() {
         let tdir = tmpdir();
         let dir = tdir.path();
 
         fs::create_dir(dir.join("a")).unwrap();
         soft_link_dir(dir.join("a"), dir.join("alink")).unwrap();
         assert!(is_same_file(dir.join("a"), dir.join("alink")).unwrap());
     }
+
+    #[test]
+    fn test_send() {
+        fn assert_send<T: Send>() {}
+        assert_send::<super::Handle>();
+    }
+
+    #[test]
+    fn test_sync() {
+        fn assert_sync<T: Sync>() {}
+        assert_sync::<super::Handle>();
+    }
 }
--- a/third_party/rust/same-file/src/unix.rs
+++ b/third_party/rust/same-file/src/unix.rs
@@ -1,9 +1,10 @@
 use std::fs::{File, OpenOptions};
+use std::hash::{Hash, Hasher};
 use std::io;
 use std::os::unix::fs::MetadataExt;
 use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
 use std::path::Path;
 
 #[derive(Debug)]
 pub struct Handle {
     file: Option<File>,
@@ -12,48 +13,61 @@ pub struct Handle {
     is_std: bool,
     dev: u64,
     ino: u64,
 }
 
 impl Drop for Handle {
     fn drop(&mut self) {
         if self.is_std {
+            // unwrap() will not panic. Since we were able to open an
+            // std stream successfully, then `file` is guaranteed to be Some()
             self.file.take().unwrap().into_raw_fd();
         }
     }
 }
 
 impl Eq for Handle {}
 
 impl PartialEq for Handle {
     fn eq(&self, other: &Handle) -> bool {
         (self.dev, self.ino) == (other.dev, other.ino)
     }
 }
 
 impl AsRawFd for ::Handle {
     fn as_raw_fd(&self) -> RawFd {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.0.file.as_ref().take().unwrap().as_raw_fd()
     }
 }
 
 impl IntoRawFd for ::Handle {
     fn into_raw_fd(mut self) -> RawFd {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.0.file.take().unwrap().into_raw_fd()
     }
 }
 
+impl Hash for Handle {
+    fn hash<H: Hasher>(&self, state: &mut H) {
+        self.dev.hash(state);
+        self.ino.hash(state);
+    }
+}
+
 impl Handle {
     pub fn from_path<P: AsRef<Path>>(p: P) -> io::Result<Handle> {
-        Handle::from_file(try!(OpenOptions::new().read(true).open(p)))
+        Handle::from_file(OpenOptions::new().read(true).open(p)?)
     }
 
     pub fn from_file(file: File) -> io::Result<Handle> {
-        let md = try!(file.metadata());
+        let md = file.metadata()?;
         Ok(Handle {
             file: Some(file),
             is_std: false,
             dev: md.dev(),
             ino: md.ino(),
         })
     }
 
@@ -72,20 +86,24 @@ impl Handle {
         Handle::from_std(unsafe { File::from_raw_fd(1) })
     }
 
     pub fn stderr() -> io::Result<Handle> {
         Handle::from_std(unsafe { File::from_raw_fd(2) })
     }
 
     pub fn as_file(&self) -> &File {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.file.as_ref().take().unwrap()
     }
 
     pub fn as_file_mut(&mut self) -> &mut File {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.file.as_mut().take().unwrap()
     }
 
     pub fn dev(&self) -> u64 {
         self.dev
     }
 
     pub fn ino(&self) -> u64 {
--- a/third_party/rust/same-file/src/win.rs
+++ b/third_party/rust/same-file/src/win.rs
@@ -1,35 +1,39 @@
 use std::fs::{File, OpenOptions};
+use std::hash::{Hash, Hasher};
 use std::io;
 use std::mem;
 use std::os::windows::fs::OpenOptionsExt;
 use std::os::windows::io::{
     AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle,
 };
 use std::path::Path;
 
-use kernel32::{GetFileInformationByHandle, GetStdHandle};
-use winapi::fileapi::BY_HANDLE_FILE_INFORMATION;
-use winapi::minwindef::DWORD;
-use winapi::winbase::{
+use winapi::shared::minwindef::DWORD;
+use winapi::um::fileapi::{
+    BY_HANDLE_FILE_INFORMATION,
+    GetFileInformationByHandle,
+};
+use winapi::um::processenv::GetStdHandle;
+use winapi::um::winbase::{
     FILE_FLAG_BACKUP_SEMANTICS,
     STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE,
 };
 
 // For correctness, it is critical that both file handles remain open while
 // their attributes are checked for equality. In particular, the file index
 // numbers on a Windows stat object are not guaranteed to remain stable over
 // time.
 //
 // See the docs and remarks on MSDN:
 // https://msdn.microsoft.com/en-us/library/windows/desktop/aa363788(v=vs.85).aspx
 //
 // It gets worse. It appears that the index numbers are not always
-// guaranteed to be unqiue. Namely, ReFS uses 128 bit numbers for unique
+// guaranteed to be unique. Namely, ReFS uses 128 bit numbers for unique
 // identifiers. This requires a distinct syscall to get `FILE_ID_INFO`
 // documented here:
 // https://msdn.microsoft.com/en-us/library/windows/desktop/hh802691(v=vs.85).aspx
 //
 // It seems straight-forward enough to modify this code to use
 // `FILE_ID_INFO` when available (minimum Windows Server 2012), but I don't
 // have access to such Windows machines.
 //
@@ -60,61 +64,77 @@ use winapi::winbase::{
 pub struct Handle {
     file: Option<File>,
     // If is_std is true, then we don't drop the corresponding File since it
     // will close the handle.
     is_std: bool,
     key: Option<Key>,
 }
 
-#[derive(Debug, Eq, PartialEq)]
+#[derive(Debug, Eq, PartialEq, Hash)]
 struct Key {
     volume: DWORD,
     idx_high: DWORD,
     idx_low: DWORD,
 }
 
 impl Drop for Handle {
     fn drop(&mut self) {
         if self.is_std {
+            // unwrap() will not panic. Since we were able to open an
+            // std stream successfully, then `file` is guaranteed to be Some()
             self.file.take().unwrap().into_raw_handle();
         }
     }
 }
 
 impl Eq for Handle {}
 
 impl PartialEq for Handle {
     fn eq(&self, other: &Handle) -> bool {
-        if self.key.is_none() || other.key.is_none() {
+        // Need this branch to satisfy `Eq` since `Handle`s with `key.is_none()`
+        // wouldn't otherwise.
+        if self as *const Handle == other as *const Handle {
+            return true;
+        } else if self.key.is_none() || other.key.is_none() {
             return false;
         }
         self.key == other.key
     }
 }
 
 impl AsRawHandle for ::Handle {
     fn as_raw_handle(&self) -> RawHandle {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.0.file.as_ref().take().unwrap().as_raw_handle()
     }
 }
 
 impl IntoRawHandle for ::Handle {
     fn into_raw_handle(mut self) -> RawHandle {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.0.file.take().unwrap().into_raw_handle()
     }
 }
 
+impl Hash for Handle {
+    fn hash<H: Hasher>(&self, state: &mut H) {
+        self.key.hash(state);
+    }
+}
+
 impl Handle {
     pub fn from_path<P: AsRef<Path>>(p: P) -> io::Result<Handle> {
-        let file = try!(OpenOptions::new()
+        let file = OpenOptions::new()
             .read(true)
             // Necessary in order to support opening directory paths.
             .custom_flags(FILE_FLAG_BACKUP_SEMANTICS)
-            .open(p));
+            .open(p)?;
         Handle::from_file(file)
     }
 
     pub fn from_file(file: File) -> io::Result<Handle> {
         file_info(&file).map(|info| Handle::from_file_info(file, false, info))
     }
 
     fn from_std_handle(file: File) -> io::Result<Handle> {
@@ -159,20 +179,24 @@ impl Handle {
 
     pub fn stderr() -> io::Result<Handle> {
         Handle::from_std_handle(unsafe {
             File::from_raw_handle(GetStdHandle(STD_ERROR_HANDLE))
         })
     }
 
     pub fn as_file(&self) -> &File {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.file.as_ref().take().unwrap()
     }
 
     pub fn as_file_mut(&mut self) -> &mut File {
+        // unwrap() will not panic. Since we were able to open the
+        // file successfully, then `file` is guaranteed to be Some()
         self.file.as_mut().take().unwrap()
     }
 }
 
 fn file_info(file: &File) -> io::Result<BY_HANDLE_FILE_INFORMATION> {
     let (r, info) = unsafe {
         let mut info: BY_HANDLE_FILE_INFORMATION = mem::zeroed();
         (GetFileInformationByHandle(file.as_raw_handle(), &mut info), info)
--- a/third_party/rust/walkdir/.cargo-checksum.json
+++ b/third_party/rust/walkdir/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"3865292ac0afca5fce05632ec5e4f0a2f6a13e612ecc46cc0dd96d8c4c73ca67","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"4324e7cfcc4ec1897f1de6471e4ad7dfeeea331bbbfc06e14f2550b17b0a3e02","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","Makefile":"a45a128685a2ae7d4fa39d310786674417ee113055ef290a11f88002285865fc","README.md":"641500136e1777a9a1e9a9394f33a7ff17590ac7d951c6530130a52548b1d925","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","appveyor.yml":"77bbcc4b6f8f44eadb160ae46c9ac2e277775a57869aa7b8f59120ea2eb7a1c2","compare/nftw.c":"6b900b0ac78ce8ece1995f834b194fa14d87d744cabba8f475f0e10b21722c56","compare/walk.py":"d49e26d0b8b2b201d00f2f46bf1f9db46f873c27332da679c9a7adbbf54462d2","ctags.rust":"3d128d3cc59f702e68953ba2fe6c3f46bc6991fc575308db060482d5da0c79f3","examples/walkdir.rs":"8c86cf2e8b64d89dc951f3e1b0e119c2a42f113a7459523f826fadcb9419ba60","session.vim":"95cb1d7caf0ff7fbe76ec911988d908ddd883381c925ba64b537695bc9f021c4","src/lib.rs":"af1d35e968c61c061cf76c336ed2bbe8ab0e4d4d3fd63c9f53116a36a0fd0f7b","src/tests.rs":"34d9bb48db5ec2f83bdcad071e5d332cc16635fd3fd25f6452a7eeefe6f09da8"},"package":"bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"}
\ No newline at end of file
+{"files":{".travis.yml":"b3d3a96db9f091623de082126dd8f434c86c8a93bfa841183c635c5a5658bdee","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"eb9bd73ac96889c92fac322a899a9a9c59484532c5957fce45aee472691aaacf","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","Makefile":"a45a128685a2ae7d4fa39d310786674417ee113055ef290a11f88002285865fc","README.md":"189d8ae0bb722a97844d812ebed0f3c90a96a33652313adf8cfc8cba081ba8fe","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","appveyor.yml":"77bbcc4b6f8f44eadb160ae46c9ac2e277775a57869aa7b8f59120ea2eb7a1c2","compare/nftw.c":"6b900b0ac78ce8ece1995f834b194fa14d87d744cabba8f475f0e10b21722c56","compare/walk.py":"d49e26d0b8b2b201d00f2f46bf1f9db46f873c27332da679c9a7adbbf54462d2","ctags.rust":"3d128d3cc59f702e68953ba2fe6c3f46bc6991fc575308db060482d5da0c79f3","examples/walkdir.rs":"004a004cc3992efba6f8510a34d3d471a176ae7a317716c3a89edfec3e3d252d","session.vim":"95cb1d7caf0ff7fbe76ec911988d908ddd883381c925ba64b537695bc9f021c4","src/lib.rs":"bd4b9b1148768f2f9f857a63858e5bda0d85313ad1352fe5d6ab0273704c1272","src/tests.rs":"cfeb9918f1c8a76e4b3a30439534359d4a29d1576d510ab8cbc7d1f26389477f","src/unix.rs":"330a017a8da231c4c72112d319e4089d014fe4b4cbc3f5665334b39968fb6262"},"package":"63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369"}
\ No newline at end of file
--- a/third_party/rust/walkdir/.travis.yml
+++ b/third_party/rust/walkdir/.travis.yml
@@ -1,13 +1,20 @@
 language: rust
-rust:
-  - 1.10.0
-  - stable
-  - beta
-  - nightly
+matrix:
+  include:
+    - os: linux
+      rust: 1.17.0
+    - os: linux
+      rust: stable
+    - os: linux
+      rust: beta
+    - os: linux
+      rust: nightly
+    - os: osx
+      rust: nightly
 script:
   - cargo build --verbose
   - cargo test --verbose
   - cargo doc
 branches:
   only:
     - master
--- a/third_party/rust/walkdir/Cargo.toml
+++ b/third_party/rust/walkdir/Cargo.toml
@@ -1,24 +1,49 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "walkdir"
-version = "1.0.7"  #:version
+version = "2.1.4"
 authors = ["Andrew Gallant <jamslam@gmail.com>"]
 description = "Recursively walk a directory."
+homepage = "https://github.com/BurntSushi/walkdir"
 documentation = "https://docs.rs/walkdir/"
-homepage = "https://github.com/BurntSushi/walkdir"
-repository = "https://github.com/BurntSushi/walkdir"
 readme = "README.md"
 keywords = ["directory", "recursive", "walk", "iterator"]
+categories = ["filesystem"]
 license = "Unlicense/MIT"
+repository = "https://github.com/BurntSushi/walkdir"
+[dependencies.same-file]
+version = "1"
+[dev-dependencies.docopt]
+version = "0.8"
 
-[dependencies]
-same-file = "0.1.1"
+[dev-dependencies.quickcheck]
+version = "0.6"
+default-features = false
 
-[target.'cfg(windows)'.dependencies]
-kernel32-sys = "0.2"
-winapi = "0.2"
+[dev-dependencies.rand]
+version = "0.4"
+
+[dev-dependencies.serde]
+version = "1"
 
-[dev-dependencies]
-docopt = "0.7"
-quickcheck = { version = "0.4", default-features = false }
-rand = "0.3"
-rustc-serialize = "0.3"
+[dev-dependencies.serde_derive]
+version = "1"
+[target."cfg(windows)".dependencies.winapi]
+version = "0.3"
+features = ["std", "winnt"]
+[badges.appveyor]
+repository = "BurntSushi/walkdir"
+
+[badges.travis-ci]
+repository = "BurntSushi/walkdir"
--- a/third_party/rust/walkdir/README.md
+++ b/third_party/rust/walkdir/README.md
@@ -17,17 +17,17 @@ Dual-licensed under MIT or the [UNLICENS
 
 ### Usage
 
 To use this crate, add `walkdir` as a dependency to your project's
 `Cargo.toml`:
 
 ```
 [dependencies]
-walkdir = "1"
+walkdir = "2"
 ```
 
 ### Example
 
 The following code recursively iterates over the directory given and prints
 the path for each entry:
 
 ```rust,no_run
@@ -65,17 +65,17 @@ for entry in WalkDir::new("foo").follow_
 ```
 
 ### Example: skip hidden files and directories efficiently on unix
 
 This uses the `filter_entry` iterator adapter to avoid yielding hidden files
 and directories efficiently:
 
 ```rust,no_run
-use walkdir::{DirEntry, WalkDir, WalkDirIterator};
+use walkdir::{DirEntry, WalkDir};
 
 fn is_hidden(entry: &DirEntry) -> bool {
     entry.file_name()
          .to_str()
          .map(|s| s.starts_with("."))
          .unwrap_or(false)
 }
 
--- a/third_party/rust/walkdir/examples/walkdir.rs
+++ b/third_party/rust/walkdir/examples/walkdir.rs
@@ -1,10 +1,12 @@
 extern crate docopt;
-extern crate rustc_serialize;
+extern crate serde;
+#[macro_use]
+extern crate serde_derive;
 extern crate walkdir;
 
 use std::io::{self, Write};
 
 use docopt::Docopt;
 use walkdir::WalkDir;
 
 const USAGE: &'static str = "
@@ -15,46 +17,52 @@ Options:
     -h, --help
     -L, --follow-links   Follow symlinks.
     --min-depth NUM      Minimum depth.
     --max-depth NUM      Maximum depth.
     -n, --fd-max NUM     Maximum open file descriptors. [default: 32]
     --tree               Show output as a tree.
     --sort               Sort the output.
     -q, --ignore-errors  Ignore errors.
+    -d, --depth          Show directory's contents before the directory itself.
 ";
 
-#[derive(Debug, RustcDecodable)]
+#[derive(Debug, Deserialize)]
 #[allow(dead_code)]
 struct Args {
     arg_dir: Option<String>,
     flag_follow_links: bool,
     flag_min_depth: Option<usize>,
     flag_max_depth: Option<usize>,
     flag_fd_max: usize,
     flag_tree: bool,
     flag_ignore_errors: bool,
     flag_sort: bool,
+    flag_depth: bool,
 }
 
 macro_rules! wout { ($($tt:tt)*) => { {writeln!($($tt)*)}.unwrap() } }
 
 fn main() {
-    let args: Args = Docopt::new(USAGE).and_then(|d| d.decode())
-                                       .unwrap_or_else(|e| e.exit());
+    let args: Args = Docopt::new(USAGE)
+        .and_then(|d| d.deserialize())
+        .unwrap_or_else(|e| e.exit());
     let mind = args.flag_min_depth.unwrap_or(0);
     let maxd = args.flag_max_depth.unwrap_or(::std::usize::MAX);
     let dir = args.arg_dir.clone().unwrap_or(".".to_owned());
     let mut walkdir = WalkDir::new(dir)
-                     .max_open(args.flag_fd_max)
-                     .follow_links(args.flag_follow_links)
-                     .min_depth(mind)
-                     .max_depth(maxd);
+        .max_open(args.flag_fd_max)
+        .follow_links(args.flag_follow_links)
+        .min_depth(mind)
+        .max_depth(maxd);
     if args.flag_sort {
-        walkdir = walkdir.sort_by(|a,b| a.cmp(b));
+        walkdir = walkdir.sort_by(|a,b| a.file_name().cmp(b.file_name()));
+    }
+    if args.flag_depth {
+        walkdir = walkdir.contents_first(true)
     }
     let it = walkdir.into_iter();
     let mut out = io::BufWriter::new(io::stdout());
     let mut eout = io::stderr();
     if args.flag_tree {
         for dent in it {
             match dent {
                 Err(err) => {
--- a/third_party/rust/walkdir/src/lib.rs
+++ b/third_party/rust/walkdir/src/lib.rs
@@ -3,216 +3,292 @@ Crate `walkdir` provides an efficient an
 of recursive directory traversal. Several options are exposed to control
 iteration, such as whether to follow symbolic links (default off), limit the
 maximum number of simultaneous open file descriptors and the ability to
 efficiently skip descending into directories.
 
 To use this crate, add `walkdir` as a dependency to your project's
 `Cargo.toml`:
 
-```ignore
+```text
 [dependencies]
-walkdir = "1"
+walkdir = "2"
 ```
 
 # From the top
 
-The `WalkDir` type builds iterators. The `WalkDirIterator` trait provides
-methods for directory iterator adapters, such as efficiently pruning entries
-during traversal. The `DirEntry` type describes values yielded by the iterator.
-Finally, the `Error` type is a small wrapper around `std::io::Error` with
-additional information, such as if a loop was detected while following symbolic
-links (not enabled by default).
+The [`WalkDir`] type builds iterators. The [`DirEntry`] type describes values
+yielded by the iterator. Finally, the [`Error`] type is a small wrapper around
+[`std::io::Error`] with additional information, such as if a loop was detected
+while following symbolic links (not enabled by default).
+
+[`WalkDir`]: struct.WalkDir.html
+[`DirEntry`]: struct.DirEntry.html
+[`Error`]: struct.Error.html
+[`std::io::Error`]: https://doc.rust-lang.org/stable/std/io/struct.Error.html
 
 # Example
 
 The following code recursively iterates over the directory given and prints
 the path for each entry:
 
-```rust,no_run
+```no_run
 use walkdir::WalkDir;
+# use walkdir::Error;
 
+# fn try_main() -> Result<(), Error> {
 for entry in WalkDir::new("foo") {
-    let entry = entry.unwrap();
-    println!("{}", entry.path().display());
+    println!("{}", entry?.path().display());
 }
+# Ok(())
+# }
 ```
 
-Or, if you'd like to iterate over all entries and ignore any errors that may
-arise, use `filter_map`. (e.g., This code below will silently skip directories
-that the owner of the running process does not have permission to access.)
+Or, if you'd like to iterate over all entries and ignore any errors that
+may arise, use [`filter_map`]. (e.g., This code below will silently skip
+directories that the owner of the running process does not have permission to
+access.)
 
-```rust,no_run
+```no_run
 use walkdir::WalkDir;
 
 for entry in WalkDir::new("foo").into_iter().filter_map(|e| e.ok()) {
     println!("{}", entry.path().display());
 }
 ```
 
+[`filter_map`]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.filter_map
+
 # Example: follow symbolic links
 
-The same code as above, except `follow_links` is enabled:
+The same code as above, except [`follow_links`] is enabled:
 
-```rust,no_run
+```no_run
 use walkdir::WalkDir;
+# use walkdir::Error;
 
+# fn try_main() -> Result<(), Error> {
 for entry in WalkDir::new("foo").follow_links(true) {
-    let entry = entry.unwrap();
-    println!("{}", entry.path().display());
+    println!("{}", entry?.path().display());
 }
+# Ok(())
+# }
 ```
 
-# Example: skip hidden files and directories efficiently on unix
+[`follow_links`]: struct.WalkDir.html#method.follow_links
+
+# Example: skip hidden files and directories on unix
 
-This uses the `filter_entry` iterator adapter to avoid yielding hidden files
-and directories efficiently:
+This uses the [`filter_entry`] iterator adapter to avoid yielding hidden files
+and directories efficiently (i.e. without recursing into hidden directories):
 
-```rust,no_run
-use walkdir::{DirEntry, WalkDir, WalkDirIterator};
+```no_run
+use walkdir::{DirEntry, WalkDir};
+# use walkdir::Error;
 
 fn is_hidden(entry: &DirEntry) -> bool {
     entry.file_name()
          .to_str()
          .map(|s| s.starts_with("."))
          .unwrap_or(false)
 }
 
+# fn try_main() -> Result<(), Error> {
 let walker = WalkDir::new("foo").into_iter();
 for entry in walker.filter_entry(|e| !is_hidden(e)) {
-    let entry = entry.unwrap();
-    println!("{}", entry.path().display());
+    println!("{}", entry?.path().display());
 }
+# Ok(())
+# }
 ```
 
+[`filter_entry`]: struct.IntoIter.html#method.filter_entry
 */
-#[cfg(windows)] extern crate kernel32;
-#[cfg(windows)] extern crate winapi;
-#[cfg(test)] extern crate quickcheck;
-#[cfg(test)] extern crate rand;
+
+#![doc(html_root_url = "https://docs.rs/walkdir/2.0.0")]
+#![deny(missing_docs)]
+
+#[cfg(test)]
+extern crate quickcheck;
+#[cfg(test)]
+extern crate rand;
 extern crate same_file;
+#[cfg(windows)]
+extern crate winapi;
 
 use std::cmp::{Ordering, min};
 use std::error;
 use std::fmt;
 use std::fs::{self, FileType, ReadDir};
 use std::io;
 use std::ffi::OsStr;
-use std::ffi::OsString;
 use std::path::{Path, PathBuf};
 use std::result;
 use std::vec;
 
-pub use same_file::is_same_file;
+use same_file::Handle;
+
+#[cfg(unix)]
+pub use unix::DirEntryExt;
 
-#[cfg(test)] mod tests;
+#[cfg(test)]
+mod tests;
+#[cfg(unix)]
+mod unix;
 
-/// Like try, but for iterators that return `Option<Result<_, _>>`.
+/// Like try, but for iterators that return [`Option<Result<_, _>>`].
+///
+/// [`Option<Result<_, _>>`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html
 macro_rules! itry {
     ($e:expr) => {
         match $e {
             Ok(v) => v,
             Err(err) => return Some(Err(From::from(err))),
         }
     }
 }
 
 /// A result type for walkdir operations.
 ///
 /// Note that this result type embeds the error type in this crate. This
 /// is only useful if you care about the additional information provided by
 /// the error (such as the path associated with the error or whether a loop
 /// was dectected). If you want things to Just Work, then you can use
-/// `io::Result` instead since the error type in this package will
-/// automatically convert to an `io::Result` when using the `try!` macro.
+/// [`io::Result`] instead since the error type in this package will
+/// automatically convert to an [`io::Result`] when using the [`try!`] macro.
+///
+/// [`io::Result`]: https://doc.rust-lang.org/stable/std/io/type.Result.html
+/// [`try!`]: https://doc.rust-lang.org/stable/std/macro.try.html
 pub type Result<T> = ::std::result::Result<T, Error>;
 
 /// A builder to create an iterator for recursively walking a directory.
 ///
 /// Results are returned in depth first fashion, with directories yielded
-/// before their contents. The order is unspecified. Directory entries `.`
-/// and `..` are always omitted.
+/// before their contents. If [`contents_first`] is true, contents are yielded
+/// before their directories. The order is unspecified but if [`sort_by`] is
+/// given, directory entries are sorted according to this function. Directory
+/// entries `.` and `..` are always omitted.
 ///
 /// If an error occurs at any point during iteration, then it is returned in
 /// place of its corresponding directory entry and iteration continues as
-/// normal. If an error occurs while opening a directory for reading, it
-/// is skipped. Iteration may be stopped at any time. When the iterator is
-/// destroyed, all resources associated with it are freed.
+/// normal. If an error occurs while opening a directory for reading, then it
+/// is not descended into (but the error is still yielded by the iterator).
+/// Iteration may be stopped at any time. When the iterator is destroyed, all
+/// resources associated with it are freed.
+///
+/// [`contents_first`]: struct.WalkDir.html#method.contents_first
+/// [`sort_by`]: struct.WalkDir.html#method.sort_by
 ///
 /// # Usage
 ///
-/// This type implements `IntoIterator` so that it may be used as the subject
-/// of a `for` loop. You may need to call `into_iter` explicitly if you want
-/// to use iterator adapters such as `filter_entry`.
+/// This type implements [`IntoIterator`] so that it may be used as the subject
+/// of a `for` loop. You may need to call [`into_iter`] explicitly if you want
+/// to use iterator adapters such as [`filter_entry`].
 ///
 /// Idiomatic use of this type should use method chaining to set desired
-/// options. For example, this only shows entries with a depth of `1`, `2`
-/// or `3` (relative to `foo`):
+/// options. For example, this only shows entries with a depth of `1`, `2` or
+/// `3` (relative to `foo`):
 ///
-/// ```rust,no_run
+/// ```no_run
 /// use walkdir::WalkDir;
+/// # use walkdir::Error;
 ///
+/// # fn try_main() -> Result<(), Error> {
 /// for entry in WalkDir::new("foo").min_depth(1).max_depth(3) {
-///     let entry = entry.unwrap();
-///     println!("{}", entry.path().display());
+///     println!("{}", entry?.path().display());
 /// }
+/// # Ok(())
+/// # }
 /// ```
 ///
+/// [`IntoIterator`]: https://doc.rust-lang.org/stable/std/iter/trait.IntoIterator.html
+/// [`into_iter`]: https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html#tymethod.into_iter
+/// [`filter_entry`]: struct.IntoIter.html#method.filter_entry
+///
 /// Note that the iterator by default includes the top-most directory. Since
 /// this is the only directory yielded with depth `0`, it is easy to ignore it
-/// with the `min_depth` setting:
+/// with the [`min_depth`] setting:
 ///
-/// ```rust,no_run
+/// ```no_run
 /// use walkdir::WalkDir;
+/// # use walkdir::Error;
 ///
+/// # fn try_main() -> Result<(), Error> {
 /// for entry in WalkDir::new("foo").min_depth(1) {
-///     let entry = entry.unwrap();
-///     println!("{}", entry.path().display());
+///     println!("{}", entry?.path().display());
 /// }
+/// # Ok(())
+/// # }
 /// ```
 ///
+/// [`min_depth`]: struct.WalkDir.html#method.min_depth
+///
 /// This will only return descendents of the `foo` directory and not `foo`
 /// itself.
 ///
 /// # Loops
 ///
 /// This iterator (like most/all recursive directory iterators) assumes that
 /// no loops can be made with *hard* links on your file system. In particular,
 /// this would require creating a hard link to a directory such that it creates
 /// a loop. On most platforms, this operation is illegal.
 ///
 /// Note that when following symbolic/soft links, loops are detected and an
 /// error is reported.
+#[derive(Debug)]
 pub struct WalkDir {
     opts: WalkDirOptions,
     root: PathBuf,
 }
 
 struct WalkDirOptions {
     follow_links: bool,
     max_open: usize,
     min_depth: usize,
     max_depth: usize,
-    sorter: Option<Box<FnMut(&OsString,&OsString) -> Ordering + 'static>>,
+    sorter: Option<Box<
+        FnMut(&DirEntry,&DirEntry) -> Ordering + Send + Sync + 'static
+    >>,
+    contents_first: bool,
+}
+
+impl fmt::Debug for WalkDirOptions {
+    fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
+        let sorter_str = if self.sorter.is_some() {
+            // FnMut isn't `Debug`
+            "Some(...)"
+        } else {
+            "None"
+        };
+        f.debug_struct("WalkDirOptions")
+            .field("follow_links", &self.follow_links)
+            .field("max_open", &self.max_open)
+            .field("min_depth", &self.min_depth)
+            .field("max_depth", &self.max_depth)
+            .field("sorter", &sorter_str)
+            .field("contents_first", &self.contents_first)
+            .finish()
+    }
 }
 
 impl WalkDir {
     /// Create a builder for a recursive directory iterator starting at the
     /// file path `root`. If `root` is a directory, then it is the first item
     /// yielded by the iterator. If `root` is a file, then it is the first
     /// and only item yielded by the iterator. If `root` is a symlink, then it
     /// is always followed.
     pub fn new<P: AsRef<Path>>(root: P) -> Self {
         WalkDir {
             opts: WalkDirOptions {
                 follow_links: false,
                 max_open: 10,
                 min_depth: 0,
                 max_depth: ::std::usize::MAX,
                 sorter: None,
+                contents_first: false,
             },
             root: root.as_ref().to_path_buf(),
         }
     }
 
     /// Set the minimum depth of entries yielded by the iterator.
     ///
     /// The smallest depth is `0` and always corresponds to the path given
@@ -244,19 +320,21 @@ impl WalkDir {
     }
 
     /// Follow symbolic links. By default, this is disabled.
     ///
     /// When `yes` is `true`, symbolic links are followed as if they were
     /// normal directories and files. If a symbolic link is broken or is
     /// involved in a loop, an error is yielded.
     ///
-    /// When enabled, the yielded `DirEntry` values represent the target of
-    /// the link while the path corresponds to the link. See the `DirEntry`
+    /// When enabled, the yielded [`DirEntry`] values represent the target of
+    /// the link while the path corresponds to the link. See the [`DirEntry`]
     /// type for more details.
+    ///
+    /// [`DirEntry`]: struct.DirEntry.html
     pub fn follow_links(mut self, yes: bool) -> Self {
         self.opts.follow_links = yes;
         self
     }
 
     /// Set the maximum number of simultaneously open file descriptors used
     /// by the iterator.
     ///
@@ -271,76 +349,365 @@ impl WalkDir {
     /// needs to be opened to continue iteration, then a previous directory
     /// handle is closed and has its unyielded entries stored in memory. In
     /// practice, this is a satisfying trade off because it scales with respect
     /// to the *depth* of your file tree. Therefore, low values (even `1`) are
     /// acceptable.
     ///
     /// Note that this value does not impact the number of system calls made by
     /// an exhausted iterator.
+    ///
+    /// # Platform behavior
+    ///
+    /// On Windows, if `follow_links` is enabled, then this limit is not
+    /// respected. In particular, the maximum number of file descriptors opened
+    /// is proportional to the depth of the directory tree traversed.
     pub fn max_open(mut self, mut n: usize) -> Self {
         if n == 0 {
             n = 1;
         }
         self.opts.max_open = n;
         self
     }
 
     /// Set a function for sorting directory entries.
     ///
     /// If a compare function is set, the resulting iterator will return all
     /// paths in sorted order. The compare function will be called to compare
-    /// names from entries from the same directory using only the name of the
-    /// entry.
+    /// entries from the same directory.
     ///
     /// ```rust,no-run
     /// use std::cmp;
     /// use std::ffi::OsString;
     /// use walkdir::WalkDir;
     ///
-    /// WalkDir::new("foo").sort_by(|a,b| a.cmp(b));
+    /// WalkDir::new("foo").sort_by(|a,b| a.file_name().cmp(b.file_name()));
     /// ```
     pub fn sort_by<F>(mut self, cmp: F) -> Self
-            where F: FnMut(&OsString, &OsString) -> Ordering + 'static {
+    where F: FnMut(&DirEntry, &DirEntry) -> Ordering + Send + Sync + 'static
+    {
         self.opts.sorter = Some(Box::new(cmp));
         self
     }
+
+    /// Yield a directory's contents before the directory itself. By default,
+    /// this is disabled.
+    ///
+    /// When `yes` is `false` (as is the default), the directory is yielded
+    /// before its contents are read. This is useful when, e.g. you want to
+    /// skip processing of some directories.
+    ///
+    /// When `yes` is `true`, the iterator yields the contents of a directory
+    /// before yielding the directory itself. This is useful when, e.g. you
+    /// want to recursively delete a directory.
+    ///
+    /// # Example
+    ///
+    /// Assume the following directory tree:
+    ///
+    /// ```text
+    /// foo/
+    ///   abc/
+    ///     qrs
+    ///     tuv
+    ///   def/
+    /// ```
+    ///
+    /// With contents_first disabled (the default), the following code visits
+    /// the directory tree in depth-first order:
+    ///
+    /// ```no_run
+    /// use walkdir::WalkDir;
+    ///
+    /// for entry in WalkDir::new("foo") {
+    ///     let entry = entry.unwrap();
+    ///     println!("{}", entry.path().display());
+    /// }
+    ///
+    /// // foo
+    /// // foo/abc
+    /// // foo/abc/qrs
+    /// // foo/abc/tuv
+    /// // foo/def
+    /// ```
+    ///
+    /// With contents_first enabled:
+    ///
+    /// ```no_run
+    /// use walkdir::WalkDir;
+    ///
+    /// for entry in WalkDir::new("foo").contents_first(true) {
+    ///     let entry = entry.unwrap();
+    ///     println!("{}", entry.path().display());
+    /// }
+    ///
+    /// // foo/abc/qrs
+    /// // foo/abc/tuv
+    /// // foo/abc
+    /// // foo/def
+    /// // foo
+    /// ```
+    pub fn contents_first(mut self, yes: bool) -> Self {
+        self.opts.contents_first = yes;
+        self
+    }
 }
 
 impl IntoIterator for WalkDir {
     type Item = Result<DirEntry>;
-    type IntoIter = Iter;
+    type IntoIter = IntoIter;
 
-    fn into_iter(self) -> Iter {
-        Iter {
+    fn into_iter(self) -> IntoIter {
+        IntoIter {
             opts: self.opts,
             start: Some(self.root),
             stack_list: vec![],
             stack_path: vec![],
             oldest_opened: 0,
             depth: 0,
+            deferred_dirs: vec![],
         }
     }
 }
 
-/// A trait for recursive directory iterators.
-pub trait WalkDirIterator: Iterator {
+/// An iterator for recursively descending into a directory.
+///
+/// A value with this type must be constructed with the [`WalkDir`] type, which
+/// uses a builder pattern to set options such as min/max depth, max open file
+/// descriptors and whether the iterator should follow symbolic links. After
+/// constructing a `WalkDir`, call [`.into_iter()`] at the end of the chain.
+///
+/// The order of elements yielded by this iterator is unspecified.
+///
+/// [`WalkDir`]: struct.WalkDir.html
+/// [`.into_iter()`]: struct.WalkDir.html#into_iter.v
+#[derive(Debug)]
+pub struct IntoIter {
+    /// Options specified in the builder. Depths, max fds, etc.
+    opts: WalkDirOptions,
+    /// The start path.
+    ///
+    /// This is only `Some(...)` at the beginning. After the first iteration,
+    /// this is always `None`.
+    start: Option<PathBuf>,
+    /// A stack of open (up to max fd) or closed handles to directories.
+    /// An open handle is a plain [`fs::ReadDir`] while a closed handle is
+    /// a `Vec<fs::DirEntry>` corresponding to the as-of-yet consumed entries.
+    ///
+    /// [`fs::ReadDir`]: https://doc.rust-lang.org/stable/std/fs/struct.ReadDir.html
+    stack_list: Vec<DirList>,
+    /// A stack of file paths.
+    ///
+    /// This is *only* used when [`follow_links`] is enabled. In all other
+    /// cases this stack is empty.
+    ///
+    /// [`follow_links`]: struct.WalkDir.html#method.follow_links
+    stack_path: Vec<Ancestor>,
+    /// An index into `stack_list` that points to the oldest open directory
+    /// handle. If the maximum fd limit is reached and a new directory needs to
+    /// be read, the handle at this index is closed before the new directory is
+    /// opened.
+    oldest_opened: usize,
+    /// The current depth of iteration (the length of the stack at the
+    /// beginning of each iteration).
+    depth: usize,
+    /// A list of DirEntries corresponding to directories, that are
+    /// yielded after their contents has been fully yielded. This is only
+    /// used when `contents_first` is enabled.
+    deferred_dirs: Vec<DirEntry>,
+}
+
+/// An ancestor is an item in the directory tree traversed by walkdir, and is
+/// used to check for loops in the tree when traversing symlinks.
+#[derive(Debug)]
+struct Ancestor {
+    /// The path of this ancestor.
+    path: PathBuf,
+    /// An open file to this ancesor. This is only used on Windows where
+    /// opening a file handle appears to be quite expensive, so we choose to
+    /// cache it. This comes at the cost of not respecting the file descriptor
+    /// limit set by the user.
+    #[cfg(windows)]
+    handle: Handle,
+}
+
+impl Ancestor {
+    /// Create a new ancestor from the given directory path.
+    #[cfg(windows)]
+    fn new(dent: &DirEntry) -> io::Result<Ancestor> {
+        let handle = Handle::from_path(dent.path())?;
+        Ok(Ancestor {
+            path: dent.path().to_path_buf(),
+            handle: handle,
+        })
+    }
+
+    /// Create a new ancestor from the given directory path.
+    #[cfg(not(windows))]
+    fn new(dent: &DirEntry) -> io::Result<Ancestor> {
+        Ok(Ancestor { path: dent.path().to_path_buf() })
+    }
+
+    /// Returns true if and only if the given open file handle corresponds to
+    /// the same directory as this ancestor.
+    #[cfg(windows)]
+    fn is_same(&self, child: &Handle) -> io::Result<bool> {
+        Ok(child == &self.handle)
+    }
+
+    /// Returns true if and only if the given open file handle corresponds to
+    /// the same directory as this ancestor.
+    #[cfg(not(windows))]
+    fn is_same(&self, child: &Handle) -> io::Result<bool> {
+        Ok(child == &Handle::from_path(&self.path)?)
+    }
+}
+
+/// A sequence of unconsumed directory entries.
+///
+/// This represents the opened or closed state of a directory handle. When
+/// open, future entries are read by iterating over the raw `fs::ReadDir`.
+/// When closed, all future entries are read into memory. Iteration then
+/// proceeds over a [`Vec<fs::DirEntry>`].
+///
+/// [`fs::ReadDir`]: https://doc.rust-lang.org/stable/std/fs/struct.ReadDir.html
+/// [`Vec<fs::DirEntry>`]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html
+#[derive(Debug)]
+enum DirList {
+    /// An opened handle.
+    ///
+    /// This includes the depth of the handle itself.
+    ///
+    /// If there was an error with the initial [`fs::read_dir`] call, then it
+    /// is stored here. (We use an [`Option<...>`] to make yielding the error
+    /// exactly once simpler.)
+    ///
+    /// [`fs::read_dir`]: https://doc.rust-lang.org/stable/std/fs/fn.read_dir.html
+    /// [`Option<...>`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html
+    Opened { depth: usize, it: result::Result<ReadDir, Option<Error>> },
+    /// A closed handle.
+    ///
+    /// All remaining directory entries are read into memory.
+    Closed(vec::IntoIter<Result<DirEntry>>),
+}
+
+/// A directory entry.
+///
+/// This is the type of value that is yielded from the iterators defined in
+/// this crate.
+///
+/// On Unix systems, this type implements the [`DirEntryExt`] trait, which
+/// provides efficient access to the inode number of the directory entry.
+///
+/// # Differences with `std::fs::DirEntry`
+///
+/// This type mostly mirrors the type by the same name in [`std::fs`]. There
+/// are some differences however:
+///
+/// * All recursive directory iterators must inspect the entry's type.
+/// Therefore, the value is stored and its access is guaranteed to be cheap and
+/// successful.
+/// * [`path`] and [`file_name`] return borrowed variants.
+/// * If [`follow_links`] was enabled on the originating iterator, then all
+/// operations except for [`path`] operate on the link target. Otherwise, all
+/// operations operate on the symbolic link.
+///
+/// [`std::fs`]: https://doc.rust-lang.org/stable/std/fs/index.html
+/// [`path`]: #method.path
+/// [`file_name`]: #method.file_name
+/// [`follow_links`]: struct.WalkDir.html#method.follow_links
+/// [`DirEntryExt`]: trait.DirEntryExt.html
+pub struct DirEntry {
+    /// The path as reported by the [`fs::ReadDir`] iterator (even if it's a
+    /// symbolic link).
+    ///
+    /// [`fs::ReadDir`]: https://doc.rust-lang.org/stable/std/fs/struct.ReadDir.html
+    path: PathBuf,
+    /// The file type. Necessary for recursive iteration, so store it.
+    ty: FileType,
+    /// Is set when this entry was created from a symbolic link and the user
+    /// excepts the iterator to follow symbolic links.
+    follow_link: bool,
+    /// The depth at which this entry was generated relative to the root.
+    depth: usize,
+    /// The underlying inode number (Unix only).
+    #[cfg(unix)]
+    ino: u64,
+    /// The underlying metadata (Windows only). We store this on Windows
+    /// because this comes for free while reading a directory.
+    ///
+    /// We use this to determine whether an entry is a directory or not, which
+    /// works around a bug in Rust's standard library:
+    /// https://github.com/rust-lang/rust/issues/46484
+    #[cfg(windows)]
+    metadata: fs::Metadata,
+}
+
+impl Iterator for IntoIter {
+    type Item = Result<DirEntry>;
+    /// Advances the iterator and returns the next value.
+    ///
+    /// # Errors
+    ///
+    /// If the iterator fails to retrieve the next value, this method returns
+    /// an error value. The error will be wrapped in an Option::Some.
+    fn next(&mut self) -> Option<Result<DirEntry>> {
+        if let Some(start) = self.start.take() {
+            let dent = itry!(DirEntry::from_link(0, start));
+            if let Some(result) = self.handle_entry(dent) {
+                return Some(result);
+            }
+        }
+        while !self.stack_list.is_empty() {
+            self.depth = self.stack_list.len();
+            if let Some(dentry) = self.get_deferred_dir() {
+                return Some(Ok(dentry));
+            }
+            if self.depth > self.opts.max_depth {
+                // If we've exceeded the max depth, pop the current dir
+                // so that we don't descend.
+                self.pop();
+                continue;
+            }
+            // Unwrap is safe here because we've verified above that
+            // `self.stack_list` is not empty
+            match self.stack_list.last_mut().expect("bug in walkdir").next() {
+                None => self.pop(),
+                Some(Err(err)) => return Some(Err(err)),
+                Some(Ok(dent)) => {
+                    if let Some(result) = self.handle_entry(dent) {
+                        return Some(result);
+                    }
+                }
+            }
+        }
+        if self.opts.contents_first {
+            self.depth = self.stack_list.len();
+            if let Some(dentry) = self.get_deferred_dir() {
+                return Some(Ok(dentry));
+            }
+        }
+        None
+    }
+}
+
+impl IntoIter {
     /// Skips the current directory.
     ///
     /// This causes the iterator to stop traversing the contents of the least
     /// recently yielded directory. This means any remaining entries in that
     /// directory will be skipped (including sub-directories).
     ///
-    /// Note that the ergnomics of this method are questionable since it
+    /// Note that the ergonomics of this method are questionable since it
     /// borrows the iterator mutably. Namely, you must write out the looping
     /// condition manually. For example, to skip hidden entries efficiently on
     /// unix systems:
     ///
-    /// ```rust,no_run
-    /// use walkdir::{DirEntry, WalkDir, WalkDirIterator};
+    /// ```no_run
+    /// use walkdir::{DirEntry, WalkDir};
     ///
     /// fn is_hidden(entry: &DirEntry) -> bool {
     ///     entry.file_name()
     ///          .to_str()
     ///          .map(|s| s.starts_with("."))
     ///          .unwrap_or(false)
     /// }
     ///
@@ -356,271 +723,197 @@ pub trait WalkDirIterator: Iterator {
     ///             it.skip_current_dir();
     ///         }
     ///         continue;
     ///     }
     ///     println!("{}", entry.path().display());
     /// }
     /// ```
     ///
-    /// You may find it more convenient to use the `filter_entry` iterator
+    /// You may find it more convenient to use the [`filter_entry`] iterator
     /// adapter. (See its documentation for the same example functionality as
     /// above.)
-    fn skip_current_dir(&mut self);
+    ///
+    /// [`filter_entry`]: #method.filter_entry
+    pub fn skip_current_dir(&mut self) {
+        if !self.stack_list.is_empty() {
+            self.stack_list.pop();
+        }
+        if !self.stack_path.is_empty() {
+            self.stack_path.pop();
+        }
+    }
 
     /// Yields only entries which satisfy the given predicate and skips
     /// descending into directories that do not satisfy the given predicate.
     ///
     /// The predicate is applied to all entries. If the predicate is
     /// true, iteration carries on as normal. If the predicate is false, the
     /// entry is ignored and if it is a directory, it is not descended into.
     ///
-    /// This is often more convenient to use than `skip_current_dir`. For
+    /// This is often more convenient to use than [`skip_current_dir`]. For
     /// example, to skip hidden files and directories efficiently on unix
     /// systems:
     ///
-    /// ```rust,no_run
-    /// use walkdir::{DirEntry, WalkDir, WalkDirIterator};
+    /// ```no_run
+    /// use walkdir::{DirEntry, WalkDir};
+    /// # use walkdir::Error;
     ///
     /// fn is_hidden(entry: &DirEntry) -> bool {
     ///     entry.file_name()
     ///          .to_str()
     ///          .map(|s| s.starts_with("."))
     ///          .unwrap_or(false)
     /// }
     ///
+    /// # fn try_main() -> Result<(), Error> {
     /// for entry in WalkDir::new("foo")
     ///                      .into_iter()
     ///                      .filter_entry(|e| !is_hidden(e)) {
-    ///     let entry = entry.unwrap();
-    ///     println!("{}", entry.path().display());
+    ///     println!("{}", entry?.path().display());
     /// }
+    /// # Ok(())
+    /// # }
     /// ```
     ///
     /// Note that the iterator will still yield errors for reading entries that
     /// may not satisfy the predicate.
     ///
-    /// Note that entries skipped with `min_depth` and `max_depth` are not
+    /// Note that entries skipped with [`min_depth`] and [`max_depth`] are not
     /// passed to this predicate.
-    fn filter_entry<P>(self, predicate: P) -> IterFilterEntry<Self, P>
-            where Self: Sized, P: FnMut(&DirEntry) -> bool {
-        IterFilterEntry { it: self, predicate: predicate }
-    }
-}
-
-/// An iterator for recursively descending into a directory.
-///
-/// A value with this type must be constructed with the `WalkDir` type, which
-/// uses a builder pattern to set options such as min/max depth, max open file
-/// descriptors and whether the iterator should follow symbolic links.
-///
-/// The order of elements yielded by this iterator is unspecified.
-pub struct Iter {
-    /// Options specified in the builder. Depths, max fds, etc.
-    opts: WalkDirOptions,
-    /// The start path.
     ///
-    /// This is only `Some(...)` at the beginning. After the first iteration,
-    /// this is always `None`.
-    start: Option<PathBuf>,
-    /// A stack of open (up to max fd) or closed handles to directories.
-    /// An open handle is a plain `fs::ReadDir` while a closed handle is
-    /// a `Vec<fs::DirEntry>` corresponding to the as-of-yet consumed entries.
-    stack_list: Vec<DirList>,
-    /// A stack of file paths.
+    /// Note that if the iterator has `contents_first` enabled, then this
+    /// method is no different than calling the standard `Iterator::filter`
+    /// method (because directory entries are yielded after they've been
+    /// descended into).
     ///
-    /// This is *only* used when `follow_links` is enabled. In all other cases
-    /// this stack is empty.
-    stack_path: Vec<PathBuf>,
-    /// An index into `stack_list` that points to the oldest open directory
-    /// handle. If the maximum fd limit is reached and a new directory needs
-    /// to be read, the handle at this index is closed before the new directory
-    /// is opened.
-    oldest_opened: usize,
-    /// The current depth of iteration (the length of the stack at the
-    /// beginning of each iteration).
-    depth: usize,
-}
-
-/// A sequence of unconsumed directory entries.
-///
-/// This represents the opened or closed state of a directory handle. When
-/// open, future entries are read by iterating over the raw `fs::ReadDir`.
-/// When closed, all future entries are read into memory. Iteration then
-/// proceeds over a `Vec<fs::DirEntry>`.
-enum DirList {
-    /// An opened handle.
-    ///
-    /// This includes the depth of the handle itself.
-    ///
-    /// If there was an error with the initial `fs::read_dir` call, then it is
-    /// stored here. (We use an `Option<...>` to make yielding the error
-    /// exactly once simpler.)
-    Opened { depth: usize, it: result::Result<ReadDir, Option<Error>> },
-    /// A closed handle.
-    ///
-    /// All remaining directory entries are read into memory.
-    Closed(vec::IntoIter<Result<fs::DirEntry>>),
-}
+    /// [`skip_current_dir`]: #method.skip_current_dir
+    /// [`min_depth`]: struct.WalkDir.html#method.min_depth
+    /// [`max_depth`]: struct.WalkDir.html#method.max_depth
+    pub fn filter_entry<P>(self, predicate: P) -> FilterEntry<Self, P>
+    where P: FnMut(&DirEntry) -> bool
+    {
+        FilterEntry { it: self, predicate: predicate }
+    }
 
-/// A directory entry.
-///
-/// This is the type of value that is yielded from the iterators defined in
-/// this crate.
-///
-/// # Differences with `std::fs::DirEntry`
-///
-/// This type mostly mirrors the type by the same name in `std::fs`. There are
-/// some differences however:
-///
-/// * All recursive directory iterators must inspect the entry's type.
-/// Therefore, the value is stored and its access is guaranteed to be cheap and
-/// successful.
-/// * `path` and `file_name` return borrowed variants.
-/// * If `follow_links` was enabled on the originating iterator, then all
-/// operations except for `path` operate on the link target. Otherwise, all
-/// operations operate on the symbolic link.
-pub struct DirEntry {
-    /// The path as reported by the `fs::ReadDir` iterator (even if it's a
-    /// symbolic link).
-    path: PathBuf,
-    /// The file type. Necessary for recursive iteration, so store it.
-    ty: FileType,
-    /// Is set when this entry was created from a symbolic link and the user
-    /// excepts the iterator to follow symbolic links.
-    follow_link: bool,
-    /// The depth at which this entry was generated relative to the root.
-    depth: usize,
-    /// The underlying inode number (Unix only).
-    #[cfg(unix)]
-    ino: u64,
-}
-
-impl Iterator for Iter {
-    type Item = Result<DirEntry>;
-
-    fn next(&mut self) -> Option<Result<DirEntry>> {
-        if let Some(start) = self.start.take() {
-            let dent = itry!(DirEntry::from_link(0, start));
-            if let Some(result) = self.handle_entry(dent) {
-                return Some(result);
-            }
-        }
-        while !self.stack_list.is_empty() {
-            self.depth = self.stack_list.len();
-            if self.depth > self.opts.max_depth {
-                // If we've exceeded the max depth, pop the current dir
-                // so that we don't descend.
-                self.pop();
-                continue;
-            }
-            match self.stack_list.last_mut().unwrap().next() {
-                None => self.pop(),
-                Some(Err(err)) => return Some(Err(err)),
-                Some(Ok(dent)) => {
-                    let dent = itry!(DirEntry::from_entry(self.depth, &dent));
-                    if let Some(result) = self.handle_entry(dent) {
-                        return Some(result);
-                    }
-                }
-            }
-        }
-        None
-    }
-}
-
-impl WalkDirIterator for Iter {
-    fn skip_current_dir(&mut self) {
-        if !self.stack_list.is_empty() {
-            self.stack_list.pop();
-        }
-        if !self.stack_path.is_empty() {
-            self.stack_path.pop();
-        }
-    }
-}
-
-impl Iter {
     fn handle_entry(
         &mut self,
         mut dent: DirEntry,
     ) -> Option<Result<DirEntry>> {
         if self.opts.follow_links && dent.file_type().is_symlink() {
             dent = itry!(self.follow(dent));
         }
-        if dent.file_type().is_dir() {
-            self.push(&dent);
+        let is_normal_dir = !dent.file_type().is_symlink() && dent.is_dir();
+        if is_normal_dir {
+            itry!(self.push(&dent));
         }
-        if self.skippable() { None } else { Some(Ok(dent)) }
+        if is_normal_dir && self.opts.contents_first {
+            self.deferred_dirs.push(dent);
+            None
+        } else if self.skippable() {
+            None
+        } else {
+            Some(Ok(dent))
+        }
     }
 
-    fn push(&mut self, dent: &DirEntry) {
+    fn get_deferred_dir(&mut self) -> Option<DirEntry> {
+        if self.opts.contents_first {
+            if self.depth < self.deferred_dirs.len() {
+                // Unwrap is safe here because we've guaranteed that
+                // `self.deferred_dirs.len()` can never be less than 1
+                let deferred: DirEntry = self.deferred_dirs.pop()
+                    .expect("bug in walkdir");
+                if !self.skippable() {
+                    return Some(deferred);
+                }
+            }
+        }
+        None
+    }
+
+    fn push(&mut self, dent: &DirEntry) -> Result<()> {
         // Make room for another open file descriptor if we've hit the max.
-        if self.stack_list.len() - self.oldest_opened == self.opts.max_open {
+        let free = self.stack_list
+            .len()
+            .checked_sub(self.oldest_opened).unwrap();
+        if free == self.opts.max_open {
             self.stack_list[self.oldest_opened].close();
+            // Unwrap is safe here because self.oldest_opened is guaranteed to
+            // never be greater than `self.stack_list.len()`, which implies
+            // that the subtraction won't underflow and that adding 1 will
+            // never overflow.
             self.oldest_opened = self.oldest_opened.checked_add(1).unwrap();
         }
         // Open a handle to reading the directory's entries.
         let rd = fs::read_dir(dent.path()).map_err(|err| {
             Some(Error::from_path(self.depth, dent.path().to_path_buf(), err))
         });
         let mut list = DirList::Opened { depth: self.depth, it: rd };
         if let Some(ref mut cmp) = self.opts.sorter {
             let mut entries: Vec<_> = list.collect();
             entries.sort_by(|a, b| {
                 match (a, b) {
                     (&Ok(ref a), &Ok(ref b)) => {
-                        cmp(&a.file_name(), &b.file_name())
+                        cmp(a, b)
                     }
                     (&Err(_), &Err(_)) => Ordering::Equal,
                     (&Ok(_), &Err(_)) => Ordering::Greater,
                     (&Err(_), &Ok(_)) => Ordering::Less,
                 }
             });
             list = DirList::Closed(entries.into_iter());
         }
+        if self.opts.follow_links {
+            let ancestor = Ancestor::new(&dent).map_err(|err| {
+                Error::from_io(self.depth, err)
+            })?;
+            self.stack_path.push(ancestor);
+        }
+        // We push this after stack_path since creating the Ancestor can fail.
+        // If it fails, then we return the error and won't descend.
         self.stack_list.push(list);
-        if self.opts.follow_links {
-            self.stack_path.push(dent.path().to_path_buf());
-        }
+        Ok(())
     }
 
     fn pop(&mut self) {
         self.stack_list.pop().expect("cannot pop from empty stack");
         if self.opts.follow_links {
             self.stack_path.pop().expect("BUG: list/path stacks out of sync");
         }
         // If everything in the stack is already closed, then there is
         // room for at least one more open descriptor and it will
         // always be at the top of the stack.
         self.oldest_opened = min(self.oldest_opened, self.stack_list.len());
     }
 
     fn follow(&self, mut dent: DirEntry) -> Result<DirEntry> {
-        dent = try!(DirEntry::from_link(self.depth,
-                                        dent.path().to_path_buf()));
+        dent = DirEntry::from_link(self.depth, dent.path().to_path_buf())?;
         // The only way a symlink can cause a loop is if it points
         // to a directory. Otherwise, it always points to a leaf
         // and we can omit any loop checks.
-        if dent.file_type().is_dir() {
-            try!(self.check_loop(dent.path()));
+        if dent.is_dir() {
+            self.check_loop(dent.path())?;
         }
         Ok(dent)
     }
 
     fn check_loop<P: AsRef<Path>>(&self, child: P) -> Result<()> {
+        let hchild = Handle::from_path(&child).map_err(|err| {
+            Error::from_io(self.depth, err)
+        })?;
         for ancestor in self.stack_path.iter().rev() {
-            let same = try!(is_same_file(ancestor, &child).map_err(|err| {
+            let is_same = ancestor.is_same(&hchild).map_err(|err| {
                 Error::from_io(self.depth, err)
-            }));
-            if same {
+            })?;
+            if is_same {
                 return Err(Error {
                     depth: self.depth,
                     inner: ErrorInner::Loop {
-                        ancestor: ancestor.to_path_buf(),
+                        ancestor: ancestor.path.to_path_buf(),
                         child: child.as_ref().to_path_buf(),
                     },
                 });
             }
         }
         Ok(())
     }
 
@@ -633,83 +926,119 @@ impl DirList {
     fn close(&mut self) {
         if let DirList::Opened { .. } = *self {
             *self = DirList::Closed(self.collect::<Vec<_>>().into_iter());
         }
     }
 }
 
 impl Iterator for DirList {
-    type Item = Result<fs::DirEntry>;
+    type Item = Result<DirEntry>;
 
     #[inline(always)]
-    fn next(&mut self) -> Option<Result<fs::DirEntry>> {
+    fn next(&mut self) -> Option<Result<DirEntry>> {
         match *self {
             DirList::Closed(ref mut it) => it.next(),
             DirList::Opened { depth, ref mut it } => match *it {
                 Err(ref mut err) => err.take().map(Err),
-                Ok(ref mut rd) => rd.next().map(|r| r.map_err(|err| {
-                    Error::from_io(depth + 1, err)
-                })),
+                Ok(ref mut rd) => rd.next().map(|r| match r {
+                    Ok(r) => DirEntry::from_entry(depth + 1, &r),
+                    Err(err) => Err(Error::from_io(depth + 1, err))
+                }),
             }
         }
     }
 }
 
 impl DirEntry {
     /// The full path that this entry represents.
     ///
     /// The full path is created by joining the parents of this entry up to the
-    /// root initially given to `WalkDir::new` with the file name of this
+    /// root initially given to [`WalkDir::new`] with the file name of this
     /// entry.
     ///
     /// Note that this *always* returns the path reported by the underlying
     /// directory entry, even when symbolic links are followed. To get the
-    /// target path, use `path_is_symbolic_link` to (cheaply) check if
-    /// this entry corresponds to a symbolic link, and `std::fs::read_link` to
-    /// resolve the target.
+    /// target path, use [`path_is_symlink`] to (cheaply) check if this entry
+    /// corresponds to a symbolic link, and [`std::fs::read_link`] to resolve
+    /// the target.
+    ///
+    /// [`WalkDir::new`]: struct.WalkDir.html#method.new
+    /// [`path_is_symlink`]: struct.DirEntry.html#method.path_is_symlink
+    /// [`std::fs::read_link`]: https://doc.rust-lang.org/stable/std/fs/fn.read_link.html
     pub fn path(&self) -> &Path {
         &self.path
     }
 
     /// Returns `true` if and only if this entry was created from a symbolic
-    /// link. This is unaffected by the `follow_links` setting.
+    /// link. This is unaffected by the [`follow_links`] setting.
     ///
-    /// When `true`, the value returned by the `path` method is a
+    /// When `true`, the value returned by the [`path`] method is a
     /// symbolic link name. To get the full target path, you must call
-    /// `std::fs::read_link(entry.path())`.
-    pub fn path_is_symbolic_link(&self) -> bool {
+    /// [`std::fs::read_link(entry.path())`].
+    ///
+    /// [`path`]: struct.DirEntry.html#method.path
+    /// [`follow_links`]: struct.WalkDir.html#method.follow_links
+    /// [`std::fs::read_link(entry.path())`]: https://doc.rust-lang.org/stable/std/fs/fn.read_link.html
+    pub fn path_is_symlink(&self) -> bool {
         self.ty.is_symlink() || self.follow_link
     }
 
     /// Return the metadata for the file that this entry points to.
     ///
-    /// This will follow symbolic links if and only if the `WalkDir` value
-    /// has `follow_links` enabled.
+    /// This will follow symbolic links if and only if the [`WalkDir`] value
+    /// has [`follow_links`] enabled.
     ///
     /// # Platform behavior
     ///
-    /// This always calls `std::fs::symlink_metadata`.
+    /// This always calls [`std::fs::symlink_metadata`].
+    ///
+    /// If this entry is a symbolic link and [`follow_links`] is enabled, then
+    /// [`std::fs::metadata`] is called instead.
+    ///
+    /// # Errors
+    ///
+    /// Similar to [`std::fs::metadata`], returns errors for path values that
+    /// the program does not have permissions to access or if the path does not
+    /// exist.
     ///
-    /// If this entry is a symbolic link and `follow_links` is enabled, then
-    /// `std::fs::metadata` is called instead.
+    /// [`WalkDir`]: struct.WalkDir.html
+    /// [`follow_links`]: struct.WalkDir.html#method.follow_links
+    /// [`std::fs::metadata`]: https://doc.rust-lang.org/std/fs/fn.metadata.html
+    /// [`std::fs::symlink_metadata`]: https://doc.rust-lang.org/stable/std/fs/fn.symlink_metadata.html
     pub fn metadata(&self) -> Result<fs::Metadata> {
+        self.metadata_internal()
+    }
+
+    #[cfg(windows)]
+    fn metadata_internal(&self) -> Result<fs::Metadata> {
+        if self.follow_link {
+            fs::metadata(&self.path)
+        } else {
+            Ok(self.metadata.clone())
+        }.map_err(|err| Error::from_entry(self, err))
+    }
+
+    #[cfg(not(windows))]
+    fn metadata_internal(&self) -> Result<fs::Metadata> {
         if self.follow_link {
             fs::metadata(&self.path)
         } else {
             fs::symlink_metadata(&self.path)
         }.map_err(|err| Error::from_entry(self, err))
     }
 
     /// Return the file type for the file that this entry points to.
     ///
-    /// If this is a symbolic link and `follow_links` is `true`, then this
+    /// If this is a symbolic link and [`follow_links`] is `true`, then this
     /// returns the type of the target.
     ///
     /// This never makes any system calls.
+    ///
+    /// [`follow_links`]: struct.WalkDir.html#method.follow_links
     pub fn file_type(&self) -> fs::FileType {
         self.ty
     }
 
     /// Return the file name of this entry.
     ///
     /// If this entry has no file name (e.g., `/`), then the full path is
     /// returned.
@@ -721,224 +1050,477 @@ impl DirEntry {
     ///
     /// The smallest depth is `0` and always corresponds to the path given
     /// to the `new` function on `WalkDir`. Its direct descendents have depth
     /// `1`, and their descendents have depth `2`, and so on.
     pub fn depth(&self) -> usize {
         self.depth
     }
 
-    /// Returns the underlying `d_ino` field in the contained `dirent`
-    /// structure.
-    #[cfg(unix)]
-    pub fn ino(&self) -> u64 {
-        self.ino
+    /// Returns true if and only if this entry points to a directory.
+    ///
+    /// This works around a bug in Rust's standard library:
+    /// https://github.com/rust-lang/rust/issues/46484
+    #[cfg(windows)]
+    fn is_dir(&self) -> bool {
+        use std::os::windows::fs::MetadataExt;
+        use winapi::um::winnt::FILE_ATTRIBUTE_DIRECTORY;
+        self.metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY != 0
     }
 
-    #[cfg(not(unix))]
+    /// Returns true if and only if this entry points to a directory.
+    #[cfg(not(windows))]
+    fn is_dir(&self) -> bool {
+        self.ty.is_dir()
+    }
+
+    #[cfg(windows)]
     fn from_entry(depth: usize, ent: &fs::DirEntry) -> Result<DirEntry> {
-        let ty = try!(ent.file_type().map_err(|err| {
-            Error::from_path(depth, ent.path(), err)
-        }));
+        let path = ent.path();
+        let ty = ent.file_type().map_err(|err| {
+            Error::from_path(depth, path.clone(), err)
+        })?;
+        let md = ent.metadata().map_err(|err| {
+            Error::from_path(depth, path.clone(), err)
+        })?;
         Ok(DirEntry {
-            path: ent.path(),
+            path: path,
             ty: ty,
             follow_link: false,
             depth: depth,
+            metadata: md,
         })
     }
 
     #[cfg(unix)]
     fn from_entry(depth: usize, ent: &fs::DirEntry) -> Result<DirEntry> {
         use std::os::unix::fs::DirEntryExt;
 
-        let ty = try!(ent.file_type().map_err(|err| {
+        let ty = ent.file_type().map_err(|err| {
             Error::from_path(depth, ent.path(), err)
-        }));
+        })?;
         Ok(DirEntry {
             path: ent.path(),
             ty: ty,
             follow_link: false,
             depth: depth,
             ino: ent.ino(),
         })
     }
 
-    #[cfg(not(unix))]
+    #[cfg(not(any(unix, windows)))]
+    fn from_entry(depth: usize, ent: &fs::DirEntry) -> Result<DirEntry> {
+        use std::os::unix::fs::DirEntryExt;
+
+        let ty = ent.file_type().map_err(|err| {
+            Error::from_path(depth, ent.path(), err)
+        })?;
+        Ok(DirEntry {
+            path: ent.path(),
+            ty: ty,
+            follow_link: false,
+            depth: depth,
+        })
+    }
+
+    #[cfg(windows)]
     fn from_link(depth: usize, pb: PathBuf) -> Result<DirEntry> {
-        let md = try!(fs::metadata(&pb).map_err(|err| {
+        let md = fs::metadata(&pb).map_err(|err| {
             Error::from_path(depth, pb.clone(), err)
-        }));
+        })?;
         Ok(DirEntry {
             path: pb,
             ty: md.file_type(),
             follow_link: true,
             depth: depth,
+            metadata: md,
         })
     }
 
     #[cfg(unix)]
     fn from_link(depth: usize, pb: PathBuf) -> Result<DirEntry> {
         use std::os::unix::fs::MetadataExt;
 
-        let md = try!(fs::metadata(&pb).map_err(|err| {
+        let md = fs::metadata(&pb).map_err(|err| {
             Error::from_path(depth, pb.clone(), err)
-        }));
+        })?;
         Ok(DirEntry {
             path: pb,
             ty: md.file_type(),
             follow_link: true,
             depth: depth,
             ino: md.ino(),
         })
     }
+
+    #[cfg(not(any(unix, windows)))]
+    fn from_link(depth: usize, pb: PathBuf) -> Result<DirEntry> {
+        use std::os::unix::fs::MetadataExt;
+
+        let md = fs::metadata(&pb).map_err(|err| {
+            Error::from_path(depth, pb.clone(), err)
+        })?;
+        Ok(DirEntry {
+            path: pb,
+            ty: md.file_type(),
+            follow_link: true,
+            depth: depth,
+        })
+    }
 }
 
 impl Clone for DirEntry {
-    #[cfg(not(unix))]
+    #[cfg(windows)]
     fn clone(&self) -> DirEntry {
         DirEntry {
             path: self.path.clone(),
             ty: self.ty,
             follow_link: self.follow_link,
             depth: self.depth,
+            metadata: self.metadata.clone(),
         }
     }
 
     #[cfg(unix)]
     fn clone(&self) -> DirEntry {
         DirEntry {
             path: self.path.clone(),
             ty: self.ty,
             follow_link: self.follow_link,
             depth: self.depth,
             ino: self.ino,
         }
     }
+
+    #[cfg(not(any(unix, windows)))]
+    fn clone(&self) -> DirEntry {
+        DirEntry {
+            path: self.path.clone(),
+            ty: self.ty,
+            follow_link: self.follow_link,
+            depth: self.depth,
+            ino: self.ino,
+        }
+    }
 }
 
 impl fmt::Debug for DirEntry {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "DirEntry({:?})", self.path)
     }
 }
 
 /// A recursive directory iterator that skips entries.
 ///
+/// Values of this type are created by calling [`.filter_entry()`] on an
+/// `IntoIter`, which is formed by calling [`.into_iter()`] on a `WalkDir`.
+///
 /// Directories that fail the predicate `P` are skipped. Namely, they are
 /// never yielded and never descended into.
 ///
-/// Entries that are skipped with the `min_depth` and `max_depth` options are
-/// not passed through this filter.
+/// Entries that are skipped with the [`min_depth`] and [`max_depth`] options
+/// are not passed through this filter.
 ///
 /// If opening a handle to a directory resulted in an error, then it is yielded
 /// and no corresponding call to the predicate is made.
 ///
 /// Type parameter `I` refers to the underlying iterator and `P` refers to the
 /// predicate, which is usually `FnMut(&DirEntry) -> bool`.
-pub struct IterFilterEntry<I, P> {
+///
+/// [`.filter_entry()`]: struct.IntoIter.html#method.filter_entry
+/// [`.into_iter()`]: struct.WalkDir.html#into_iter.v
+/// [`min_depth`]: struct.WalkDir.html#method.min_depth
+/// [`max_depth`]: struct.WalkDir.html#method.max_depth
+#[derive(Debug)]
+pub struct FilterEntry<I, P> {
     it: I,
     predicate: P,
 }
 
-impl<I, P> Iterator for IterFilterEntry<I, P>
-        where I: WalkDirIterator<Item=Result<DirEntry>>,
-              P: FnMut(&DirEntry) -> bool {
+impl<P> Iterator for FilterEntry<IntoIter, P>
+where P: FnMut(&DirEntry) -> bool
+{
     type Item = Result<DirEntry>;
 
+    /// Advances the iterator and returns the next value.
+    ///
+    /// # Errors
+    ///
+    /// If the iterator fails to retrieve the next value, this method returns
+    /// an error value. The error will be wrapped in an `Option::Some`.
     fn next(&mut self) -> Option<Result<DirEntry>> {
         loop {
             let dent = match self.it.next() {
                 None => return None,
                 Some(result) => itry!(result),
             };
             if !(self.predicate)(&dent) {
-                if dent.file_type().is_dir() {
+                if dent.is_dir() {
                     self.it.skip_current_dir();
                 }
                 continue;
             }
             return Some(Ok(dent));
         }
     }
 }
 
-impl<I, P> WalkDirIterator for IterFilterEntry<I, P>
-        where I: WalkDirIterator<Item=Result<DirEntry>>,
-              P: FnMut(&DirEntry) -> bool {
-    fn skip_current_dir(&mut self) {
+impl<P> FilterEntry<IntoIter, P> where P: FnMut(&DirEntry) -> bool {
+    /// Yields only entries which satisfy the given predicate and skips
+    /// descending into directories that do not satisfy the given predicate.
+    ///
+    /// The predicate is applied to all entries. If the predicate is
+    /// true, iteration carries on as normal. If the predicate is false, the
+    /// entry is ignored and if it is a directory, it is not descended into.
+    ///
+    /// This is often more convenient to use than [`skip_current_dir`]. For
+    /// example, to skip hidden files and directories efficiently on unix
+    /// systems:
+    ///
+    /// ```no_run
+    /// use walkdir::{DirEntry, WalkDir};
+    /// # use walkdir::Error;
+    ///
+    /// fn is_hidden(entry: &DirEntry) -> bool {
+    ///     entry.file_name()
+    ///          .to_str()
+    ///          .map(|s| s.starts_with("."))
+    ///          .unwrap_or(false)
+    /// }
+    ///
+    /// # fn try_main() -> Result<(), Error> {
+    /// for entry in WalkDir::new("foo")
+    ///                      .into_iter()
+    ///                      .filter_entry(|e| !is_hidden(e)) {
+    ///     println!("{}", entry?.path().display());
+    /// }
+    /// # Ok(())
+    /// # }
+    /// ```
+    ///
+    /// Note that the iterator will still yield errors for reading entries that
+    /// may not satisfy the predicate.
+    ///
+    /// Note that entries skipped with [`min_depth`] and [`max_depth`] are not
+    /// passed to this predicate.
+    ///
+    /// Note that if the iterator has `contents_first` enabled, then this
+    /// method is no different than calling the standard `Iterator::filter`
+    /// method (because directory entries are yielded after they've been
+    /// descended into).
+    ///
+    /// [`skip_current_dir`]: #method.skip_current_dir
+    /// [`min_depth`]: struct.WalkDir.html#method.min_depth
+    /// [`max_depth`]: struct.WalkDir.html#method.max_depth
+    pub fn filter_entry(self, predicate: P) -> FilterEntry<Self, P> {
+        FilterEntry { it: self, predicate: predicate }
+    }
+
+    /// Skips the current directory.
+    ///
+    /// This causes the iterator to stop traversing the contents of the least
+    /// recently yielded directory. This means any remaining entries in that
+    /// directory will be skipped (including sub-directories).
+    ///
+    /// Note that the ergonomics of this method are questionable since it
+    /// borrows the iterator mutably. Namely, you must write out the looping
+    /// condition manually. For example, to skip hidden entries efficiently on
+    /// unix systems:
+    ///
+    /// ```no_run
+    /// use walkdir::{DirEntry, WalkDir};
+    ///
+    /// fn is_hidden(entry: &DirEntry) -> bool {
+    ///     entry.file_name()
+    ///          .to_str()
+    ///          .map(|s| s.starts_with("."))
+    ///          .unwrap_or(false)
+    /// }
+    ///
+    /// let mut it = WalkDir::new("foo").into_iter();
+    /// loop {
+    ///     let entry = match it.next() {
+    ///         None => break,
+    ///         Some(Err(err)) => panic!("ERROR: {}", err),
+    ///         Some(Ok(entry)) => entry,
+    ///     };
+    ///     if is_hidden(&entry) {
+    ///         if entry.file_type().is_dir() {
+    ///             it.skip_current_dir();
+    ///         }
+    ///         continue;
+    ///     }
+    ///     println!("{}", entry.path().display());
+    /// }
+    /// ```
+    ///
+    /// You may find it more convenient to use the [`filter_entry`] iterator
+    /// adapter. (See its documentation for the same example functionality as
+    /// above.)
+    ///
+    /// [`filter_entry`]: #method.filter_entry
+    pub fn skip_current_dir(&mut self) {
         self.it.skip_current_dir();
     }
 }
 
 /// An error produced by recursively walking a directory.
 ///
-/// This error type is a light wrapper around `std::io::Error`. In particular,
-/// it adds the following information:
+/// This error type is a light wrapper around [`std::io::Error`]. In
+/// particular, it adds the following information:
 ///
 /// * The depth at which the error occurred in the file tree, relative to the
 /// root.
 /// * The path, if any, associated with the IO error.
 /// * An indication that a loop occurred when following symbolic links. In this
 /// case, there is no underlying IO error.
 ///
-/// To maintain good ergnomics, this type has a
-/// `impl From<Error> for std::io::Error` defined so that you may use an
-/// `io::Result` with methods in this crate if you don't care about accessing
-/// the underlying error data in a structured form.
+/// To maintain good ergonomics, this type has a
+/// [`impl From<Error> for std::io::Error`][impl] defined which preserves the original context.
+/// This allows you to use an [`io::Result`] with methods in this crate if you don't care about
+/// accessing the underlying error data in a structured form.
+///
+/// [`std::io::Error`]: https://doc.rust-lang.org/stable/std/io/struct.Error.html
+/// [`io::Result`]: https://doc.rust-lang.org/stable/std/io/type.Result.html
+/// [impl]: struct.Error.html#impl-From%3CError%3E
 #[derive(Debug)]
 pub struct Error {
     depth: usize,
     inner: ErrorInner,
 }
 
 #[derive(Debug)]
 enum ErrorInner {
     Io { path: Option<PathBuf>, err: io::Error },
     Loop { ancestor: PathBuf, child: PathBuf },
 }
 
 impl Error {
     /// Returns the path associated with this error if one exists.
     ///
     /// For example, if an error occurred while opening a directory handle,
-    /// the error will include the path passed to `std::fs::read_dir`.
+    /// the error will include the path passed to [`std::fs::read_dir`].
+    ///
+    /// [`std::fs::read_dir`]: https://doc.rust-lang.org/stable/std/fs/fn.read_dir.html
     pub fn path(&self) -> Option<&Path> {
         match self.inner {
             ErrorInner::Io { path: None, .. } => None,
             ErrorInner::Io { path: Some(ref path), .. } => Some(path),
             ErrorInner::Loop { ref child, .. } => Some(child),
         }
     }
 
     /// Returns the path at which a cycle was detected.
     ///
-    /// If no cycle was detected, `None` is returned.
+    /// If no cycle was detected, [`None`] is returned.
     ///
     /// A cycle is detected when a directory entry is equivalent to one of
     /// its ancestors.
     ///
     /// To get the path to the child directory entry in the cycle, use the
-    /// `path` method.
+    /// [`path`] method.
+    ///
+    /// [`None`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#variant.None
+    /// [`path`]: struct.Error.html#path
     pub fn loop_ancestor(&self) -> Option<&Path> {
         match self.inner {
             ErrorInner::Loop { ref ancestor, .. } => Some(ancestor),
             _ => None,
         }
     }
 
     /// Returns the depth at which this error occurred relative to the root.
     ///
-    /// The smallest depth is `0` and always corresponds to the path given
-    /// to the `new` function on `WalkDir`. Its direct descendents have depth
+    /// The smallest depth is `0` and always corresponds to the path given to
+    /// the [`new`] function on [`WalkDir`]. Its direct descendents have depth
     /// `1`, and their descendents have depth `2`, and so on.
+    ///
+    /// [`new`]: struct.WalkDir.html#method.new
+    /// [`WalkDir`]: struct.WalkDir.html
     pub fn depth(&self) -> usize {
         self.depth
     }
 
+    /// Inspect the original [`io::Error`] if there is one.
+    ///
+    /// [`None`] is returned if the [`Error`] doesn't correspond to an
+    /// [`io::Error`]. This might happen, for example, when the error was
+    /// produced because a cycle was found in the directory tree while
+    /// following symbolic links.
+    ///
+    /// This method returns a borrowed value that is bound to the lifetime of the [`Error`]. To
+    /// obtain an owned value, the [`into_io_error`] can be used instead.
+    ///
+    /// > This is the original [`io::Error`] and is _not_ the same as
+    /// > [`impl From<Error> for std::io::Error`][impl] which contains additional context about the
+    /// error.
+    ///
+    /// # Example
+    ///
+    /// ```rust,no-run
+    /// use std::io;
+    /// use std::path::Path;
+    ///
+    /// use walkdir::WalkDir;
+    ///
+    /// for entry in WalkDir::new("foo") {
+    ///     match entry {
+    ///         Ok(entry) => println!("{}", entry.path().display()),
+    ///         Err(err) => {
+    ///             let path = err.path().unwrap_or(Path::new("")).display();
+    ///             println!("failed to access entry {}", path);
+    ///             if let Some(inner) = err.io_error() {
+    ///                 match inner.kind() {
+    ///                     io::ErrorKind::InvalidData => {
+    ///                         println!(
+    ///                             "entry contains invalid data: {}",
+    ///                             inner)
+    ///                     }
+    ///                     io::ErrorKind::PermissionDenied => {
+    ///                         println!(
+    ///                             "Missing permission to read entry: {}",
+    ///                             inner)
+    ///                     }
+    ///                     _ => {
+    ///                         println!(
+    ///                             "Unexpected error occurred: {}",
+    ///                             inner)
+    ///                     }
+    ///                 }
+    ///             }
+    ///         }
+    ///     }
+    /// }
+    /// ```
+    ///
+    /// [`None`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#variant.None
+    /// [`io::Error`]: https://doc.rust-lang.org/stable/std/io/struct.Error.html
+    /// [`From`]: https://doc.rust-lang.org/stable/std/convert/trait.From.html
+    /// [`Error`]: struct.Error.html
+    /// [`into_io_error`]: struct.Error.html#method.into_io_error
+    /// [impl]: struct.Error.html#impl-From%3CError%3E
+    pub fn io_error(&self) -> Option<&io::Error> {
+       match self.inner {
+            ErrorInner::Io { ref err, .. } => Some(err),
+            ErrorInner::Loop { .. } => None,
+       }
+    }
+
+    /// Similar to [`io_error`] except consumes self to convert to the original
+    /// [`io::Error`] if one exists.
+    ///
+    /// [`io_error`]: struct.Error.html#method.io_error
+    /// [`io::Error`]: https://doc.rust-lang.org/stable/std/io/struct.Error.html
+    pub fn into_io_error(self) -> Option<io::Error> {
+       match self.inner {
+            ErrorInner::Io { err, .. } => Some(err),
+            ErrorInner::Loop { .. } => None,
+       }
+    }
+
     fn from_path(depth: usize, pb: PathBuf, err: io::Error) -> Self {
         Error {
             depth: depth,
             inner: ErrorInner::Io { path: Some(pb), err: err },
         }
     }
 
     fn from_entry(dent: &DirEntry, err: io::Error) -> Self {
@@ -990,17 +1572,29 @@ impl fmt::Display for Error {
                            {} points to an ancestor {}",
                        child.display(), ancestor.display())
             }
         }
     }
 }
 
 impl From<Error> for io::Error {
-    fn from(err: Error) -> io::Error {
-        match err {
-            Error { inner: ErrorInner::Io { err, .. }, .. } => err,
-            err @ Error { inner: ErrorInner::Loop { .. }, .. } => {
-                io::Error::new(io::ErrorKind::Other, err)
+    /// Convert the [`Error`] to an [`io::Error`], preserving the original [`Error`] as the ["inner
+    /// error"]. Note that this also makes the display of the error include the context.
+    ///
+    /// This is different from [`into_io_error`] which returns the original [`io::Error`].
+    ///
+    /// [`Error`]: struct.Error.html
+    /// [`io::Error`]: https://doc.rust-lang.org/stable/std/io/struct.Error.html
+    /// ["inner error"]: https://doc.rust-lang.org/std/io/struct.Error.html#method.into_inner
+    /// [`into_io_error`]: struct.WalkDir.html#method.into_io_error
+    fn from(walk_err: Error) -> io::Error {
+        let kind = match walk_err {
+            Error { inner: ErrorInner::Io { ref err, .. }, .. } => {
+                err.kind()
             }
-        }
+            Error { inner: ErrorInner::Loop { .. }, .. } => {
+                io::ErrorKind::Other
+            }
+        };
+        io::Error::new(kind, walk_err)
     }
 }
--- a/third_party/rust/walkdir/src/tests.rs
+++ b/third_party/rust/walkdir/src/tests.rs
@@ -1,19 +1,21 @@
 #![cfg_attr(windows, allow(dead_code, unused_imports))]
 
+use std::cmp;
 use std::env;
 use std::fs::{self, File};
 use std::io;
 use std::path::{Path, PathBuf};
+use std::collections::HashMap;
 
 use quickcheck::{Arbitrary, Gen, QuickCheck, StdGen};
 use rand::{self, Rng};
 
-use super::{DirEntry, WalkDir, WalkDirIterator, Iter, Error, ErrorInner};
+use super::{DirEntry, WalkDir, IntoIter, Error, ErrorInner};
 
 #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
 enum Tree {
     Dir(PathBuf, Vec<Tree>),
     File(PathBuf),
     Symlink {
         src: PathBuf,
         dst: PathBuf,
@@ -53,16 +55,51 @@ impl Tree {
                     stack.last_mut().unwrap().children_mut().push(node);
                 }
             }
         }
         assert_eq!(stack.len(), 1);
         Ok(stack.pop().unwrap())
     }
 
+    fn from_walk_with_contents_first<P, F>(
+        p: P,
+        f: F,
+    ) -> io::Result<Tree>
+    where P: AsRef<Path>, F: FnOnce(WalkDir) -> WalkDir {
+        let mut contents_of_dir_at_depth = HashMap::new();
+        let mut min_depth = ::std::usize::MAX;
+        let top_level_path = p.as_ref().to_path_buf();
+        for result in f(WalkDir::new(p).contents_first(true)) {
+            let dentry = try!(result);
+
+            let tree =
+            if dentry.file_type().is_dir() {
+                let any_contents = contents_of_dir_at_depth.remove(
+                    &(dentry.depth+1));
+            Tree::Dir(pb(dentry.file_name()), any_contents.unwrap_or_default())
+            } else {
+                if dentry.file_type().is_symlink() {
+                    let src = try!(dentry.path().read_link());
+                    let dst = pb(dentry.file_name());
+                    let dir = dentry.path().is_dir();
+                    Tree::Symlink { src: src, dst: dst, dir: dir }
+                } else {
+                    Tree::File(pb(dentry.file_name()))
+                }
+            };
+            contents_of_dir_at_depth.entry(
+                    dentry.depth).or_insert(vec!()).push(tree);
+            min_depth = cmp::min(min_depth, dentry.depth);
+        }
+        Ok(Tree::Dir(top_level_path,
+                contents_of_dir_at_depth.remove(&min_depth)
+                .unwrap_or_default()))
+    }
+
     fn name(&self) -> &Path {
         match *self {
             Tree::Dir(ref pb, _) => pb,
             Tree::File(ref pb) => pb,
             Tree::Symlink { ref dst, .. } => dst,
         }
     }
 
@@ -230,17 +267,17 @@ impl Arbitrary for Tree {
 enum WalkEvent {
     Dir(DirEntry),
     File(DirEntry),
     Exit,
 }
 
 struct WalkEventIter {
     depth: usize,
-    it: Iter,
+    it: IntoIter,
     next: Option<Result<DirEntry, Error>>,
 }
 
 impl From<WalkDir> for WalkEventIter {
     fn from(it: WalkDir) -> WalkEventIter {
         WalkEventIter { depth: 0, it: it.into_iter(), next: None }
     }
 }
@@ -294,20 +331,23 @@ fn tmpdir() -> TempDir {
     let p = env::temp_dir();
     let mut r = rand::thread_rng();
     let ret = p.join(&format!("rust-{}", r.next_u32()));
     fs::create_dir(&ret).unwrap();
     TempDir(ret)
 }
 
 fn dir_setup_with<F>(t: &Tree, f: F) -> (TempDir, Tree)
-        where F: FnOnce(WalkDir) -> WalkDir {
+        where F: Fn(WalkDir) -> WalkDir {
     let tmp = tmpdir();
     t.create_in(tmp.path()).unwrap();
-    let got = Tree::from_walk_with(tmp.path(), f).unwrap();
+    let got = Tree::from_walk_with(tmp.path(), &f).unwrap();
+    let got_cf = Tree::from_walk_with_contents_first(tmp.path(), &f).unwrap();
+    assert_eq!(got, got_cf);
+
     (tmp, got.unwrap_singleton().unwrap_singleton())
 }
 
 fn dir_setup(t: &Tree) -> (TempDir, Tree) {
     dir_setup_with(t, |wd| wd)
 }
 
 fn canon(unix: &str) -> String {
@@ -551,31 +591,39 @@ fn walk_dir_min_depth_1() {
 
 #[test]
 fn walk_dir_min_depth_2() {
     let exp = td("foo", vec![tf("bar"), tf("baz")]);
     let tmp = tmpdir();
     exp.create_in(tmp.path()).unwrap();
     let got = Tree::from_walk_with(tmp.path(), |wd| wd.min_depth(2))
                    .unwrap().unwrap_dir();
+    let got_cf = Tree::from_walk_with_contents_first(
+                    tmp.path(), |wd| wd.min_depth(2))
+                   .unwrap().unwrap_dir();
+    assert_eq!(got, got_cf);
     assert_tree_eq!(exp, td("foo", got));
 }
 
 #[test]
 fn walk_dir_min_depth_3() {
     let exp = td("foo", vec![
         tf("bar"),
         td("abc", vec![tf("xyz")]),
         tf("baz"),
     ]);
     let tmp = tmpdir();
     exp.create_in(tmp.path()).unwrap();
     let got = Tree::from_walk_with(tmp.path(), |wd| wd.min_depth(3))
                    .unwrap().unwrap_dir();
     assert_eq!(vec![tf("xyz")], got);
+    let got_cf = Tree::from_walk_with_contents_first(
+                    tmp.path(), |wd| wd.min_depth(3))
+                   .unwrap().unwrap_dir();
+    assert_eq!(got, got_cf);
 }
 
 #[test]
 fn walk_dir_max_depth_1() {
     let exp = td("foo", vec![tf("bar")]);
     let (_tmp, got) = dir_setup_with(&exp, |wd| wd.max_depth(1));
     assert_tree_eq!(td("foo", vec![]), got);
 }
@@ -610,16 +658,20 @@ fn walk_dir_min_max_depth() {
         td("abc", vec![tf("xyz")]),
         tf("baz"),
     ]);
     let tmp = tmpdir();
     exp.create_in(tmp.path()).unwrap();
     let got = Tree::from_walk_with(tmp.path(),
                                    |wd| wd.min_depth(2).max_depth(2))
                    .unwrap().unwrap_dir();
+    let got_cf = Tree::from_walk_with_contents_first(tmp.path(),
+                                   |wd| wd.min_depth(2).max_depth(2))
+                   .unwrap().unwrap_dir();
+    assert_eq!(got, got_cf);
     assert_tree_eq!(
         td("foo", vec![tf("bar"), td("abc", vec![]), tf("baz")]),
         td("foo", got));
 }
 
 #[test]
 fn walk_dir_skip() {
     let exp = td("foo", vec![
@@ -704,39 +756,60 @@ fn walk_dir_sort() {
         tf("bar"),
         td("abc", vec![tf("fit")]),
         tf("faz"),
     ]);
     let tmp = tmpdir();
     let tmp_path = tmp.path();
     let tmp_len = tmp_path.to_str().unwrap().len();
     exp.create_in(tmp_path).unwrap();
-    let it = WalkDir::new(tmp_path).sort_by(|a,b| a.cmp(b)).into_iter();
+    let it = WalkDir::new(tmp_path)
+        .sort_by(|a,b| a.file_name().cmp(b.file_name()))
+        .into_iter();
     let got = it.map(|d| {
         let path = d.unwrap();
         let path = &path.path().to_str().unwrap()[tmp_len..];
         path.replace("\\", "/")
     }).collect::<Vec<String>>();
-    assert_eq!(got,
+    assert_eq!(
+        got,
         ["", "/foo", "/foo/abc", "/foo/abc/fit", "/foo/bar", "/foo/faz"]);
 }
 
 #[test]
 fn walk_dir_sort_small_fd_max() {
     let exp = td("foo", vec![
         tf("bar"),
         td("abc", vec![tf("fit")]),
         tf("faz"),
     ]);
     let tmp = tmpdir();
     let tmp_path = tmp.path();
     let tmp_len = tmp_path.to_str().unwrap().len();
     exp.create_in(tmp_path).unwrap();
-    let it =
-        WalkDir::new(tmp_path).max_open(1).sort_by(|a,b| a.cmp(b)).into_iter();
+    let it = WalkDir::new(tmp_path)
+        .max_open(1)
+        .sort_by(|a,b| a.file_name().cmp(b.file_name()))
+        .into_iter();
     let got = it.map(|d| {
         let path = d.unwrap();
         let path = &path.path().to_str().unwrap()[tmp_len..];
         path.replace("\\", "/")
     }).collect::<Vec<String>>();
-    assert_eq!(got,
+    assert_eq!(
+        got,
         ["", "/foo", "/foo/abc", "/foo/abc/fit", "/foo/bar", "/foo/faz"]);
 }
+
+#[test]
+fn walk_dir_send_sync_traits() {
+    use FilterEntry;
+
+    fn assert_send<T: Send>() {}
+    fn assert_sync<T: Sync>() {}
+
+    assert_send::<WalkDir>();
+    assert_sync::<WalkDir>();
+    assert_send::<IntoIter>();
+    assert_sync::<IntoIter>();
+    assert_send::<FilterEntry<IntoIter, u8>>();
+    assert_sync::<FilterEntry<IntoIter, u8>>();
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/walkdir/src/unix.rs
@@ -0,0 +1,16 @@
+use DirEntry;
+
+/// Unix-specific extension methods for `walkdir::DirEntry`
+pub trait DirEntryExt {
+    /// Returns the underlying `d_ino` field in the contained `dirent`
+    /// structure.
+    fn ino(&self) -> u64;
+}
+
+impl DirEntryExt for DirEntry {
+    /// Returns the underlying `d_ino` field in the contained `dirent`
+    /// structure.
+    fn ino(&self) -> u64 {
+        self.ino
+    }
+}