This commit is contained in:
Robin Gloster 2015-02-23 00:06:12 +01:00
parent 43755c00e8
commit 973f6712f0
29 changed files with 144 additions and 131 deletions

137
Cargo.lock generated
View file

@ -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)",

View file

@ -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<Option<()>> {
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<Option<()>> {
"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());

View file

@ -273,8 +273,8 @@ impl Profile {
}
}
impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for Profile {
fn hash(&self, into: &mut H) {
impl hash::Hash for Profile {
fn hash<H: hash::Hasher>(&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 {

View file

@ -102,8 +102,8 @@ impl PartialEq for Package {
impl Eq for Package {}
impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for Package {
fn hash(&self, into: &mut H) {
impl hash::Hash for Package {
fn hash<H: hash::Hasher>(&self, into: &mut H) {
self.package_id().hash(into)
}
}

View file

@ -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<S: hash::Writer + hash::Hasher> Hash<S> for PackageId {
fn hash(&self, state: &mut S) {
impl Hash for PackageId {
fn hash<S: hash::Hasher>(&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<T: Hash<SipHasher>>(&mut self, t: &T) {
pub fn mix<T: Hash>(&mut self, t: &T) {
let new_metadata = short_hash(&(&self.metadata, t));
self.extra_filename = format!("-{}", new_metadata);
self.metadata = new_metadata;

View file

@ -316,7 +316,7 @@ fn activate_deps<'a>(cx: Box<Context>,
// 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::<Vec<_>>()
.connect(", "))[]);
.connect(", ")));
return Err(human(msg))
}

View file

@ -316,8 +316,8 @@ impl PartialEq for SourceIdInner {
}
}
impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for SourceId {
fn hash(&self, into: &mut S) {
impl hash::Hash for SourceId {
fn hash<S: hash::Hasher>(&self, into: &mut S) {
self.inner.kind.hash(into);
match *self.inner {
SourceIdInner { kind: Kind::Git(..), ref url, .. } => {

View file

@ -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;

View file

@ -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<ops::TargetConfig> {
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());

View file

@ -157,7 +157,7 @@ fn global_config(config: &Config) -> CargoResult<CargoNewConfig> {
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),

View file

@ -75,14 +75,14 @@ impl Compilation {
/// See `process`.
pub fn target_process<T: BytesContainer>(&self, cmd: T, pkg: &Package)
-> CargoResult<CommandPrototype> {
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<T: BytesContainer>(&self, cmd: T, pkg: &Package)
-> CargoResult<CommandPrototype> {
let cmd = CString::from_slice(cmd.container_as_bytes());
let cmd = try!(CString::new(cmd.container_as_bytes()));
self.process(CommandType::Host(cmd), pkg)
}

View file

@ -56,7 +56,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> {
root_pkg: &Package,
build_config: BuildConfig) -> CargoResult<Context<'a, 'b>> {
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.

View file

@ -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()

View file

@ -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(())
}

View file

@ -22,7 +22,7 @@ impl<A, R, F: FnOnce(A) -> R> FnBox<A, R> for F {
impl Work {
pub fn new<F>(f: F) -> Work
where F: FnOnce(Sender<String>) -> CargoResult<()> + Send {
where F: FnOnce(Sender<String>) -> CargoResult<()> + Send + 'static {
Work { inner: Box::new(f) }
}

View file

@ -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),

View file

@ -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)))
}

View file

@ -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.

View file

@ -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<Hasher> + Eq + Clone {
pub trait Dependency: Hash + Eq + Clone {
type Context;
fn dependencies(&self, cx: &Self::Context) -> Vec<Self>;
}

View file

@ -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<T> = Result<T, Box<CargoError>>;
// =============================================================================
// 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<T> for F where F: FnOnce() -> CargoResult<T> {
}
}
impl<T, E: CargoError> ChainError<T> for Result<T, E> {
fn chain_error<E2, C>(self, callback: C) -> CargoResult<T>
impl<T, E: CargoError + 'static> ChainError<T> for Result<T, E> {
fn chain_error<E2: 'static, C>(self, callback: C) -> CargoResult<T>
where E2: CargoError, C: FnOnce() -> E2 {
self.map_err(move |err| {
Box::new(ChainedError {
@ -71,7 +72,7 @@ impl<T, E: CargoError> ChainError<T> for Result<T, E> {
}
impl<T> ChainError<T> for Option<T> {
fn chain_error<E, C>(self, callback: C) -> CargoResult<T>
fn chain_error<E: 'static, C>(self, callback: C) -> CargoResult<T>
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<E: CargoError + 'static>(error: E, code: i32) -> CliError {
pub fn from_error<E: CargoError>(error: E, code: i32) -> CliError {
let error = Box::new(error) as Box<CargoError>;
CliError::from_boxed(error, code)
}
@ -252,6 +253,7 @@ from_error! {
toml::Error,
url::ParseError,
toml::DecodeError,
ffi::NulError,
}
impl<E: CargoError> FromError<Human<E>> for Box<CargoError> {
@ -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<S: fmt::Display>(error: S) -> Box<CargoError> {
})
}
pub fn caused_human<S: fmt::Display, E: Error + Send>(error: S, cause: E) -> Box<CargoError> {
pub fn caused_human<S: fmt::Display, E: Error + Send + 'static>(error: S, cause: E) -> Box<CargoError> {
Box::new(ConcreteCargoError {
description: error.to_string(),
detail: None,

View file

@ -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<N>>;
pub type Edges<'a, N> = Iter<'a, N>;
impl<N: Eq + Hash<Hasher> + Clone> Graph<N> {
impl<N: Eq + Hash + Clone> Graph<N> {
pub fn new() -> Graph<N> {
Graph { nodes: HashMap::new() }
}
@ -72,7 +72,7 @@ impl<N: Eq + Hash<Hasher> + Clone> Graph<N> {
}
}
impl<N: fmt::Display + Eq + Hash<Hasher>> fmt::Debug for Graph<N> {
impl<N: fmt::Display + Eq + Hash> fmt::Debug for Graph<N> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(writeln!(fmt, "Graph {{"));
@ -90,12 +90,12 @@ impl<N: fmt::Display + Eq + Hash<Hasher>> fmt::Debug for Graph<N> {
}
}
impl<N: Eq + Hash<Hasher>> PartialEq for Graph<N> {
impl<N: Eq + Hash> PartialEq for Graph<N> {
fn eq(&self, other: &Graph<N>) -> bool { self.nodes.eq(&other.nodes) }
}
impl<N: Eq + Hash<Hasher>> Eq for Graph<N> {}
impl<N: Eq + Hash> Eq for Graph<N> {}
impl<N: Eq + Hash<Hasher> + Clone> Clone for Graph<N> {
impl<N: Eq + Hash + Clone> Clone for Graph<N> {
fn clone(&self) -> Graph<N> {
Graph { nodes: self.nodes.clone() }
}

View file

@ -8,7 +8,7 @@ pub fn to_hex(num: u64) -> String {
writer.to_hex()
}
pub fn short_hash<H: Hash<SipHasher>>(hashable: &H) -> String {
pub fn short_hash<H: Hash>(hashable: &H) -> String {
let mut hasher = SipHasher::new_with_keys(0, 0);
hashable.hash(&mut hasher);
to_hex(hasher.finish())

View file

@ -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";

View file

@ -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
}

View file

@ -1 +1 @@
2015-02-12
2015-02-21

View file

@ -359,12 +359,12 @@ fn lines_match(expected: &str, mut actual: &str) -> bool {
actual.len() == 0 || expected.ends_with("[..]")
}
struct ZipAll<T, I1, I2> {
struct ZipAll<I1: Iterator, I2: Iterator> {
first: I1,
second: I2,
}
impl<T, I1: Iterator<Item=T>, I2: Iterator<Item=T>> Iterator for ZipAll<T, I1, I2> {
impl<T, I1: Iterator<Item=T>, I2: Iterator<Item=T>> Iterator for ZipAll<I1, I2> {
type Item = (Option<T>, Option<T>);
fn next(&mut self) -> Option<(Option<T>, Option<T>)> {
let first = self.first.next();
@ -377,10 +377,10 @@ impl<T, I1: Iterator<Item=T>, I2: Iterator<Item=T>> Iterator for ZipAll<T, I1, I
}
}
fn zip_all<T, I1: Iterator<Item=T>, I2: Iterator<Item=T>>(a: I1, b: I2) -> ZipAll<T, I1, I2> {
fn zip_all<T, I1: Iterator<Item=T>, I2: Iterator<Item=T>>(a: I1, b: I2) -> ZipAll<I1, I2> {
ZipAll {
first: a,
second: b
second: b,
}
}

View file

@ -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());
});

View file

@ -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),

View file

@ -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;