Update to latest Rust

This commit is contained in:
Jakub Bukaj 2014-12-07 15:24:36 -05:00
parent 73f68ddde9
commit de47dae939
6 changed files with 53 additions and 52 deletions

58
Cargo.lock generated
View File

@ -3,7 +3,7 @@ name = "cargo"
version = "0.1.0"
dependencies = [
"curl 0.1.0 (git+https://github.com/carllerche/curl-rust)",
"docopt 0.6.12 (git+https://github.com/docopt/docopt.rs)",
"docopt 0.6.13 (git+https://github.com/docopt/docopt.rs)",
"flate2 0.1.0 (git+https://github.com/alexcrichton/flate2-rs)",
"git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
"glob 0.1.0 (git+https://github.com/rust-lang/glob)",
@ -11,24 +11,24 @@ dependencies = [
"registry 0.1.0",
"semver 0.1.3 (git+https://github.com/rust-lang/semver)",
"tar 0.1.0 (git+https://github.com/alexcrichton/tar-rs)",
"time 0.1.0 (git+https://github.com/rust-lang/time)",
"toml 0.1.2 (git+https://github.com/alexcrichton/toml-rs)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
"time 0.1.1 (git+https://github.com/rust-lang/time)",
"toml 0.1.4 (git+https://github.com/alexcrichton/toml-rs)",
"url 0.2.2 (git+https://github.com/servo/rust-url)",
]
[[package]]
name = "curl"
version = "0.1.0"
source = "git+https://github.com/carllerche/curl-rust#5d0f5c8848e3cf1e12480a1923ae888e24d58f63"
source = "git+https://github.com/carllerche/curl-rust#6f007b4967ec12e36937dcb081abe0bdb3bcc508"
dependencies = [
"curl-sys 0.1.0 (git+https://github.com/carllerche/curl-rust)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
"url 0.2.2 (git+https://github.com/servo/rust-url)",
]
[[package]]
name = "curl-sys"
version = "0.1.0"
source = "git+https://github.com/carllerche/curl-rust#5d0f5c8848e3cf1e12480a1923ae888e24d58f63"
source = "git+https://github.com/carllerche/curl-rust#6f007b4967ec12e36937dcb081abe0bdb3bcc508"
dependencies = [
"libz-sys 0.1.0 (git+https://github.com/alexcrichton/libz-sys)",
"openssl-sys 0.2.2 (git+https://github.com/sfackler/rust-openssl)",
@ -37,13 +37,13 @@ dependencies = [
[[package]]
name = "docopt"
version = "0.6.12"
source = "git+https://github.com/docopt/docopt.rs#938d640720d91529252adddc79d020714cba7346"
version = "0.6.13"
source = "git+https://github.com/docopt/docopt.rs#38cc4572bef4dc5cbcb7526500aa14d1898c426d"
[[package]]
name = "flate2"
version = "0.1.0"
source = "git+https://github.com/alexcrichton/flate2-rs#861f52e4c71681f96605dd65cb7c1c9f6e6ecc3c"
source = "git+https://github.com/alexcrichton/flate2-rs#5cf5e4f57166053590a7f63507f65da72d4e74eb"
dependencies = [
"miniz-sys 0.1.0 (git+https://github.com/alexcrichton/flate2-rs)",
]
@ -51,7 +51,7 @@ dependencies = [
[[package]]
name = "gcc"
version = "0.1.0"
source = "git+https://github.com/alexcrichton/gcc-rs#d32b24466d3e0094cef1c1809a04d7a28536f0e0"
source = "git+https://github.com/alexcrichton/gcc-rs#3caf7309ef72644cd56a9d3a6f515ae553683176"
[[package]]
name = "gcc"
@ -61,17 +61,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "git2"
version = "0.0.1"
source = "git+https://github.com/alexcrichton/git2-rs#a20191dde5d482debb90b5913f03a58ca73720e2"
source = "git+https://github.com/alexcrichton/git2-rs#53785d74f5199455501c4ece0c9dd325a01db894"
dependencies = [
"libgit2-sys 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
"time 0.1.0 (git+https://github.com/rust-lang/time)",
"url 0.1.0 (git+https://github.com/servo/rust-url)",
"time 0.1.1 (git+https://github.com/rust-lang/time)",
"url 0.2.2 (git+https://github.com/servo/rust-url)",
]
[[package]]
name = "glob"
version = "0.1.0"
source = "git+https://github.com/rust-lang/glob#923126289064ded89f028d14dc2f28bb347ae178"
source = "git+https://github.com/rust-lang/glob#6b26e61315196f198ce9f6553912c0378e399153"
[[package]]
name = "hamcrest"
@ -81,7 +81,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#2b9bd6cdae5dcf08ac
[[package]]
name = "libgit2-sys"
version = "0.0.1"
source = "git+https://github.com/alexcrichton/git2-rs#a20191dde5d482debb90b5913f03a58ca73720e2"
source = "git+https://github.com/alexcrichton/git2-rs#53785d74f5199455501c4ece0c9dd325a01db894"
dependencies = [
"libssh2-sys 0.0.1 (git+https://github.com/alexcrichton/ssh2-rs)",
"openssl-sys 0.2.2 (git+https://github.com/sfackler/rust-openssl)",
@ -91,7 +91,7 @@ dependencies = [
[[package]]
name = "libssh2-sys"
version = "0.0.1"
source = "git+https://github.com/alexcrichton/ssh2-rs#490f91fb9e90bf4e305f1a23a051228c59e60eaf"
source = "git+https://github.com/alexcrichton/ssh2-rs#982dc47a45a5a2d66ea092ee6bb9503ddcbf36d9"
dependencies = [
"libz-sys 0.1.0 (git+https://github.com/alexcrichton/libz-sys)",
"openssl-sys 0.2.2 (git+https://github.com/sfackler/rust-openssl)",
@ -101,15 +101,15 @@ dependencies = [
[[package]]
name = "libz-sys"
version = "0.1.0"
source = "git+https://github.com/alexcrichton/libz-sys#5622ae17a0262af56055b71f0d74fa5ee91d3a41"
source = "git+https://github.com/alexcrichton/libz-sys#6c19f1309966ce5959ec0472a4730f457136f687"
dependencies = [
"pkg-config 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)",
]
[[package]]
name = "miniz-sys"
version = "0.1.0"
source = "git+https://github.com/alexcrichton/flate2-rs#861f52e4c71681f96605dd65cb7c1c9f6e6ecc3c"
source = "git+https://github.com/alexcrichton/flate2-rs#5cf5e4f57166053590a7f63507f65da72d4e74eb"
dependencies = [
"gcc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -117,7 +117,7 @@ dependencies = [
[[package]]
name = "openssl-sys"
version = "0.2.2"
source = "git+https://github.com/sfackler/rust-openssl#fd680e8a336f8870a411a3047c45b47ee72beb37"
source = "git+https://github.com/sfackler/rust-openssl#6cdd2cf577434ca3473c217e8a272ee965ef131f"
dependencies = [
"pkg-config 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -142,28 +142,28 @@ dependencies = [
[[package]]
name = "semver"
version = "0.1.3"
source = "git+https://github.com/rust-lang/semver#29212953f839337c672d185dde74e14b5dfb1f46"
source = "git+https://github.com/rust-lang/semver#9ea3324350693954d3e5d10d43e240db224deff9"
[[package]]
name = "tar"
version = "0.1.0"
source = "git+https://github.com/alexcrichton/tar-rs#d54cc716e6d809498941f38d8ab0759543402abe"
source = "git+https://github.com/alexcrichton/tar-rs#c431eeae10c0ad008a252127ffa599df5ab2c0ca"
[[package]]
name = "time"
version = "0.1.0"
source = "git+https://github.com/rust-lang/time#afab521f3b91658a3ba2d3e877b7e01699733bef"
version = "0.1.1"
source = "git+https://github.com/rust-lang/time#c1c02adb74c6d9424541ae88ceb61de698b10eeb"
dependencies = [
"gcc 0.1.0 (git+https://github.com/alexcrichton/gcc-rs)",
]
[[package]]
name = "toml"
version = "0.1.2"
source = "git+https://github.com/alexcrichton/toml-rs#1e35b001094b20d2452adff305e418591d4000fb"
version = "0.1.4"
source = "git+https://github.com/alexcrichton/toml-rs#25e10a82565d81b5243304c835d868a12b179557"
[[package]]
name = "url"
version = "0.1.0"
source = "git+https://github.com/servo/rust-url#9f05a0108025a1c9002e8977a42dce764895d170"
version = "0.2.2"
source = "git+https://github.com/servo/rust-url#bdda3a7bb946e5f85dd3daeefb54c06fffa8350c"

View File

@ -3,7 +3,6 @@
#![feature(macro_rules, phase)]
#![feature(default_type_params)]
#![feature(if_let)]
#![deny(bad_style)]
extern crate libc;

View File

@ -22,7 +22,7 @@ pub fn load_lockfile(path: &Path, sid: &SourceId) -> CargoResult<Option<Resolve>
let s = try!(f.read_to_string());
let table = toml::Table(try!(cargo_toml::parse(s.as_slice(), path)));
let table = toml::Value::Table(try!(cargo_toml::parse(s.as_slice(), path)));
let mut d = toml::Decoder::new(table);
let v: resolver::EncodableResolve = Decodable::decode(&mut d).unwrap();
Ok(Some(try!(v.to_resolve(sid))))
@ -67,7 +67,7 @@ pub fn write_lockfile(dst: &Path, resolve: &Resolve) -> CargoResult<()> {
Ok(())
}
fn emit_package(dep: &toml::TomlTable, out: &mut String) {
fn emit_package(dep: &toml::Table, out: &mut String) {
out.push_str(format!("name = {}\n", lookup(dep, "name")).as_slice());
out.push_str(format!("version = {}\n", lookup(dep, "version")).as_slice());
@ -91,6 +91,6 @@ fn emit_package(dep: &toml::TomlTable, out: &mut String) {
}
}
fn lookup<'a>(table: &'a toml::TomlTable, key: &str) -> &'a toml::Value {
fn lookup<'a>(table: &'a toml::Table, key: &str) -> &'a toml::Value {
table.get(&key.to_string()).expect(format!("Didn't find {}", key).as_slice())
}

View File

@ -146,17 +146,17 @@ impl<E, S: Encoder<E>> Encodable<S, E> for ConfigValue {
impl ConfigValue {
fn from_toml(path: &Path, toml: toml::Value) -> CargoResult<ConfigValue> {
match toml {
toml::String(val) => Ok(CV::String(val, path.clone())),
toml::Boolean(b) => Ok(CV::Boolean(b, path.clone())),
toml::Array(val) => {
toml::Value::String(val) => Ok(CV::String(val, path.clone())),
toml::Value::Boolean(b) => Ok(CV::Boolean(b, path.clone())),
toml::Value::Array(val) => {
Ok(CV::List(try!(val.into_iter().map(|toml| {
match toml {
toml::String(val) => Ok((val, path.clone())),
toml::Value::String(val) => Ok((val, path.clone())),
_ => Err(internal("")),
}
}).collect::<CargoResult<_>>())))
}
toml::Table(val) => {
toml::Value::Table(val) => {
Ok(CV::Table(try!(val.into_iter().map(|(key, value)| {
let value = raw_try!(CV::from_toml(path, value));
Ok((key, value))
@ -235,13 +235,15 @@ impl ConfigValue {
fn into_toml(self) -> toml::Value {
match self {
CV::Boolean(s, _) => toml::Boolean(s),
CV::String(s, _) => toml::String(s),
CV::List(l) => toml::Array(l.into_iter().map(|(s, _)| toml::String(s))
.collect()),
CV::Table(l) => toml::Table(l.into_iter()
.map(|(k, v)| (k, v.into_toml()))
.collect()),
CV::Boolean(s, _) => toml::Value::Boolean(s),
CV::String(s, _) => toml::Value::String(s),
CV::List(l) => toml::Value::Array(l
.into_iter()
.map(|(s, _)| toml::Value::String(s))
.collect()),
CV::Table(l) => toml::Value::Table(l.into_iter()
.map(|(k, v)| (k, v.into_toml()))
.collect()),
}
}
}
@ -261,7 +263,7 @@ pub fn all_configs(pwd: Path) -> CargoResult<HashMap<string::String, ConfigValue
internal(format!("could not parse Toml manifest; path={}",
path.display()))
}));
let value = try!(CV::from_toml(&path, toml::Table(table)));
let value = try!(CV::from_toml(&path, toml::Value::Table(table)));
try!(cfg.merge(value));
Ok(())
}).chain_error(|| human("Couldn't load Cargo configuration")));
@ -349,6 +351,6 @@ pub fn set_config(cfg: &Config, loc: Location, key: &str,
let contents = File::open(&file).read_to_string().unwrap_or("".to_string());
let mut toml = try!(cargo_toml::parse(contents.as_slice(), &file));
toml.insert(key.to_string(), value.into_toml());
try!(File::create(&file).write(toml::Table(toml).to_string().as_bytes()));
try!(File::create(&file).write(toml::Value::Table(toml).to_string().as_bytes()));
Ok(())
}

View File

@ -101,7 +101,7 @@ pub fn to_manifest(contents: &[u8],
human(format!("{} is not valid UTF-8", manifest.display()))
}));
let root = try!(parse(contents, &manifest));
let mut d = toml::Decoder::new(toml::Table(root));
let mut d = toml::Decoder::new(toml::Value::Table(root));
let toml_manifest: TomlManifest = match Decodable::decode(&mut d) {
Ok(t) => t,
Err(e) => return Err(human(format!("{} is not a valid \
@ -128,7 +128,7 @@ pub fn to_manifest(contents: &[u8],
fn add_unused_keys(m: &mut Manifest, toml: &toml::Value, key: String) {
match *toml {
toml::Table(ref table) => {
toml::Value::Table(ref table) => {
for (k, v) in table.iter() {
add_unused_keys(m, v, if key.len() == 0 {
k.clone()
@ -137,7 +137,7 @@ pub fn to_manifest(contents: &[u8],
})
}
}
toml::Array(ref arr) => {
toml::Value::Array(ref arr) => {
for v in arr.iter() {
add_unused_keys(m, v, key.clone());
}
@ -147,7 +147,7 @@ pub fn to_manifest(contents: &[u8],
}
}
pub fn parse(toml: &str, file: &Path) -> CargoResult<toml::TomlTable> {
pub fn parse(toml: &str, file: &Path) -> CargoResult<toml::Table> {
let mut parser = toml::Parser::new(toml.as_slice());
match parser.parse() {
Some(toml) => return Ok(toml),

View File

@ -1 +1 @@
2014-12-02
2014-12-06