From 72bdaee782166894a3e11ad864c76b1d817c6acc Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 29 Nov 2016 21:36:14 -0800 Subject: [PATCH 1/2] Upgrade error-chain --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 2 +- src/download/Cargo.toml | 2 +- src/rustup-cli/errors.rs | 8 ++++---- src/rustup-dist/Cargo.toml | 2 +- src/rustup-dist/src/errors.rs | 4 ++-- src/rustup-utils/Cargo.toml | 2 +- src/rustup-utils/src/errors.rs | 2 +- src/rustup/errors.rs | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4dbca4933..f370839947 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,7 +39,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -175,7 +175,7 @@ dependencies = [ "ca-loader 0.1.0", "curl 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "env_proxy 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.1.0 (git+https://github.com/sfackler/rust-native-tls.git)", @@ -194,10 +194,10 @@ dependencies = [ [[package]] name = "error-chain" -version = "0.5.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -548,7 +548,7 @@ version = "0.6.5" dependencies = [ "clap 2.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "download 0.3.0", - "error-chain 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -577,7 +577,7 @@ dependencies = [ name = "rustup-dist" version = "0.6.5" dependencies = [ - "error-chain 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -624,7 +624,7 @@ version = "0.6.5" dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "download 0.3.0", - "error-chain 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -980,7 +980,7 @@ dependencies = [ "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2b3fb52b09c1710b961acb35390d514be82e4ac96a9969a8e38565a29b878dc9" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" -"checksum backtrace 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "346d7644f0b5f9bc73082d3b2236b69a05fd35cce0cfa3724e184e6a5c9e2a2f" +"checksum backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f551bc2ddd53aea015d453ef0b635af89444afa5ed2405dd0b2062ad5d600d80" "checksum backtrace-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ff73785ae8e06bb4a7b09e09f06d7434f9748b86d2f67bdf334b603354497e08" "checksum base64 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ce110e5c96df1817009271c910626fa4b79c2f178d70f9857d768c3886ba6a0" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" @@ -994,7 +994,7 @@ dependencies = [ "checksum curl-sys 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4f198d10378a3bc1f1b0e3bc3a2de5c9bb9e08938460dec57ba6667d9a65fbc3" "checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850" "checksum env_proxy 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f190d9208c08f9f0f608d9ba2530620b351d10e4bf2a62ac2292fe63380fbfb7" -"checksum error-chain 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5c82c815138e278b8dcdeffc49f27ea6ffb528403e9dea4194f2e3dd40b143" +"checksum error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cd681735364a04cd5d69f01a4f6768e70473941f8d86d8c224faf6955a75799" "checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" "checksum gcc 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)" = "dcb000abd6df9df4c637f75190297ebe56c1d7e66b56bbf3b4aa7aece15f61a2" diff --git a/Cargo.toml b/Cargo.toml index b6da69be06..165ebca498 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ msi-installed = [] rustup-dist = { path = "src/rustup-dist", version = "0.6.5" } rustup-utils = { path = "src/rustup-utils", version = "0.6.5" } download = { path = "src/download" } -error-chain = "0.5.0" +error-chain = "0.7.1" clap = "2.18.0" regex = "0.1.41" url = "1.1.0" diff --git a/src/download/Cargo.toml b/src/download/Cargo.toml index 9df2611842..78d7e84a00 100644 --- a/src/download/Cargo.toml +++ b/src/download/Cargo.toml @@ -15,7 +15,7 @@ hyper-backend = ["hyper", "env_proxy", "native-tls", "openssl-sys"] rustls-backend = ["hyper", "env_proxy", "rustls", "lazy_static", "ca-loader"] [dependencies] -error-chain = "0.5.0" +error-chain = "0.7.1" url = "1.1" curl = { version = "0.3", optional = true } lazy_static = { version = "0.2", optional = true } diff --git a/src/rustup-cli/errors.rs b/src/rustup-cli/errors.rs index e7593ff4c3..6d7a4e9592 100644 --- a/src/rustup-cli/errors.rs +++ b/src/rustup-cli/errors.rs @@ -8,13 +8,13 @@ use rustup_utils; error_chain! { links { - rustup::Error, rustup::ErrorKind, Rustup; - rustup_dist::Error, rustup_dist::ErrorKind, Dist; - rustup_utils::Error, rustup_utils::ErrorKind, Utils; + Rustup(rustup::Error, rustup::ErrorKind); + Dist(rustup_dist::Error, rustup_dist::ErrorKind); + Utils(rustup_utils::Error, rustup_utils::ErrorKind); } foreign_links { - temp::Error, Temp; + Temp(temp::Error); } errors { diff --git a/src/rustup-dist/Cargo.toml b/src/rustup-dist/Cargo.toml index c3de90015c..86e239ffe2 100644 --- a/src/rustup-dist/Cargo.toml +++ b/src/rustup-dist/Cargo.toml @@ -24,7 +24,7 @@ walkdir = "0.1.5" toml = "0.1.27" sha2 = "0.1.2" rustup-utils = { path = "../rustup-utils", version = "0.6.5" } -error-chain = "0.5.0" +error-chain = "0.7.1" rustup-mock = { path = "../rustup-mock", version = "0.6.5" } [target."cfg(windows)".dependencies] diff --git a/src/rustup-dist/src/errors.rs b/src/rustup-dist/src/errors.rs index fa19e45257..5d34a6719b 100644 --- a/src/rustup-dist/src/errors.rs +++ b/src/rustup-dist/src/errors.rs @@ -7,11 +7,11 @@ use manifest::Component; error_chain! { links { - rustup_utils::Error, rustup_utils::ErrorKind, Utils; + Utils(rustup_utils::Error, rustup_utils::ErrorKind); } foreign_links { - temp::Error, Temp; + Temp(temp::Error); } errors { diff --git a/src/rustup-utils/Cargo.toml b/src/rustup-utils/Cargo.toml index b9feb7edb4..1afede59be 100644 --- a/src/rustup-utils/Cargo.toml +++ b/src/rustup-utils/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0" [dependencies] rand = "0.3.11" scopeguard = "0.1.2" -error-chain = "0.5.0" +error-chain = "0.7.1" libc = "0.2.0" rustc-serialize = "0.3.19" sha2 = "0.1.2" diff --git a/src/rustup-utils/src/errors.rs b/src/rustup-utils/src/errors.rs index 8e80cb8842..9b70becb84 100644 --- a/src/rustup-utils/src/errors.rs +++ b/src/rustup-utils/src/errors.rs @@ -5,7 +5,7 @@ use download; error_chain! { links { - download::Error, download::ErrorKind, Download; + Download(download::Error, download::ErrorKind); } foreign_links { } diff --git a/src/rustup/errors.rs b/src/rustup/errors.rs index 33c6ca849b..361677c687 100644 --- a/src/rustup/errors.rs +++ b/src/rustup/errors.rs @@ -5,12 +5,12 @@ use toml; error_chain! { links { - rustup_dist::Error, rustup_dist::ErrorKind, Dist; - rustup_utils::Error, rustup_utils::ErrorKind, Utils; + Dist(rustup_dist::Error, rustup_dist::ErrorKind); + Utils(rustup_utils::Error, rustup_utils::ErrorKind); } foreign_links { - temp::Error, Temp; + Temp(temp::Error); } errors { From b78a1ac01403be42679dd3b9d62721bf0d228b4a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 30 Nov 2016 16:53:22 -0800 Subject: [PATCH 2/2] Work around missing into_kind method --- src/rustup-dist/tests/transactions.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rustup-dist/tests/transactions.rs b/src/rustup-dist/tests/transactions.rs index 3cef939ecd..737a43aeb6 100644 --- a/src/rustup-dist/tests/transactions.rs +++ b/src/rustup-dist/tests/transactions.rs @@ -72,7 +72,7 @@ fn add_file_that_exists() { let err = tx.add_file("c", PathBuf::from("foo/bar")).unwrap_err(); - match err.into_kind() { + match err.0 { ErrorKind::ComponentConflict { name, path } => { assert_eq!(name, "c"); assert_eq!(path, PathBuf::from("foo/bar")); @@ -146,7 +146,7 @@ fn copy_file_that_exists() { let err = tx.copy_file("c", PathBuf::from("foo/bar"), &srcpath).unwrap_err(); - match err.into_kind() { + match err.0 { ErrorKind::ComponentConflict { name, path } => { assert_eq!(name, "c"); assert_eq!(path, PathBuf::from("foo/bar")); @@ -232,7 +232,7 @@ fn copy_dir_that_exists() { let err = tx.copy_dir("c", PathBuf::from("a"), srcdir.path()).unwrap_err(); - match err.into_kind() { + match err.0 { ErrorKind::ComponentConflict { name, path } => { assert_eq!(name, "c"); assert_eq!(path, PathBuf::from("a")); @@ -297,7 +297,7 @@ fn remove_file_that_not_exists() { let err = tx.remove_file("c", PathBuf::from("foo")).unwrap_err(); - match err.into_kind() { + match err.0 { ErrorKind::ComponentMissingFile { name, path } => { assert_eq!(name, "c"); assert_eq!(path, PathBuf::from("foo")); @@ -364,7 +364,7 @@ fn remove_dir_that_not_exists() { let err = tx.remove_dir("c", PathBuf::from("foo")).unwrap_err(); - match err.into_kind() { + match err.0 { ErrorKind::ComponentMissingDir { name, path } => { assert_eq!(name, "c"); assert_eq!(path, PathBuf::from("foo")); @@ -430,7 +430,7 @@ fn write_file_that_exists() { utils_raw::write_file(&prefix.path().join("a"), &content).unwrap(); let err = tx.write_file("c", PathBuf::from("a"), content.clone()).unwrap_err(); - match err.into_kind() { + match err.0 { ErrorKind::ComponentConflict { name, path } => { assert_eq!(name, "c"); assert_eq!(path, PathBuf::from("a"));