[rustyline] Add host support for unix systems.

This change very slightly tweaks rustyline (a 2 line change) to remove
the requirement of using the dirs::crate. Since windows builds through
cygwin anyway this just assumes the std::env "$HOME" will be set if
built for host targets. This change also updates the library to support
the version of nix we use in tree. These small modifications allow
rustyline to build with host support correctly.

Change-Id: I155afa94a0535300a5d465aa3596afb3437d2e3b
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/rust-mirrors/rustyline/+/419454
Reviewed-by: Tyler Mandry <tmandry@google.com>
diff --git a/Cargo.toml b/Cargo.toml
index 43a3648..9179889 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,8 +27,7 @@
 utf8parse = "0.1"
 
 [target.'cfg(all(unix, not(any(target_os = "fuchsia"))))'.dependencies]
-dirs = "1.0"
-nix = "0.11"
+nix = "0.18"
 
 [target.'cfg(target_os = "fuchsia")'.dependencies]
 fuchsia-zircon = "0.3.2"
diff --git a/src/completion.rs b/src/completion.rs
index b71e762..96642a1 100644
--- a/src/completion.rs
+++ b/src/completion.rs
@@ -267,8 +267,6 @@
     break_chars: &[u8],
     quote: Quote,
 ) -> Result<Vec<Pair>> {
-    #[cfg(all(unix, not(any(target_os = "fuchsia"))))]
-    use dirs::home_dir;
     use std::env::current_dir;
 
     let sep = path::MAIN_SEPARATOR;
@@ -282,10 +280,10 @@
     let dir = {
         if dir_path.starts_with("~") {
             // ~[/...]
-            if let Some(home) = home_dir() {
+            if let Ok(home) = std::env::var("HOME") {
                 match dir_path.strip_prefix("~") {
-                    Ok(rel_path) => home.join(rel_path),
-                    _ => home,
+                    Ok(rel_path) => path::PathBuf::from(home).join(rel_path),
+                    _ => path::PathBuf::from(home),
                 }
             } else {
                 dir_path.to_path_buf()
diff --git a/src/lib.rs b/src/lib.rs
index 530a8ef..8dcde0e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,8 +23,6 @@
 // TODO(tmandry): Remove all uses of try!()
 #![allow(deprecated)]
 
-#[cfg(all(unix, not(any(target_os = "fuchsia"))))]
-extern crate dirs;
 extern crate libc;
 #[macro_use]
 extern crate log;
diff --git a/src/tty/unix.rs b/src/tty/unix.rs
index ffcbc97..4255555 100644
--- a/src/tty/unix.rs
+++ b/src/tty/unix.rs
@@ -7,7 +7,7 @@
 
 use libc;
 use nix;
-use nix::poll::{self, EventFlags};
+use nix::poll::{self, PollFlags};
 use nix::sys::signal;
 use nix::sys::termios;
 use nix::sys::termios::SetArg;
@@ -335,7 +335,7 @@
             } else {
                 self.timeout_ms
             };
-            let mut fds = [poll::PollFd::new(STDIN_FILENO, EventFlags::POLLIN)];
+            let mut fds = [poll::PollFd::new(STDIN_FILENO, PollFlags::POLLIN)];
             match poll::poll(&mut fds, timeout_ms) {
                 Ok(n) if n == 0 => {
                     // single escape