From 973f6712f0d6c75232f24144eba3216b08bcabeb Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Feb 2015 00:06:12 +0100 Subject: [PATCH] rustup --- Cargo.lock | 137 ++++++++++++---------- src/bin/cargo.rs | 6 +- src/cargo/core/manifest.rs | 4 +- src/cargo/core/package.rs | 4 +- src/cargo/core/package_id.rs | 8 +- src/cargo/core/resolver/mod.rs | 4 +- src/cargo/core/source.rs | 4 +- src/cargo/lib.rs | 4 +- src/cargo/ops/cargo_compile.rs | 14 +-- src/cargo/ops/cargo_new.rs | 2 +- src/cargo/ops/cargo_rustc/compilation.rs | 4 +- src/cargo/ops/cargo_rustc/context.rs | 4 +- src/cargo/ops/cargo_rustc/custom_build.rs | 2 +- src/cargo/ops/cargo_rustc/fingerprint.rs | 2 +- src/cargo/ops/cargo_rustc/job.rs | 2 +- src/cargo/ops/cargo_rustc/job_queue.rs | 6 +- src/cargo/ops/cargo_rustc/mod.rs | 6 +- src/cargo/sources/path.rs | 2 +- src/cargo/util/dependency_queue.rs | 4 +- src/cargo/util/errors.rs | 15 ++- src/cargo/util/graph.rs | 12 +- src/cargo/util/hex.rs | 2 +- src/cargo/util/lev_distance.rs | 2 +- src/cargo/util/process_builder.rs | 2 +- src/rustversion.txt | 2 +- tests/support/mod.rs | 8 +- tests/test_cargo_build_auth.rs | 8 +- tests/test_cargo_compile_git_deps.rs | 2 +- tests/tests.rs | 3 +- 29 files changed, 144 insertions(+), 131 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 629585c5d..860815871 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,25 +3,25 @@ name = "cargo" version = "0.1.0" dependencies = [ "advapi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.37 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.39 (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.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "git2-curl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)", - "log 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "registry 0.1.0", - "rustc-serialize 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,7 +29,7 @@ name = "advapi32-sys" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -39,33 +39,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "curl" -version = "0.1.14" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.1.10 (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.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.20 (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.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "curl-sys" -version = "0.1.8" +version = "0.1.10" 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.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.6 (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)", "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "docopt" -version = "0.6.37" +version = "0.6.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -73,8 +73,8 @@ name = "env_logger" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -91,14 +91,19 @@ name = "gcc" version = "0.1.7" source = "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 = "git2" -version = "0.1.17" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -106,9 +111,9 @@ name = "git2-curl" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "url 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -119,14 +124,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hamcrest" version = "0.1.0" -source = "git+https://github.com/carllerche/hamcrest-rust.git#70d572f27ebbffb5a8d67ed2c890241d6d82d0a3" +source = "git+https://github.com/carllerche/hamcrest-rust.git#af4418fea7d8cdba6469d43ff45a50dd5f7ad357" [[package]] name = "kernel32-sys" -version = "0.0.7" +version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -136,13 +141,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libgit2-sys" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libssh2-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libssh2-sys 0.1.9 (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)", + "pkg-config 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -155,25 +160,26 @@ dependencies = [ [[package]] name = "libssh2-sys" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "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)", + "pkg-config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libz-sys" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pkg-config 0.1.7 (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 = "log" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -192,12 +198,12 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.3.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.2.1 (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.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -207,7 +213,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.2.1" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -217,40 +228,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "registry" version = "0.1.0" dependencies = [ - "curl 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-serialize" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "semver" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tar" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "term" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -267,21 +278,21 @@ name = "toml" version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-serialize 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "url" -version = "0.2.20" +version = "0.2.21" 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.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index b69459da7..ff7491851 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -1,4 +1,4 @@ -#![feature(collections, core, io, path, env)] +#![feature(collections, core, old_io, old_path, env)] extern crate "git2-curl" as git2_curl; extern crate "rustc-serialize" as rustc_serialize; @@ -99,7 +99,7 @@ fn execute(flags: Flags, config: &Config) -> CliResult> { return Ok(None) } - let (mut args, command) = match &flags.arg_command[] { + let (mut args, command) = match &flags.arg_command[..] { "" | "help" if flags.arg_args.len() == 0 => { config.shell().set_verbose(true); let args = &["foo".to_string(), "-h".to_string()]; @@ -111,7 +111,7 @@ fn execute(flags: Flags, config: &Config) -> CliResult> { "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][]), + "help" => (vec!["-h".to_string()], &flags.arg_args[0][..]), s => (flags.arg_args.clone(), s), }; args.insert(0, command.to_string()); diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs index 05ba153ff..f942a2471 100644 --- a/src/cargo/core/manifest.rs +++ b/src/cargo/core/manifest.rs @@ -273,8 +273,8 @@ impl Profile { } } -impl hash::Hash for Profile { - fn hash(&self, into: &mut H) { +impl hash::Hash for Profile { + fn hash(&self, into: &mut H) { // Be sure to match all fields explicitly, but ignore those not relevant // to the actual hash of a profile. let Profile { diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs index 02e9d91dd..58e7415b6 100644 --- a/src/cargo/core/package.rs +++ b/src/cargo/core/package.rs @@ -102,8 +102,8 @@ impl PartialEq for Package { impl Eq for Package {} -impl hash::Hash for Package { - fn hash(&self, into: &mut H) { +impl hash::Hash for Package { + fn hash(&self, into: &mut H) { self.package_id().hash(into) } } diff --git a/src/cargo/core/package_id.rs b/src/cargo/core/package_id.rs index 28eeb33a4..336ee96ec 100644 --- a/src/cargo/core/package_id.rs +++ b/src/cargo/core/package_id.rs @@ -1,7 +1,7 @@ use std::cmp::Ordering; use std::error::{Error, FromError}; use std::fmt::{self, Formatter}; -use std::hash::{Hash, SipHasher}; +use std::hash::Hash; use std::hash; use std::sync::Arc; @@ -56,8 +56,8 @@ impl Decodable for PackageId { } } -impl Hash for PackageId { - fn hash(&self, state: &mut S) { +impl Hash for PackageId { + fn hash(&self, state: &mut S) { self.inner.name.hash(state); self.inner.version.to_string().hash(state); self.inner.source_id.hash(state); @@ -156,7 +156,7 @@ impl PackageId { } impl Metadata { - pub fn mix>(&mut self, t: &T) { + pub fn mix(&mut self, t: &T) { let new_metadata = short_hash(&(&self.metadata, t)); self.extra_filename = format!("-{}", new_metadata); self.metadata = new_metadata; diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index cc5d5b361..3bd5cf6c1 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -316,7 +316,7 @@ fn activate_deps<'a>(cx: Box, // Oh well, we couldn't activate any of the candidates, so we just can't // activate this dependency at all Ok(activation_error(&cx, registry, last_err, parent, dep, prev_active, - &candidates[])) + &candidates)) } fn activation_error(cx: &Context, @@ -360,7 +360,7 @@ fn activation_error(cx: &Context, .map(|v| v.version()) .map(|v| v.to_string()) .collect::>() - .connect(", "))[]); + .connect(", "))); return Err(human(msg)) } diff --git a/src/cargo/core/source.rs b/src/cargo/core/source.rs index c73eb3a07..a9cf3bd08 100644 --- a/src/cargo/core/source.rs +++ b/src/cargo/core/source.rs @@ -316,8 +316,8 @@ impl PartialEq for SourceIdInner { } } -impl hash::Hash for SourceId { - fn hash(&self, into: &mut S) { +impl hash::Hash for SourceId { + fn hash(&self, into: &mut S) { self.inner.kind.hash(into); match *self.inner { SourceIdInner { kind: Kind::Git(..), ref url, .. } => { diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 249ded37c..ad0e7b59a 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -1,6 +1,6 @@ #![deny(unused)] -#![feature(collections, hash, io, libc, os, path, std_misc, unicode, env, core)] -#![cfg_attr(test, deny(warnings))] +#![feature(collections, hash, libc, os, std_misc, unicode, env, core)] +#![feature(old_io, old_path, str_words)] extern crate libc; extern crate "rustc-serialize" as rustc_serialize; diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 5ba207498..37a5f0993 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -215,7 +215,7 @@ fn scrape_build_config(config: &Config, }; base.host = try!(scrape_target_config(config, config.rustc_host())); base.target = match target.as_ref() { - Some(triple) => try!(scrape_target_config(config, &triple[])), + Some(triple) => try!(scrape_target_config(config, &triple)), None => base.host.clone(), }; Ok(base) @@ -224,15 +224,15 @@ fn scrape_build_config(config: &Config, fn scrape_target_config(config: &Config, triple: &str) -> CargoResult { let key = format!("target.{}", triple); - let ar = try!(config.get_string(&format!("{}.ar", key)[])); - let linker = try!(config.get_string(&format!("{}.linker", key)[])); + let ar = try!(config.get_string(&format!("{}.ar", key))); + let linker = try!(config.get_string(&format!("{}.linker", key))); let mut ret = ops::TargetConfig { ar: ar.map(|p| p.0), linker: linker.map(|p| p.0), overrides: HashMap::new(), }; - let table = match try!(config.get_table(&key[])) { + let table = match try!(config.get_table(&key)) { Some((table, _)) => table, None => return Ok(ret), }; @@ -245,14 +245,14 @@ fn scrape_target_config(config: &Config, triple: &str) metadata: Vec::new(), }; let key = format!("{}.{}", key, lib_name); - let table = try!(config.get_table(&key[])).unwrap().0; + let table = try!(config.get_table(&key)).unwrap().0; for (k, _) in table.into_iter() { let key = format!("{}.{}", key, k); - let (v, path) = try!(config.get_string(&key[])).unwrap(); + let (v, path) = try!(config.get_string(&key)).unwrap(); if k == "rustc-flags" { let whence = format!("in `{}` (in {:?})", key, path); let (paths, links) = try!( - BuildOutput::parse_rustc_flags(&v, &whence[]) + BuildOutput::parse_rustc_flags(&v, &whence) ); output.library_paths.extend(paths.into_iter()); output.library_links.extend(links.into_iter()); diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index ae9d5e54f..b8b38b4a2 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -157,7 +157,7 @@ fn global_config(config: &Config) -> CargoResult { let email = try!(config.get_string("cargo-new.email")).map(|s| s.0); let vcs = try!(config.get_string("cargo-new.vcs")); - let vcs = match vcs.as_ref().map(|p| (&p.0[], &p.1)) { + let vcs = match vcs.as_ref().map(|p| (&p.0[..], &p.1)) { Some(("git", _)) => Some(VersionControl::Git), Some(("hg", _)) => Some(VersionControl::Hg), Some(("none", _)) => Some(VersionControl::NoVcs), diff --git a/src/cargo/ops/cargo_rustc/compilation.rs b/src/cargo/ops/cargo_rustc/compilation.rs index 3322732fe..3d362d449 100644 --- a/src/cargo/ops/cargo_rustc/compilation.rs +++ b/src/cargo/ops/cargo_rustc/compilation.rs @@ -75,14 +75,14 @@ impl Compilation { /// See `process`. pub fn target_process(&self, cmd: T, pkg: &Package) -> CargoResult { - let cmd = CString::from_slice(cmd.container_as_bytes()); + let cmd = try!(CString::new(cmd.container_as_bytes())); self.process(CommandType::Target(cmd), pkg) } /// See `process`. pub fn host_process(&self, cmd: T, pkg: &Package) -> CargoResult { - let cmd = CString::from_slice(cmd.container_as_bytes()); + let cmd = try!(CString::new(cmd.container_as_bytes())); self.process(CommandType::Host(cmd), pkg) } diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index f9e562cc8..6e4431efb 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -56,7 +56,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> { root_pkg: &Package, build_config: BuildConfig) -> CargoResult> { let target = build_config.requested_target.clone(); - let target = target.as_ref().map(|s| &s[]); + let target = target.as_ref().map(|s| &s[..]); let (target_dylib, target_exe) = try!(Context::filename_parts(target)); let (host_dylib, host_exe) = if build_config.requested_target.is_none() { (target_dylib.clone(), target_exe.clone()) @@ -358,7 +358,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> { /// Requested (not actual) target for the build pub fn requested_target(&self) -> Option<&str> { - self.build_config.requested_target.as_ref().map(|s| &s[]) + self.build_config.requested_target.as_ref().map(|s| &s[..]) } /// Calculate the actual profile to use for a target's compliation. diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs index 63566ba9f..2e270e5d8 100644 --- a/src/cargo/ops/cargo_rustc/custom_build.rs +++ b/src/cargo/ops/cargo_rustc/custom_build.rs @@ -57,7 +57,7 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform, cx.is_relevant_target(t) && !t.profile().is_custom_build() }).unwrap_or(target); let profile = cx.profile(profile_target); - let to_exec = CString::from_slice(to_exec.as_vec()); + let to_exec = try!(CString::new(to_exec.as_vec())); let p = try!(super::process(CommandType::Host(to_exec), pkg, target, cx)); let mut p = p.env("OUT_DIR", Some(&build_output)) .env("CARGO_MANIFEST_DIR", Some(pkg.manifest_path() diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index 503cf36a8..1a62d0161 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -406,6 +406,6 @@ pub fn append_current_dir(path: &Path, cwd: &Path) -> CargoResult<()> { try!(f.seek(0, old_io::SeekSet)); try!(f.write_all(cwd.as_vec())); try!(f.write_all(&[0])); - try!(f.write_all(&contents[])); + try!(f.write_all(&contents)); Ok(()) } diff --git a/src/cargo/ops/cargo_rustc/job.rs b/src/cargo/ops/cargo_rustc/job.rs index f3aea5f0e..8c10cba79 100644 --- a/src/cargo/ops/cargo_rustc/job.rs +++ b/src/cargo/ops/cargo_rustc/job.rs @@ -22,7 +22,7 @@ impl R> FnBox for F { impl Work { pub fn new(f: F) -> Work - where F: FnOnce(Sender) -> CargoResult<()> + Send { + where F: FnOnce(Sender) -> CargoResult<()> + Send + 'static { Work { inner: Box::new(f) } } diff --git a/src/cargo/ops/cargo_rustc/job_queue.rs b/src/cargo/ops/cargo_rustc/job_queue.rs index 71cb8aada..a83887d45 100644 --- a/src/cargo/ops/cargo_rustc/job_queue.rs +++ b/src/cargo/ops/cargo_rustc/job_queue.rs @@ -16,7 +16,7 @@ use super::job::Job; /// This structure is backed by the `DependencyQueue` type and manages the /// actual compilation step of each package. Packages enqueue units of work and /// then later on the entire graph is processed and compiled. -pub struct JobQueue<'a, 'b> { +pub struct JobQueue<'a> { pool: TaskPool, queue: DependencyQueue<(&'a PackageId, Stage), (&'a Package, Vec<(Job, Freshness)>)>, @@ -62,9 +62,9 @@ pub enum Stage { type Message = (PackageId, Stage, Freshness, CargoResult<()>); -impl<'a, 'b> JobQueue<'a, 'b> { +impl<'a> JobQueue<'a> { pub fn new(resolve: &'a Resolve, packages: &'a PackageSet, jobs: u32) - -> JobQueue<'a, 'b> { + -> JobQueue<'a> { let (tx, rx) = channel(); JobQueue { pool: TaskPool::new(jobs as usize), diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index d94168a16..60711242a 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -141,7 +141,7 @@ pub fn compile_targets<'a, 'b>(env: &str, }; let host_layout = Layout::new(root, None, dest); let target_layout = build_config.requested_target.as_ref().map(|target| { - layout::Layout::new(root, Some(&target[]), dest) + layout::Layout::new(root, Some(&target), dest) }); let mut cx = try!(Context::new(env, resolve, sources, deps, config, @@ -209,7 +209,7 @@ pub fn compile_targets<'a, 'b>(env: &str, fn compile<'a, 'b>(targets: &[&'a Target], pkg: &'a Package, compiled: bool, cx: &mut Context<'a, 'b>, - jobs: &mut JobQueue<'a, 'b>) -> CargoResult<()> { + jobs: &mut JobQueue<'a>) -> CargoResult<()> { debug!("compile_pkg; pkg={}", pkg); let _p = profile::start(format!("preparing: {}", pkg)); @@ -475,7 +475,7 @@ fn add_plugin_deps(rustc: CommandPrototype, search_path.push(path.clone()); } } - let search_path = try!(join_paths(&search_path[], var)); + let search_path = try!(join_paths(&search_path, var)); Ok(rustc.env(var, Some(search_path))) } diff --git a/src/cargo/sources/path.rs b/src/cargo/sources/path.rs index cc546340f..054c603d4 100644 --- a/src/cargo/sources/path.rs +++ b/src/cargo/sources/path.rs @@ -127,7 +127,7 @@ impl<'a, 'b> PathSource<'a, 'b> { let mut ret = Vec::new(); 'outer: for entry in index.iter() { - let fname = &entry.path[]; + let fname = &entry.path[..]; let file_path = root.join(fname); // Filter out files outside this package. diff --git a/src/cargo/util/dependency_queue.rs b/src/cargo/util/dependency_queue.rs index 7185bafe3..155606e48 100644 --- a/src/cargo/util/dependency_queue.rs +++ b/src/cargo/util/dependency_queue.rs @@ -5,7 +5,7 @@ //! it to figure out when a dependency should be built. use std::collections::hash_set::HashSet; -use std::collections::hash_map::{HashMap, Hasher}; +use std::collections::hash_map::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::hash::Hash; @@ -47,7 +47,7 @@ pub enum Freshness { } /// A trait for discovering the dependencies of a piece of data. -pub trait Dependency: Hash + Eq + Clone { +pub trait Dependency: Hash + Eq + Clone { type Context; fn dependencies(&self, cx: &Self::Context) -> Vec; } diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index 5b03a9668..6869b347d 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -1,4 +1,5 @@ use std::error::{FromError, Error}; +use std::ffi; use std::fmt; use std::old_io::IoError; use std::old_io::process::{ProcessOutput, ProcessExit, ExitStatus, ExitSignal}; @@ -17,7 +18,7 @@ pub type CargoResult = Result>; // ============================================================================= // CargoError trait -pub trait CargoError: Error + Send { +pub trait CargoError: Error + Send + 'static { fn is_human(&self) -> bool { false } fn cargo_cause(&self) -> Option<&CargoError>{ None } } @@ -58,8 +59,8 @@ impl<'a, T, F> ChainError for F where F: FnOnce() -> CargoResult { } } -impl ChainError for Result { - fn chain_error(self, callback: C) -> CargoResult +impl ChainError for Result { + fn chain_error(self, callback: C) -> CargoResult where E2: CargoError, C: FnOnce() -> E2 { self.map_err(move |err| { Box::new(ChainedError { @@ -71,7 +72,7 @@ impl ChainError for Result { } impl ChainError for Option { - fn chain_error(self, callback: C) -> CargoResult + fn chain_error(self, callback: C) -> CargoResult where E: CargoError, C: FnOnce() -> E { match self { Some(t) => Ok(t), @@ -213,7 +214,7 @@ impl CliError { CliError::from_boxed(error, code) } - pub fn from_error(error: E, code: i32) -> CliError { + pub fn from_error(error: E, code: i32) -> CliError { let error = Box::new(error) as Box; CliError::from_boxed(error, code) } @@ -252,6 +253,7 @@ from_error! { toml::Error, url::ParseError, toml::DecodeError, + ffi::NulError, } impl FromError> for Box { @@ -269,6 +271,7 @@ impl CargoError for toml::Error {} impl CargoError for toml::DecodeError {} impl CargoError for url::ParseError {} impl CargoError for str::Utf8Error {} +impl CargoError for ffi::NulError {} // ============================================================================= // Construction helpers @@ -335,7 +338,7 @@ pub fn human(error: S) -> Box { }) } -pub fn caused_human(error: S, cause: E) -> Box { +pub fn caused_human(error: S, cause: E) -> Box { Box::new(ConcreteCargoError { description: error.to_string(), detail: None, diff --git a/src/cargo/util/graph.rs b/src/cargo/util/graph.rs index 9f97daa10..e9cdad6c4 100644 --- a/src/cargo/util/graph.rs +++ b/src/cargo/util/graph.rs @@ -1,7 +1,7 @@ use std::fmt; use std::hash::Hash; use std::collections::hash_set::HashSet; -use std::collections::hash_map::{HashMap, Keys, Hasher}; +use std::collections::hash_map::{HashMap, Keys}; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::hash_set::Iter; @@ -17,7 +17,7 @@ enum Mark { pub type Nodes<'a, N> = Keys<'a, N, HashSet>; pub type Edges<'a, N> = Iter<'a, N>; -impl + Clone> Graph { +impl Graph { pub fn new() -> Graph { Graph { nodes: HashMap::new() } } @@ -72,7 +72,7 @@ impl + Clone> Graph { } } -impl> fmt::Debug for Graph { +impl fmt::Debug for Graph { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { try!(writeln!(fmt, "Graph {{")); @@ -90,12 +90,12 @@ impl> fmt::Debug for Graph { } } -impl> PartialEq for Graph { +impl PartialEq for Graph { fn eq(&self, other: &Graph) -> bool { self.nodes.eq(&other.nodes) } } -impl> Eq for Graph {} +impl Eq for Graph {} -impl + Clone> Clone for Graph { +impl Clone for Graph { fn clone(&self) -> Graph { Graph { nodes: self.nodes.clone() } } diff --git a/src/cargo/util/hex.rs b/src/cargo/util/hex.rs index 3e8d9629a..f3479666d 100644 --- a/src/cargo/util/hex.rs +++ b/src/cargo/util/hex.rs @@ -8,7 +8,7 @@ pub fn to_hex(num: u64) -> String { writer.to_hex() } -pub fn short_hash>(hashable: &H) -> String { +pub fn short_hash(hashable: &H) -> String { let mut hasher = SipHasher::new_with_keys(0, 0); hashable.hash(&mut hasher); to_hex(hasher.finish()) diff --git a/src/cargo/util/lev_distance.rs b/src/cargo/util/lev_distance.rs index 337644b3b..1bb7d8e30 100644 --- a/src/cargo/util/lev_distance.rs +++ b/src/cargo/util/lev_distance.rs @@ -48,7 +48,7 @@ fn test_lev_distance() { for c in range(0u32, MAX as u32) .filter_map(|i| from_u32(i)) .map(|i| i.to_string()) { - assert_eq!(lev_distance(&c[], &c[]), 0); + assert_eq!(lev_distance(&c, &c), 0); } let a = "\nMäry häd ä little lämb\n\nLittle lämb\n"; diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index 290b65aab..207bea3b3 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -115,7 +115,7 @@ impl ProcessBuilder { let mut program = format!("{}", String::from_utf8_lossy(self.program.as_bytes())); for arg in self.args.iter() { program.push(' '); - program.push_str(&format!("{}", String::from_utf8_lossy(arg.as_bytes()))[]); + program.push_str(&format!("{}", String::from_utf8_lossy(arg.as_bytes()))); } program } diff --git a/src/rustversion.txt b/src/rustversion.txt index 17cae77fb..d47abca81 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-02-12 +2015-02-21 diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 7c10756ae..de7972d89 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -359,12 +359,12 @@ fn lines_match(expected: &str, mut actual: &str) -> bool { actual.len() == 0 || expected.ends_with("[..]") } -struct ZipAll { +struct ZipAll { first: I1, second: I2, } -impl, I2: Iterator> Iterator for ZipAll { +impl, I2: Iterator> Iterator for ZipAll { type Item = (Option, Option); fn next(&mut self) -> Option<(Option, Option)> { let first = self.first.next(); @@ -377,10 +377,10 @@ impl, I2: Iterator> Iterator for ZipAll, I2: Iterator>(a: I1, b: I2) -> ZipAll { +fn zip_all, I2: Iterator>(a: I1, b: I2) -> ZipAll { ZipAll { first: a, - second: b + second: b, } } diff --git a/tests/test_cargo_build_auth.rs b/tests/test_cargo_build_auth.rs index 646db4fd8..1c7705167 100644 --- a/tests/test_cargo_build_auth.rs +++ b/tests/test_cargo_build_auth.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use std::old_io::net::tcp::TcpAcceptor; use std::old_io::{TcpListener, Listener, Acceptor, BufferedStream}; -use std::thread::Thread; +use std::thread; use git2; use support::{project, execs, UPDATING}; @@ -38,7 +38,7 @@ test!(http_auth_offered { .collect() } - let t = Thread::scoped(move|| { + let t = thread::spawn(move|| { let mut s = BufferedStream::new(a.accept().unwrap()); let req = headers(&mut s); s.write_all(b"\ @@ -130,7 +130,7 @@ test!(https_something_happens { let mut a = listener.listen().unwrap(); let a2 = a.clone(); let _c = Closer { a: a2 }; - let t = Thread::scoped(move|| { + let t = thread::spawn(move|| { drop(a.accept().unwrap()); }); @@ -180,7 +180,7 @@ test!(ssh_something_happens { let mut a = listener.listen().unwrap(); let a2 = a.clone(); let _c = Closer { a: a2 }; - let t = Thread::scoped(move|| { + let t = thread::spawn(move|| { drop(a.accept().unwrap()); }); diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index 11a152fbb..799834552 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -1675,7 +1675,7 @@ test!(dont_require_submodules_are_checked_out { git2::Repository::init(&project.root()).unwrap(); let url = path2url(git1.root()).to_string(); let dst = paths::home().join("foo"); - git2::Repository::clone(&url[], &dst).unwrap(); + git2::Repository::clone(&url, &dst).unwrap(); assert_that(git1.process(cargo_dir().join("cargo")).arg("build").arg("-v") .cwd(dst), diff --git a/tests/tests.rs b/tests/tests.rs index 1ab15c83e..18c5856b9 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1,5 +1,4 @@ -#![deny(warnings)] -#![feature(collections, core, io, os, path, rustc_private, std_misc, env)] +#![feature(collections, core, io, old_io, os, old_path, rustc_private, std_misc, env)] extern crate cargo; extern crate flate2;