From a1faa7cb14b4549ca395c1d62c9cd2b3f56c13dd Mon Sep 17 00:00:00 2001 From: Victor-Nicolae Savu Date: Thu, 5 Mar 2015 07:20:58 +0100 Subject: [PATCH 1/8] Updated to rust nightly 2015-03-04 --- Cargo.lock | 92 +++++++++++------------ Cargo.toml | 36 ++++----- src/bin/cargo.rs | 2 +- src/cargo/lib.rs | 4 +- src/cargo/ops/cargo_rustc/custom_build.rs | 4 +- src/cargo/sources/path.rs | 2 +- src/rustversion.txt | 2 +- 7 files changed, 67 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e572b30617..0c0568c7ef1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,26 +3,26 @@ name = "cargo" version = "0.1.0" dependencies = [ "advapi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.39 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.44 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "git2-curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)", "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "registry 0.1.0", - "rustc-serialize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "threadpool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -41,33 +41,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "curl" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl-sys 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "curl-sys" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "docopt" -version = "0.6.39" +version = "0.6.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -76,7 +77,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -88,11 +89,6 @@ dependencies = [ "miniz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "gcc" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "gcc" version = "0.3.1" @@ -105,8 +101,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -114,15 +110,15 @@ name = "git2-curl" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glob" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -145,13 +141,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libgit2-sys" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libssh2-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libssh2-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -165,12 +161,12 @@ dependencies = [ [[package]] name = "libssh2-sys" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -203,19 +199,15 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "pkg-config" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "pkg-config" version = "0.3.0" @@ -228,25 +220,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "registry" version = "0.1.0" dependencies = [ - "curl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "semver" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -266,7 +258,7 @@ dependencies = [ [[package]] name = "threadpool" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -283,16 +275,16 @@ name = "toml" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "url" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7117fc94890..927a0a5388f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,24 +10,24 @@ name = "cargo" path = "src/cargo/lib.rs" [dependencies] -toml = "0.1" -semver = "0.1" -curl = "0.2" -tar = "0.2" -flate2 = "0.2" -git2 = "0.2" -git2-curl = "0.2" -glob = "0.2" -time = "0.1" -log = "0.2" -env_logger = "0.2" -docopt = "0.6" -url = "0.2" -rustc-serialize = "0.3" -term = "0.1" -regex = "0.1" -threadpool = "0.1" -libc = "0.1" +toml = "0.1.18" +semver = "0.1.16" +curl = "0.2.1" +tar = "0.2.3" +flate2 = "0.2.0" +git2 = "0.2.1" +git2-curl = "0.2.1" +glob = "0.2.2" +time = "0.1.19" +log = "0.2.5" +env_logger = "0.2.2" +docopt = "0.6.44" +url = "0.2.23" +rustc-serialize = "0.3.1" +term = "0.1.13" +regex = "0.1.17" +threadpool = "0.1.1" +libc = "0.1.2" [target.i686-pc-windows-gnu.dependencies] winapi = "0.1" diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index d966d003442..c381d728a13 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -1,4 +1,4 @@ -#![feature(collections, core, io, path, process, fs, env, std_misc, os, old_io)] +#![feature(collections, core, io, path, fs, std_misc, os, old_io, exit_status)] extern crate "git2-curl" as git2_curl; extern crate "rustc-serialize" as rustc_serialize; diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 7defa760c6f..e90594d9e4a 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -1,6 +1,6 @@ #![deny(unused)] -#![feature(collections, hash, os, std_misc, unicode, env, core)] -#![feature(io, path, str_words, process, fs, old_io)] +#![feature(collections, hash, os, std_misc, unicode, core)] +#![feature(io, path, str_words, fs, old_io, exit_status)] #![cfg_attr(test, deny(warnings))] #[cfg(test)] extern crate hamcrest; diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index 60f936b16df..628fc7b545d 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -260,7 +260,7 @@ impl BuildOutput { let whence = format!("build script of `{}`", pkg_name); for line in input.lines() { - let mut iter = line.splitn(1, |&: c: char| c == ':'); + let mut iter = line.splitn(1, |c| c == ':'); if iter.next() != Some("cargo") { // skip this line since it doesn't start with "cargo:" continue; @@ -271,7 +271,7 @@ impl BuildOutput { }; // getting the `key=value` part of the line - let mut iter = data.splitn(1, |&: c: char| c == '='); + let mut iter = data.splitn(1, |c| c == '='); let key = iter.next(); let value = iter.next(); let (key, value) = match (key, value) { diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index 11352770e54..c94b91dd75c 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -77,7 +77,7 @@ impl<'a, 'b> PathSource<'a, 'b> { pub fn list_files(&self, pkg: &Package) -> CargoResult> { let root = pkg.root(); - let parse = |&: p: &String| { + let parse = |p: &String| { Pattern::new(p).map_err(|e| { human(format!("could not parse pattern `{}`: {}", p, e)) }) diff --git a/src/rustversion.txt b/src/rustversion.txt index 86e833e0e4c..ac5240e643f 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-02-27 +2015-03-04 From a14fafaf8dfadbfb1d440285e0ec75a38da92fa4 Mon Sep 17 00:00:00 2001 From: Victor-Nicolae Savu Date: Thu, 5 Mar 2015 22:41:59 +0100 Subject: [PATCH 2/8] removed [feature(env)] attributes --- tests/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests.rs b/tests/tests.rs index e92077c01bb..d526e975199 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1,5 +1,5 @@ #![feature(core, io, old_io, os, old_path)] -#![feature(std_misc, env, io, path, fs, tempdir, process)] +#![feature(std_misc, io, path, fs, tempdir)] extern crate "rustc-serialize" as serialize; extern crate cargo; From f74b4043a361e26d1cf6bb27278d0077a44a5f0c Mon Sep 17 00:00:00 2001 From: Victor-Nicolae Savu Date: Thu, 5 Mar 2015 23:04:40 +0100 Subject: [PATCH 3/8] fixed feature attribute --- tests/test_cargo_compile_custom_build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index 1eca4f43915..0f81ff23c73 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -24,7 +24,7 @@ test!(custom_build_script_failed { fn main() {} "#) .file("build.rs", r#" - #![feature(env)] + #![feature(exit_status)] fn main() { std::env::set_exit_status(101); } From 2fac34aa90f9cbe4cbbf9d79800c23c06069207f Mon Sep 17 00:00:00 2001 From: Victor-Nicolae Savu Date: Fri, 6 Mar 2015 22:52:55 +0100 Subject: [PATCH 4/8] Updated versions for rustc, curl, docopt and regex. --- Cargo.lock | 34 +++++++++++++++++----------------- Cargo.toml | 6 +++--- src/rustversion.txt | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c0568c7ef1..5cef0e23d7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,8 +3,8 @@ name = "cargo" version = "0.1.0" dependencies = [ "advapi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.44 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.45 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13,7 +13,7 @@ dependencies = [ "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)", "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "registry 0.1.0", "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -41,33 +41,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "curl" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl-sys 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "curl-sys" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "docopt" -version = "0.6.44" +version = "0.6.45" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -77,7 +77,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -110,7 +110,7 @@ name = "git2-curl" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", @@ -147,7 +147,7 @@ dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -166,7 +166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -199,7 +199,7 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -220,14 +220,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "registry" version = "0.1.0" dependencies = [ - "curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 927a0a5388f..012daed8e55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ path = "src/cargo/lib.rs" [dependencies] toml = "0.1.18" semver = "0.1.16" -curl = "0.2.1" +curl = "0.2.2" tar = "0.2.3" flate2 = "0.2.0" git2 = "0.2.1" @@ -21,11 +21,11 @@ glob = "0.2.2" time = "0.1.19" log = "0.2.5" env_logger = "0.2.2" -docopt = "0.6.44" +docopt = "0.6.45" url = "0.2.23" rustc-serialize = "0.3.1" term = "0.1.13" -regex = "0.1.17" +regex = "0.1.18" threadpool = "0.1.1" libc = "0.1.2" diff --git a/src/rustversion.txt b/src/rustversion.txt index ac5240e643f..d6eec4d2b56 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-03-04 +2015-03-05 From 035c1fecb4803feb5438bc0517a3ad83233a6f45 Mon Sep 17 00:00:00 2001 From: Victor-Nicolae Savu Date: Sat, 7 Mar 2015 00:54:30 +0100 Subject: [PATCH 5/8] Reverting to rustc nightly 2015-03-04 because threadpool build fails with more recent versions. --- src/rustversion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rustversion.txt b/src/rustversion.txt index d6eec4d2b56..ac5240e643f 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-03-05 +2015-03-04 From 97a2f2717098561d01936e7af1ffedfd875410bf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 9 Mar 2015 11:30:37 -0700 Subject: [PATCH 6/8] Update to rust master --- src/cargo/core/package_id_spec.rs | 3 ++- src/cargo/lib.rs | 4 ++-- src/cargo/ops/cargo_clean.rs | 5 +++-- src/cargo/ops/cargo_doc.rs | 4 ++-- src/cargo/ops/cargo_new.rs | 2 +- src/cargo/ops/cargo_package.rs | 6 +++--- src/cargo/ops/cargo_read_manifest.rs | 12 ++++++++---- src/cargo/ops/cargo_rustc/custom_build.rs | 2 +- src/cargo/ops/cargo_rustc/fingerprint.rs | 6 +++--- src/cargo/ops/cargo_rustc/layout.rs | 5 ++--- src/cargo/ops/cargo_rustc/mod.rs | 19 +++++++++---------- src/cargo/ops/cargo_test.rs | 6 +++--- src/cargo/ops/registry.rs | 4 ++-- src/cargo/sources/git/utils.rs | 4 ++-- src/cargo/sources/path.rs | 10 ++++++---- src/cargo/sources/registry.rs | 4 ++-- src/cargo/util/config.rs | 4 ++-- src/cargo/util/important_paths.rs | 6 +++--- src/cargo/util/toml.rs | 4 ++-- src/registry/lib.rs | 18 ++++++++++++------ src/rustversion.txt | 2 +- 21 files changed, 71 insertions(+), 59 deletions(-) diff --git a/src/cargo/core/package_id_spec.rs b/src/cargo/core/package_id_spec.rs index 087d996d0eb..e65c599805e 100644 --- a/src/cargo/core/package_id_spec.rs +++ b/src/cargo/core/package_id_spec.rs @@ -77,7 +77,8 @@ impl PackageIdSpec { (name_or_version.to_string(), Some(version)) } None => { - if name_or_version.char_at(0).is_alphabetic() { + if name_or_version.chars().next().unwrap() + .is_alphabetic() { (name_or_version.to_string(), None) } else { let version = try!(name_or_version.to_semver() diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index e90594d9e4a..a09b47adf65 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -1,6 +1,6 @@ #![deny(unused)] -#![feature(collections, hash, os, std_misc, unicode, core)] -#![feature(io, path, str_words, fs, old_io, exit_status)] +#![feature(hash, os, std_misc, unicode, core)] +#![feature(io, path, str_words, old_io, exit_status, fs_time)] #![cfg_attr(test, deny(warnings))] #[cfg(test)] extern crate hamcrest; diff --git a/src/cargo/ops/cargo_clean.rs b/src/cargo/ops/cargo_clean.rs index bbfab64c7ee..b9834526a7d 100644 --- a/src/cargo/ops/cargo_clean.rs +++ b/src/cargo/ops/cargo_clean.rs @@ -68,11 +68,12 @@ pub fn clean(manifest_path: &Path, opts: &CleanOptions) -> CargoResult<()> { } fn rm_rf(path: &Path) -> CargoResult<()> { - if path.is_dir() { + let m = fs::metadata(path); + if m.as_ref().map(|s| s.is_dir()) == Ok(true) { try!(fs::remove_dir_all(path).chain_error(|| { human("could not remove build directory") })); - } else if path.exists() { + } else if m.is_ok() { try!(fs::remove_file(path).chain_error(|| { human("failed to remove build artifact") })); diff --git a/src/cargo/ops/cargo_doc.rs b/src/cargo/ops/cargo_doc.rs index fd7304cafd2..94da98eef92 100644 --- a/src/cargo/ops/cargo_doc.rs +++ b/src/cargo/ops/cargo_doc.rs @@ -1,5 +1,5 @@ use std::collections::HashSet; -use std::io::prelude::*; +use std::fs; use std::path::Path; use std::process::Command; @@ -57,7 +57,7 @@ pub fn doc(manifest_path: &Path, let path = package.absolute_target_dir().join("doc").join(&name) .join("index.html"); - if path.exists() { + if fs::metadata(&path).is_ok() { open_docs(&path); } } diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index 5038495bc1f..efb7d99e49a 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -42,7 +42,7 @@ struct CargoNewConfig { pub fn new(opts: NewOptions, config: &Config) -> CargoResult<()> { let path = config.cwd().join(opts.path); - if path.exists() { + if fs::metadata(&path).is_ok() { return Err(human(format!("Destination `{}` already exists", path.display()))) } diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 6bf4a931a0c..f3364737a65 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -50,7 +50,7 @@ pub fn package(manifest_path: &Path, let filename = format!("package/{}-{}.crate", pkg.name(), pkg.version()); let dst = pkg.absolute_target_dir().join(&filename); - if dst.exists() { return Ok(Some(dst)) } + if fs::metadata(&dst).is_ok() { return Ok(Some(dst)) } let mut bomb = Bomb { path: Some(dst.clone()) }; @@ -104,7 +104,7 @@ fn check_metadata(pkg: &Package, config: &Config) -> CargoResult<()> { fn tar(pkg: &Package, src: &PathSource, config: &Config, dst: &Path) -> CargoResult<()> { - if dst.exists() { + if fs::metadata(&dst).is_ok() { return Err(human(format!("destination already exists: {}", dst.display()))) } @@ -149,7 +149,7 @@ fn run_verify(config: &Config, pkg: &Package, tar: &Path) let f = try!(GzDecoder::new(try!(File::open(tar)))); let dst = pkg.root().join(&format!("target/package/{}-{}", pkg.name(), pkg.version())); - if dst.exists() { + if fs::metadata(&dst).is_ok() { try!(fs::remove_dir_all(&dst)); } let mut archive = Archive::new(f); diff --git a/src/cargo/ops/cargo_read_manifest.rs b/src/cargo/ops/cargo_read_manifest.rs index 79de52a5e61..39c7f9edd4a 100644 --- a/src/cargo/ops/cargo_read_manifest.rs +++ b/src/cargo/ops/cargo_read_manifest.rs @@ -46,11 +46,13 @@ pub fn read_packages(path: &Path, source_id: &SourceId, config: &Config) // Don't recurse into git databases if dir.file_name().and_then(|s| s.to_str()) == Some(".git") { - return Ok(false); + return Ok(false) } // Don't automatically discover packages across git submodules - if dir != path && dir.join(".git").exists() { return Ok(false); } + if dir != path && fs::metadata(&dir.join(".git")).is_ok() { + return Ok(false) + } // Don't ever look at target directories if dir.file_name().and_then(|s| s.to_str()) == Some("target") && @@ -75,11 +77,13 @@ pub fn read_packages(path: &Path, source_id: &SourceId, config: &Config) fn walk(path: &Path, callback: &mut F) -> CargoResult<()> where F: FnMut(&Path) -> CargoResult { - if !path.is_dir() { return Ok(()) } + if fs::metadata(&path).map(|m| m.is_dir()) != Ok(true) { + return Ok(()) + } if !try!(callback(path)) { trace!("not processing {}", path.display()); - return Ok(()); + return Ok(()) } // Ignore any permission denied errors because temporary directories diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index 628fc7b545d..76ee30fb881 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -119,7 +119,7 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform, // // If we have an old build directory, then just move it into place, // otherwise create it! - if !build_output.exists() { + if fs::metadata(&build_output).is_err() { try!(fs::create_dir(&build_output).chain_error(|| { internal("failed to create script output directory for \ build command") diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index cc336e1144c..c80d26cde29 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -59,7 +59,7 @@ pub fn prepare_target<'a, 'b>(cx: &mut Context<'a, 'b>, if !target.profile().is_doc() { for filename in try!(cx.target_filenames(target)).iter() { let dst = root.join(filename); - missing_outputs |= !dst.exists(); + missing_outputs |= fs::metadata(&dst).is_err(); if target.profile().is_test() { cx.compilation.tests.push((target.name().to_string(), dst)); @@ -255,13 +255,13 @@ pub fn prepare_init(cx: &mut Context, pkg: &Package, kind: Kind) let new2 = new1.clone(); let work1 = Work::new(move |_| { - if !new1.exists() { + if fs::metadata(&new1).is_err() { try!(fs::create_dir(&new1)); } Ok(()) }); let work2 = Work::new(move |_| { - if !new2.exists() { + if fs::metadata(&new2).is_err() { try!(fs::create_dir(&new2)); } Ok(()) diff --git a/src/cargo/ops/cargo_rustc/layout.rs b/src/cargo/ops/cargo_rustc/layout.rs index 14591df5c96..1f6b2e50ec0 100644 --- a/src/cargo/ops/cargo_rustc/layout.rs +++ b/src/cargo/ops/cargo_rustc/layout.rs @@ -46,7 +46,6 @@ //! ``` use std::fs; -use std::io::prelude::*; use std::io; use std::path::{PathBuf, Path}; @@ -90,7 +89,7 @@ impl Layout { } pub fn prepare(&mut self) -> io::Result<()> { - if !self.root.exists() { + if fs::metadata(&self.root).is_err() { try!(fs::create_dir_all(&self.root)); } @@ -103,7 +102,7 @@ impl Layout { return Ok(()); fn mkdir(dir: &Path) -> io::Result<()> { - if !dir.exists() { + if fs::metadata(&dir).is_err() { try!(fs::create_dir(dir)); } Ok(()) diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 7553bc46de5..397e758b053 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -1,7 +1,7 @@ use std::collections::{HashSet, HashMap}; use std::dynamic_lib::DynamicLibrary; use std::env; -use std::ffi::{OsStr, AsOsStr, OsString}; +use std::ffi::OsString; use std::fs; use std::io::prelude::*; use std::path::{self, PathBuf}; @@ -368,7 +368,7 @@ fn rustc(package: &Package, target: &Target, // this manually for filename in filenames.iter() { let dst = root.join(filename); - if dst.exists() { + if fs::metadata(&dst).is_ok() { try!(fs::remove_file(&dst)); } } @@ -662,12 +662,12 @@ fn build_deps_args(cmd: &mut CommandPrototype, target: &Target, let layout = cx.layout(package, kind); cmd.arg("-L").arg(&{ let mut root = OsString::from_str("dependency="); - root.push_os_str(layout.root().as_os_str()); + root.push(layout.root()); root }); cmd.arg("-L").arg(&{ let mut deps = OsString::from_str("dependency="); - deps.push_os_str(layout.deps().as_os_str()); + deps.push(layout.deps()); deps }); @@ -695,12 +695,11 @@ fn build_deps_args(cmd: &mut CommandPrototype, target: &Target, for filename in try!(cx.target_filenames(target)).iter() { if filename.ends_with(".a") { continue } let mut v = OsString::new(); - v.push_os_str(OsStr::from_str(target.name())); - v.push_os_str(OsStr::from_str("=")); - v.push_os_str(layout.root().as_os_str()); - let s = path::MAIN_SEPARATOR.to_string(); - v.push_os_str(OsStr::from_str(&s)); - v.push_os_str(OsStr::from_str(&filename)); + v.push(target.name()); + v.push("="); + v.push(layout.root()); + v.push(&path::MAIN_SEPARATOR.to_string()); + v.push(&filename); cmd.arg("--extern").arg(&v); } Ok(()) diff --git a/src/cargo/ops/cargo_test.rs b/src/cargo/ops/cargo_test.rs index d4faec1d8b8..05469bf4ef4 100644 --- a/src/cargo/ops/cargo_test.rs +++ b/src/cargo/ops/cargo_test.rs @@ -1,4 +1,4 @@ -use std::ffi::{OsStr, OsString, AsOsStr}; +use std::ffi::OsString; use std::path::Path; use core::Source; @@ -80,8 +80,8 @@ pub fn run_tests(manifest_path: &Path, for (pkg, libs) in compile.libraries.iter() { for lib in libs.iter() { let mut arg = OsString::from_str(pkg.name()); - arg.push_os_str(OsStr::from_str("=")); - arg.push_os_str(lib.as_os_str()); + arg.push("="); + arg.push(lib); p.arg("--extern").arg(&arg); } } diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 8e8adfba14c..fbf3ea92df3 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; use std::env; -use std::fs::File; +use std::fs::{self, File}; use std::io::prelude::*; use std::iter::repeat; use std::path::{Path, PathBuf}; @@ -109,7 +109,7 @@ fn transmit(pkg: &Package, tarball: &Path, registry: &mut Registry) }; match *license_file { Some(ref file) => { - if !pkg.root().join(file).exists() { + if fs::metadata(&pkg.root().join(file)).is_err() { return Err(human(format!("the license file `{}` does not exist", file))) } diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index d467cbe2153..a49d500de81 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -150,7 +150,7 @@ impl GitRemote { fn clone_into(&self, dst: &Path) -> CargoResult { let url = self.url.to_string(); - if dst.exists() { + if fs::metadata(&dst).is_ok() { try!(fs::remove_dir_all(dst)); } try!(fs::create_dir_all(dst)); @@ -252,7 +252,7 @@ impl<'a> GitCheckout<'a> { human(format!("Couldn't mkdir {}", dirname.display())) })); - if into.exists() { + if fs::metadata(&into).is_ok() { try!(fs::remove_dir_all(into).chain_error(|| { human(format!("Couldn't rmdir {}", into.display())) })); diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index b64f4c1512c..6e56f9941a8 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -167,7 +167,7 @@ impl<'a, 'b> PathSource<'a, 'b> { // TODO: the `entry` has a mode we should be able to look at instead // of just calling stat() again - if file_path.is_dir() { + if fs::metadata(&file_path).map(|m| m.is_dir()) == Ok(true) { warn!(" found submodule {}", file_path.display()); let rel = file_path.relative_from(&root).unwrap(); let rel = try!(rel.to_str().chain_error(|| { @@ -223,14 +223,16 @@ impl<'a, 'b> PathSource<'a, 'b> { is_root: bool, filter: &mut F) -> CargoResult<()> where F: FnMut(&Path) -> bool { - if !path.is_dir() { + if fs::metadata(&path).map(|m| m.is_dir()) != Ok(true) { if (*filter)(path) { ret.push(path.to_path_buf()); } return Ok(()) } // Don't recurse into any sub-packages that we have - if !is_root && path.join("Cargo.toml").exists() { return Ok(()) } + if !is_root && fs::metadata(&path.join("Cargo.toml")).is_ok() { + return Ok(()) + } for dir in try!(fs::read_dir(path)) { let dir = try!(dir).path(); match (is_root, dir.file_name().and_then(|s| s.to_str())) { @@ -298,7 +300,7 @@ impl<'a, 'b> Source for PathSource<'a, 'b> { // condition where this path was rm'ed - either way, // we can ignore the error and treat the path's mtime // as 0. - let mtime = file.metadata().map(|s| s.modified()).unwrap_or(0); + let mtime = fs::metadata(&file).map(|s| s.modified()).unwrap_or(0); warn!("{} {}", mtime, file.display()); max = cmp::max(max, mtime); } diff --git a/src/cargo/sources/registry.rs b/src/cargo/sources/registry.rs index c28f9f269f2..e4e45bd5816 100644 --- a/src/cargo/sources/registry.rs +++ b/src/cargo/sources/registry.rs @@ -301,7 +301,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> { // TODO: should discover from the S3 redirect let filename = format!("{}-{}.crate", pkg.name(), pkg.version()); let dst = self.cache_path.join(&filename); - if dst.exists() { return Ok(dst) } + if fs::metadata(&dst).is_ok() { return Ok(dst) } try!(self.config.shell().status("Downloading", pkg)); try!(fs::create_dir_all(dst.parent().unwrap())); @@ -347,7 +347,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> { -> CargoResult { let dst = self.src_path.join(&format!("{}-{}", pkg.name(), pkg.version())); - if dst.join(".cargo-ok").exists() { return Ok(dst) } + if fs::metadata(&dst.join(".cargo-ok")).is_ok() { return Ok(dst) } try!(fs::create_dir_all(dst.parent().unwrap())); let f = try!(File::open(&tarball)); diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index ad8f359d31d..7677da2dad4 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -393,7 +393,7 @@ fn walk_tree(pwd: &Path, mut walk: F) -> CargoResult<()> loop { let possible = current.join(".cargo").join("config"); - if possible.exists() { + if fs::metadata(&possible).is_ok() { let file = try!(File::open(&possible)); try!(walk(file, &possible)); @@ -413,7 +413,7 @@ fn walk_tree(pwd: &Path, mut walk: F) -> CargoResult<()> })); if !pwd.starts_with(&home) { let config = home.join("config"); - if config.exists() { + if fs::metadata(&config).is_ok() { let file = try!(File::open(&config)); try!(walk(file, &config)); } diff --git a/src/cargo/util/important_paths.rs b/src/cargo/util/important_paths.rs index 7facb0980a6..365ddabe3e3 100644 --- a/src/cargo/util/important_paths.rs +++ b/src/cargo/util/important_paths.rs @@ -1,5 +1,5 @@ use std::env; -use std::io::prelude::*; +use std::fs; use std::path::{Path, PathBuf}; use util::{CargoResult, human, ChainError}; @@ -20,7 +20,7 @@ pub fn find_project_manifest(pwd: &Path, file: &str) -> CargoResult { loop { let manifest = current.join(file); - if manifest.exists() { + if fs::metadata(&manifest).is_ok() { return Ok(manifest) } @@ -50,7 +50,7 @@ pub fn find_root_manifest_for_cwd(manifest_path: Option) pub fn find_project_manifest_exact(pwd: &Path, file: &str) -> CargoResult { let manifest = pwd.join(file); - if manifest.exists() { + if fs::metadata(&manifest).is_ok() { Ok(manifest) } else { Err(human(format!("Could not find `{}` in `{}`", diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 80a80e776b5..35e130418be 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -44,7 +44,7 @@ impl Layout { } fn try_add_file(files: &mut Vec, file: PathBuf) { - if file.exists() { + if fs::metadata(&file).is_ok() { files.push(file); } } @@ -72,7 +72,7 @@ pub fn project_layout(root_path: &Path) -> Layout { let mut benches = vec!(); let lib_canidate = root_path.join("src").join("lib.rs"); - if lib_canidate.exists() { + if fs::metadata(&lib_canidate).is_ok() { lib = Some(lib_canidate); } diff --git a/src/registry/lib.rs b/src/registry/lib.rs index d6022b12716..93b94b66cd3 100644 --- a/src/registry/lib.rs +++ b/src/registry/lib.rs @@ -1,4 +1,4 @@ -#![feature(core, io, path, fs)] +#![feature(io, path)] extern crate curl; extern crate "rustc-serialize" as rustc_serialize; @@ -142,14 +142,14 @@ impl Registry { (json.len() >> 8) as u8, (json.len() >> 16) as u8, (json.len() >> 24) as u8, - ].iter().cloned()); - w.extend(json.as_bytes().iter().cloned()); + ].iter().map(|x| *x)); + w.extend(json.as_bytes().iter().map(|x| *x)); w.extend([ (stat.len() >> 0) as u8, (stat.len() >> 8) as u8, (stat.len() >> 16) as u8, (stat.len() >> 24) as u8, - ].iter().cloned()); + ].iter().map(|x| *x)); w }; let tarball = try!(File::open(tarball).map_err(Error::Io)); @@ -158,7 +158,10 @@ impl Registry { let url = format!("{}/api/v1/crates/new", self.host); - let token = try!(self.token.as_ref().ok_or(Error::TokenMissing)); + let token = match self.token.as_ref() { + Some(s) => s, + None => return Err(Error::TokenMissing), + }; let request = self.handle.put(url, &mut body) .content_length(size) .header("Accept", "application/json") @@ -209,7 +212,10 @@ impl Registry { .content_type("application/json"); if authorized == Auth::Authorized { - let token = try!(self.token.as_ref().ok_or(Error::TokenMissing)); + let token = match self.token.as_ref() { + Some(s) => s, + None => return Err(Error::TokenMissing), + }; req = req.header("Authorization", &token); } match body { diff --git a/src/rustversion.txt b/src/rustversion.txt index ac5240e643f..427618d4847 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-03-04 +2015-03-09 From cbed1912633def1b6c1ac1369b28a99825b81d0a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 9 Mar 2015 11:38:46 -0700 Subject: [PATCH 7/8] Reduce usage of unstable features --- src/bin/bench.rs | 6 +++--- src/bin/build.rs | 4 ++-- src/bin/cargo.rs | 9 ++++----- src/bin/clean.rs | 4 ++-- src/bin/doc.rs | 2 +- src/bin/login.rs | 7 +++++-- src/bin/pkgid.rs | 2 +- src/bin/run.rs | 2 +- src/bin/test.rs | 6 +++--- src/bin/update.rs | 4 ++-- src/bin/verify_project.rs | 5 ++--- 11 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/bin/bench.rs b/src/bin/bench.rs index 00edc0051d0..d910784e6bb 100644 --- a/src/bin/bench.rs +++ b/src/bin/bench.rs @@ -51,17 +51,17 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { config.shell().set_verbose(options.flag_verbose); let ops = ops::TestOptions { - name: options.flag_bench.as_ref().map(|s| s.as_slice()), + name: options.flag_bench.as_ref().map(|s| &s[..]), no_run: options.flag_no_run, compile_opts: ops::CompileOptions { env: "bench", config: config, jobs: options.flag_jobs, - target: options.flag_target.as_ref().map(|s| s.as_slice()), + target: options.flag_target.as_ref().map(|s| &s[..]), dev_deps: true, features: &options.flag_features, no_default_features: options.flag_no_default_features, - spec: options.flag_package.as_ref().map(|s| s.as_slice()), + spec: options.flag_package.as_ref().map(|s| &s[..]), lib_only: false, exec_engine: None, }, diff --git a/src/bin/build.rs b/src/bin/build.rs index 0784c047a97..3408f40774d 100644 --- a/src/bin/build.rs +++ b/src/bin/build.rs @@ -62,11 +62,11 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { env: env, config: config, jobs: options.flag_jobs, - target: options.flag_target.as_ref().map(|t| t.as_slice()), + target: options.flag_target.as_ref().map(|t| &t[..]), dev_deps: false, features: &options.flag_features, no_default_features: options.flag_no_default_features, - spec: options.flag_package.as_ref().map(|s| s.as_slice()), + spec: options.flag_package.as_ref().map(|s| &s[..]), lib_only: options.flag_lib, exec_engine: None, }; diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index c381d728a13..7707762cd6a 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -1,4 +1,4 @@ -#![feature(collections, core, io, path, fs, std_misc, os, old_io, exit_status)] +#![feature(core, io, path, std_misc, exit_status)] extern crate "git2-curl" as git2_curl; extern crate "rustc-serialize" as rustc_serialize; @@ -10,7 +10,6 @@ extern crate toml; use std::collections::BTreeSet; use std::env; use std::fs; -use std::io::prelude::*; use std::io; use std::path::{PathBuf, Path}; use std::process::Command; @@ -210,7 +209,7 @@ fn list_commands() -> BTreeSet { let command = &filename[ command_prefix.len().. filename.len() - env::consts::EXE_SUFFIX.len()]; - commands.insert(String::from_str(command)); + commands.insert(command.to_string()); } } } @@ -225,7 +224,7 @@ fn list_commands() -> BTreeSet { #[cfg(unix)] fn is_executable(path: &Path) -> bool { use std::os::unix::prelude::*; - path.metadata().map(|m| { + fs::metadata(path).map(|m| { m.permissions().mode() & 0o001 == 0o001 }).unwrap_or(false) } @@ -239,7 +238,7 @@ fn find_command(cmd: &str) -> Option { let command_exe = format!("cargo-{}{}", cmd, env::consts::EXE_SUFFIX); let dirs = list_command_directory(); let mut command_paths = dirs.iter().map(|dir| dir.join(&command_exe)); - command_paths.find(|path| path.exists()) + command_paths.find(|path| fs::metadata(&path).is_ok()) } /// List candidate locations where subcommands might be installed. diff --git a/src/bin/clean.rs b/src/bin/clean.rs index a530b9b245a..cc66f29fdcf 100644 --- a/src/bin/clean.rs +++ b/src/bin/clean.rs @@ -38,8 +38,8 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path)); let opts = ops::CleanOptions { config: config, - spec: options.flag_package.as_ref().map(|s| s.as_slice()), - target: options.flag_target.as_ref().map(|s| s.as_slice()), + spec: options.flag_package.as_ref().map(|s| &s[..]), + target: options.flag_target.as_ref().map(|s| &s[..]), }; ops::clean(&root, &opts).map(|_| None).map_err(|err| { CliError::from_boxed(err, 101) diff --git a/src/bin/doc.rs b/src/bin/doc.rs index 0aba6b5bb78..dbb1b5ab4f9 100644 --- a/src/bin/doc.rs +++ b/src/bin/doc.rs @@ -56,7 +56,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { dev_deps: false, features: &options.flag_features, no_default_features: options.flag_no_default_features, - spec: options.flag_package.as_ref().map(|s| s.as_slice()), + spec: options.flag_package.as_ref().map(|s| &s[..]), lib_only: false, exec_engine: None, }, diff --git a/src/bin/login.rs b/src/bin/login.rs index 2726c937cf8..16c8f7c85cc 100644 --- a/src/bin/login.rs +++ b/src/bin/login.rs @@ -1,4 +1,5 @@ -use std::old_io; +use std::io::prelude::*; +use std::io; use cargo::ops; use cargo::core::{SourceId, Source}; @@ -38,7 +39,9 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { let host = options.flag_host.clone().unwrap_or(config.api); println!("please visit {}me and paste the API Token below", host); - let line = try!(old_io::stdin().read_line()); + let mut line = String::new(); + let input = io::stdin(); + try!(input.lock().read_line(&mut line)); Ok(line) })(); diff --git a/src/bin/pkgid.rs b/src/bin/pkgid.rs index f0409b11f24..c5fe8de37d9 100644 --- a/src/bin/pkgid.rs +++ b/src/bin/pkgid.rs @@ -46,7 +46,7 @@ pub fn execute(options: Options, config.shell().set_verbose(options.flag_verbose); let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path.clone())); - let spec = options.arg_spec.as_ref().map(|s| s.as_slice()); + let spec = options.arg_spec.as_ref().map(|s| &s[..]); let spec = try!(ops::pkgid(&root, spec, config).map_err(|err| { CliError::from_boxed(err, 101) })); diff --git a/src/bin/run.rs b/src/bin/run.rs index 2b8c7b9733b..f786832a2b1 100644 --- a/src/bin/run.rs +++ b/src/bin/run.rs @@ -57,7 +57,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { env: env, config: config, jobs: options.flag_jobs, - target: options.flag_target.as_ref().map(|t| t.as_slice()), + target: options.flag_target.as_ref().map(|t| &t[..]), dev_deps: true, features: &options.flag_features, no_default_features: options.flag_no_default_features, diff --git a/src/bin/test.rs b/src/bin/test.rs index 7eedac427ec..6c7e18e63e9 100644 --- a/src/bin/test.rs +++ b/src/bin/test.rs @@ -53,17 +53,17 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { config.shell().set_verbose(options.flag_verbose); let ops = ops::TestOptions { - name: options.flag_test.as_ref().map(|s| s.as_slice()), + name: options.flag_test.as_ref().map(|s| &s[..]), no_run: options.flag_no_run, compile_opts: ops::CompileOptions { env: "test", config: config, jobs: options.flag_jobs, - target: options.flag_target.as_ref().map(|s| s.as_slice()), + target: options.flag_target.as_ref().map(|s| &s[..]), dev_deps: true, features: &options.flag_features, no_default_features: options.flag_no_default_features, - spec: options.flag_package.as_ref().map(|s| s.as_slice()), + spec: options.flag_package.as_ref().map(|s| &s[..]), lib_only: false, exec_engine: None, }, diff --git a/src/bin/update.rs b/src/bin/update.rs index 4fdeebfb685..61df563d30b 100644 --- a/src/bin/update.rs +++ b/src/bin/update.rs @@ -57,8 +57,8 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { let update_opts = ops::UpdateOptions { aggressive: options.flag_aggressive, - precise: options.flag_precise.as_ref().map(|s| s.as_slice()), - to_update: spec.map(|s| s.as_slice()), + precise: options.flag_precise.as_ref().map(|s| &s[..]), + to_update: spec.map(|s| &s[..]), config: config, }; diff --git a/src/bin/verify_project.rs b/src/bin/verify_project.rs index 33c271a9e5e..43056c13d25 100644 --- a/src/bin/verify_project.rs +++ b/src/bin/verify_project.rs @@ -32,10 +32,9 @@ pub fn execute(args: Flags, config: &Config) -> CliResult> { let file = File::open(&args.flag_manifest_path); match file.and_then(|mut f| f.read_to_string(&mut contents)) { Ok(()) => {}, - Err(e) => return fail("invalid", format!("error reading file: {}", - e).as_slice()) + Err(e) => return fail("invalid", &format!("error reading file: {}", e)) }; - match toml::Parser::new(contents.as_slice()).parse() { + match toml::Parser::new(&contents).parse() { None => return fail("invalid", "invalid-format"), Some(..) => {} }; From 22e7ede6c885e30a8c083dfe2cb76fffe42f9fb7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 9 Mar 2015 12:07:35 -0700 Subject: [PATCH 8/8] Fix all tests from the update to rust master --- Cargo.lock | 18 +++++++++++ Cargo.toml | 23 +++++--------- src/bin/cargo.rs | 41 +++++++++++++++++-------- tests/support/paths.rs | 26 ++++++++++++++-- tests/support/registry.rs | 4 +-- tests/test_cargo_build_auth.rs | 50 +++++++++++-------------------- tests/test_cargo_compile.rs | 3 +- tests/test_cargo_cross_compile.rs | 8 ++--- tests/test_cargo_new.rs | 3 +- tests/test_cargo_registry.rs | 4 +-- tests/tests.rs | 5 ++-- 11 files changed, 110 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5cef0e23d7d..1285b0254b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,7 @@ dependencies = [ "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -218,6 +219,15 @@ name = "pnacl-build-helper" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "regex" version = "0.1.18" @@ -246,6 +256,14 @@ name = "tar" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "tempdir" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "term" version = "0.1.13" diff --git a/Cargo.toml b/Cargo.toml index 012daed8e55..8e9ae24f8a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,20 +28,16 @@ term = "0.1.13" regex = "0.1.18" threadpool = "0.1.1" libc = "0.1.2" +registry = { path = "src/registry" } -[target.i686-pc-windows-gnu.dependencies] -winapi = "0.1" -advapi32-sys = "*" +[target.i686-pc-windows-gnu] +dependencies = { winapi = "0.1", advapi32-sys = "*" } +[target.x86_64-pc-windows-gnu] +dependencies = { winapi = "0.1", advapi32-sys = "*" } -[target.x86_64-pc-windows-gnu.dependencies] -winapi = "0.1" -advapi32-sys = "*" - -[dev-dependencies.hamcrest] -git = "https://github.com/carllerche/hamcrest-rust.git" - -[dependencies.registry] -path = "src/registry" +[dev-dependencies] +tempdir = "0.3" +hamcrest = { git = "https://github.com/carllerche/hamcrest-rust.git" } [[bin]] name = "cargo" @@ -50,9 +46,6 @@ doc = false [[test]] name = "tests" -[[bench]] -name = "tests" -path = "tests/tests.rs" [[test]] name = "resolve" diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index 7707762cd6a..733d0dd1cf2 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -101,39 +101,54 @@ fn execute(flags: Flags, config: &Config) -> CliResult> { return Ok(None) } - let (mut args, command) = match &flags.arg_command[..] { + let args = match &flags.arg_command[..] { + // For the commands `cargo` and `cargo help`, re-execute ourselves as + // `cargo -h` so we can go through the normal process of printing the + // help message. "" | "help" if flags.arg_args.len() == 0 => { config.shell().set_verbose(true); - let args = &["foo".to_string(), "-h".to_string()]; + let args = &["cargo".to_string(), "-h".to_string()]; let r = cargo::call_main_without_stdin(execute, config, USAGE, args, false); - cargo::process_executed(r, &mut **config.shell()); + cargo::process_executed(r, &mut config.shell()); return Ok(None) } + + // For `cargo help -h` and `cargo help --help`, print out the help + // message for `cargo help` "help" if flags.arg_args[0] == "-h" || - flags.arg_args[0] == "--help" => - (flags.arg_args, "help"), - "help" => (vec!["-h".to_string()], &flags.arg_args[0][..]), - s => (flags.arg_args.clone(), s), + flags.arg_args[0] == "--help" => { + vec!["cargo".to_string(), "help".to_string(), "help".to_string()] + } + + // For `cargo help foo`, print out the usage message for the specified + // subcommand by executing the command with the `-h` flag. + "help" => { + vec!["cargo".to_string(), "help".to_string(), + flags.arg_args[0].clone()] + } + + // For all other invocations, we're of the form `cargo foo args...`. We + // use the exact environment arguments to preserve tokens like `--` for + // example. + _ => env::args().collect(), }; - args.insert(0, command.to_string()); - args.insert(0, "foo".to_string()); macro_rules! cmd{ ($name:ident) => ( - if command == stringify!($name).replace("_", "-") { + if args[1] == stringify!($name).replace("_", "-") { mod $name; config.shell().set_verbose(true); let r = cargo::call_main_without_stdin($name::execute, config, $name::USAGE, &args, false); - cargo::process_executed(r, &mut **config.shell()); + cargo::process_executed(r, &mut config.shell()); return Ok(None) } ) } each_subcommand!(cmd); - execute_subcommand(&command, &args, &mut config.shell()); + execute_subcommand(&args[1], &args, &mut config.shell()); Ok(None) } @@ -230,7 +245,7 @@ fn is_executable(path: &Path) -> bool { } #[cfg(windows)] fn is_executable(path: &Path) -> bool { - path.is_file() + fs::metadata(path).map(|m| m.is_file()) == Ok(true) } /// Get `Command` to run given command. diff --git a/tests/support/paths.rs b/tests/support/paths.rs index 8cbd2406372..491990c0a0a 100644 --- a/tests/support/paths.rs +++ b/tests/support/paths.rs @@ -1,7 +1,7 @@ use std::env; use std::fs; use std::io::prelude::*; -use std::io; +use std::io::{self, ErrorKind}; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; @@ -32,7 +32,29 @@ impl CargoPathExt for Path { */ fn rm_rf(&self) -> io::Result<()> { if self.exists() { - fs::remove_dir_all(self) + for file in fs::read_dir(self).unwrap() { + let file = try!(file).path(); + + if file.is_dir() { + try!(file.rm_rf()); + } else { + // On windows we can't remove a readonly file, and git will + // often clone files as readonly. As a result, we have some + // special logic to remove readonly files on windows. + match fs::remove_file(&file) { + Ok(()) => {} + Err(ref e) if cfg!(windows) && + e.kind() == ErrorKind::PermissionDenied => { + let mut p = file.metadata().unwrap().permissions(); + p.set_readonly(false); + fs::set_permissions(&file, p).unwrap(); + try!(fs::remove_file(&file)); + } + Err(e) => return Err(e) + } + } + } + fs::remove_dir(self) } else { Ok(()) } diff --git a/tests/support/registry.rs b/tests/support/registry.rs index ec8fa0ab3c6..9cb06dfaa36 100644 --- a/tests/support/registry.rs +++ b/tests/support/registry.rs @@ -88,8 +88,8 @@ pub fn mock_pkg_yank(name: &str, version: &str, deps: &[(&str, &str, &str)], let file = match name.len() { 1 => format!("1/{}", name), 2 => format!("2/{}", name), - 3 => format!("3/{}/{}", name.slice_to(1), name), - _ => format!("{}/{}/{}", name.slice(0, 2), name.slice(2, 4), name), + 3 => format!("3/{}/{}", &name[..1], name), + _ => format!("{}/{}/{}", &name[0..2], &name[2..4], name), }; publish(file.as_slice(), line.as_slice()); } diff --git a/tests/test_cargo_build_auth.rs b/tests/test_cargo_build_auth.rs index 1c7705167a0..eaa495f3e5f 100644 --- a/tests/test_cargo_build_auth.rs +++ b/tests/test_cargo_build_auth.rs @@ -1,6 +1,7 @@ use std::collections::HashSet; -use std::old_io::net::tcp::TcpAcceptor; -use std::old_io::{TcpListener, Listener, Acceptor, BufferedStream}; +use std::io::BufStream; +use std::io::prelude::*; +use std::net::TcpListener; use std::thread; use git2; @@ -11,23 +12,12 @@ use hamcrest::assert_that; fn setup() { } -struct Closer { a: TcpAcceptor } - -impl Drop for Closer { - fn drop(&mut self) { - let _ = self.a.close_accept(); - } -} - // Test that HTTP auth is offered from `credential.helper` test!(http_auth_offered { - let mut listener = TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = listener.socket_name().unwrap(); - let mut a = listener.listen().unwrap(); - let a2 = a.clone(); - let _c = Closer { a: a2 }; + let a = TcpListener::bind("127.0.0.1:0").unwrap(); + let addr = a.socket_addr().unwrap(); - fn headers(rdr: &mut R) -> HashSet { + fn headers(rdr: &mut BufRead) -> HashSet { let valid = ["GET", "Authorization", "Accept", "User-Agent"]; rdr.lines().map(|s| s.unwrap()) .take_while(|s| s.len() > 2) @@ -39,7 +29,7 @@ test!(http_auth_offered { } let t = thread::spawn(move|| { - let mut s = BufferedStream::new(a.accept().unwrap()); + let mut s = BufStream::new(a.accept().unwrap().0); let req = headers(&mut s); s.write_all(b"\ HTTP/1.1 401 Unauthorized\r\n\ @@ -53,7 +43,7 @@ test!(http_auth_offered { ].into_iter().map(|s| s.to_string()).collect()); drop(s); - let mut s = BufferedStream::new(a.accept().unwrap()); + let mut s = BufStream::new(a.accept().unwrap().0); let req = headers(&mut s); s.write_all(b"\ HTTP/1.1 401 Unauthorized\r\n\ @@ -91,7 +81,7 @@ test!(http_auth_offered { script.display().to_string().as_slice()).unwrap(); let p = project("foo") - .file("Cargo.toml", format!(r#" + .file("Cargo.toml", &format!(r#" [project] name = "foo" version = "0.0.1" @@ -99,7 +89,7 @@ test!(http_auth_offered { [dependencies.bar] git = "http://127.0.0.1:{}/foo/bar" - "#, addr.port).as_slice()) + "#, addr.port())) .file("src/main.rs", ""); assert_that(p.cargo_process("build").arg("-v"), @@ -125,17 +115,14 @@ Caused by: // Boy, sure would be nice to have a TLS implementation in rust! test!(https_something_happens { - let mut listener = TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = listener.socket_name().unwrap(); - let mut a = listener.listen().unwrap(); - let a2 = a.clone(); - let _c = Closer { a: a2 }; + let a = TcpListener::bind("127.0.0.1:0").unwrap(); + let addr = a.socket_addr().unwrap(); let t = thread::spawn(move|| { drop(a.accept().unwrap()); }); let p = project("foo") - .file("Cargo.toml", format!(r#" + .file("Cargo.toml", &format!(r#" [project] name = "foo" version = "0.0.1" @@ -143,7 +130,7 @@ test!(https_something_happens { [dependencies.bar] git = "https://127.0.0.1:{}/foo/bar" - "#, addr.port).as_slice()) + "#, addr.port())) .file("src/main.rs", ""); assert_that(p.cargo_process("build").arg("-v"), @@ -175,11 +162,8 @@ Caused by: // Boy, sure would be nice to have an SSH implementation in rust! test!(ssh_something_happens { - let mut listener = TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = listener.socket_name().unwrap(); - let mut a = listener.listen().unwrap(); - let a2 = a.clone(); - let _c = Closer { a: a2 }; + let a = TcpListener::bind("127.0.0.1:0").unwrap(); + let addr = a.socket_addr().unwrap(); let t = thread::spawn(move|| { drop(a.accept().unwrap()); }); @@ -193,7 +177,7 @@ test!(ssh_something_happens { [dependencies.bar] git = "ssh://127.0.0.1:{}/foo/bar" - "#, addr.port).as_slice()) + "#, addr.port()).as_slice()) .file("src/main.rs", ""); assert_that(p.cargo_process("build").arg("-v"), diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 3fb658dbb80..253f81812b8 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1,6 +1,7 @@ use std::env; -use std::fs::{self, TempDir, File}; +use std::fs::{self, File}; use std::io::prelude::*; +use tempdir::TempDir; use support::{project, execs, main_file, basic_bin_manifest}; use support::{COMPILING, RUNNING, ProjectBuilder}; diff --git a/tests/test_cargo_cross_compile.rs b/tests/test_cargo_cross_compile.rs index fcb67755823..aaf38bfb94a 100644 --- a/tests/test_cargo_cross_compile.rs +++ b/tests/test_cargo_cross_compile.rs @@ -142,7 +142,7 @@ test!(plugin_deps { use rustc::plugin::Registry; use syntax::ast::TokenTree; use syntax::codemap::Span; - use syntax::ext::base::{ExtCtxt, MacExpr, MacResult}; + use syntax::ext::base::{ExtCtxt, MacEager, MacResult}; #[plugin_registrar] pub fn foo(reg: &mut Registry) { @@ -151,7 +151,7 @@ test!(plugin_deps { fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { - MacExpr::new(quote_expr!(cx, 1)) + MacEager::expr(quote_expr!(cx, 1)) } "#); let baz = project("baz") @@ -222,7 +222,7 @@ test!(plugin_to_the_max { use rustc::plugin::Registry; use syntax::ast::TokenTree; use syntax::codemap::Span; - use syntax::ext::base::{ExtCtxt, MacExpr, MacResult}; + use syntax::ext::base::{ExtCtxt, MacEager, MacResult}; #[plugin_registrar] pub fn foo(reg: &mut Registry) { @@ -231,7 +231,7 @@ test!(plugin_to_the_max { fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { - MacExpr::new(quote_expr!(cx, baz::baz())) + MacEager::expr(quote_expr!(cx, baz::baz())) } "#); let baz = project("baz") diff --git a/tests/test_cargo_new.rs b/tests/test_cargo_new.rs index ef873526a7b..d2bfd438dcc 100644 --- a/tests/test_cargo_new.rs +++ b/tests/test_cargo_new.rs @@ -1,6 +1,7 @@ -use std::fs::{self, File, TempDir}; +use std::fs::{self, File}; use std::io::prelude::*; use std::env; +use tempdir::TempDir; use support::{execs, paths, cargo_dir}; use hamcrest::{assert_that, existing_file, existing_dir, is_not}; diff --git a/tests/test_cargo_registry.rs b/tests/test_cargo_registry.rs index 730b314142f..47ae6bd2563 100644 --- a/tests/test_cargo_registry.rs +++ b/tests/test_cargo_registry.rs @@ -441,7 +441,7 @@ test!(update_with_lockfile_if_packages_missing { execs().with_status(0)); p.root().move_into_the_past().unwrap(); - fs::remove_dir_all(&paths::home().join(".cargo/registry")).unwrap(); + paths::home().join(".cargo/registry").rm_rf().unwrap(); assert_that(p.cargo("build"), execs().with_status(0).with_stdout(format!("\ {updating} registry `[..]` @@ -470,7 +470,7 @@ test!(update_lockfile { r::mock_pkg("bar", "0.0.2", &[]); r::mock_pkg("bar", "0.0.3", &[]); - fs::remove_dir_all(&paths::home().join(".cargo/registry")).unwrap(); + paths::home().join(".cargo/registry").rm_rf().unwrap(); println!("0.0.2 update"); assert_that(p.cargo("update") .arg("-p").arg("bar").arg("--precise").arg("0.0.2"), diff --git a/tests/tests.rs b/tests/tests.rs index d526e975199..356690d860c 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1,5 +1,5 @@ -#![feature(core, io, old_io, os, old_path)] -#![feature(std_misc, io, path, fs, tempdir)] +#![feature(core, io, old_io, old_path)] +#![feature(std_misc, io, path, fs, net, path_ext, fs_time, fs_walk)] extern crate "rustc-serialize" as serialize; extern crate cargo; @@ -9,6 +9,7 @@ extern crate hamcrest; extern crate tar; extern crate term; extern crate url; +extern crate tempdir; #[macro_use] extern crate log;