Patch to fix build failure due to failure deprecated warnings
authorVasudev Kamath <vasudev@copyninja.info>
Sun, 12 Aug 2018 16:55:05 +0000 (22:25 +0530)
committerVasudev Kamath <vasudev@copyninja.info>
Sun, 12 Aug 2018 16:55:05 +0000 (22:25 +0530)
debian/patches/1001_failure_deprecated_fix.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/1001_failure_deprecated_fix.patch b/debian/patches/1001_failure_deprecated_fix.patch
new file mode 100644 (file)
index 0000000..68af975
--- /dev/null
@@ -0,0 +1,91 @@
+Description: Replace causes() with iter_chain()
+ causes() in failure crate is deprecated and since cargo
+ does not allow warnings causes build failure.
+Author: Vasudev Kamath <vasudev@copyninja.info>
+Forwarded: no
+Last-Update: 2018-08-11
+
+--- a/src/cargo/core/compiler/fingerprint.rs
++++ b/src/cargo/core/compiler/fingerprint.rs
+@@ -679,7 +679,7 @@
+     };
+     info!("fingerprint error for {}: {}", unit.pkg, ce);
+-    for cause in ce.causes().skip(1) {
++    for cause in ce.iter_chain().skip(1) {
+         info!("  cause: {}", cause);
+     }
+ }
+--- a/src/cargo/lib.rs
++++ b/src/cargo/lib.rs
+@@ -169,13 +169,13 @@
+     if verbose == Verbose {
+         // The first error has already been printed to the shell
+         // Print all remaining errors
+-        for err in cargo_err.causes().skip(1) {
++        for err in cargo_err.iter_chain().skip(1) {
+             print(err.to_string(), shell);
+         }
+     } else {
+         // The first error has already been printed to the shell
+         // Print remaining errors until one marked as Internal appears
+-        for err in cargo_err.causes().skip(1) {
++        for err in cargo_err.iter_chain().skip(1) {
+             if err.downcast_ref::<Internal>().is_some() {
+                 return false;
+             }
+--- a/src/cargo/util/config.rs
++++ b/src/cargo/util/config.rs
+@@ -921,7 +921,7 @@
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         let message = self
+             .error
+-            .causes()
++            .iter_chain()
+             .map(|e| e.to_string())
+             .collect::<Vec<_>>()
+             .join("\nCaused by:\n  ");
+--- a/src/cargo/util/errors.rs
++++ b/src/cargo/util/errors.rs
+@@ -56,7 +56,7 @@
+ impl Fail for Internal {
+     fn cause(&self) -> Option<&Fail> {
+-        self.inner.cause().cause()
++        self.inner.as_fail().cause()
+     }
+ }
+--- a/src/cargo/util/network.rs
++++ b/src/cargo/util/network.rs
+@@ -7,7 +7,7 @@
+ use util::errors::{CargoResult, HttpNot200};
+ fn maybe_spurious(err: &Error) -> bool {
+-    for e in err.causes() {
++    for e in err.iter_chain() {
+         if let Some(git_err) = e.downcast_ref::<git2::Error>() {
+             match git_err.class() {
+                 git2::ErrorClass::Net | git2::ErrorClass::Os => return true,
+--- a/tests/testsuite/cargotest/support/mod.rs
++++ b/tests/testsuite/cargotest/support/mod.rs
+@@ -1067,7 +1067,7 @@
+                     return self.match_output(out);
+                 }
+                 let mut s = format!("could not exec process {}: {}", process, e);
+-                for cause in e.causes() {
++                for cause in e.iter_chain() {
+                     s.push_str(&format!("\ncaused by: {}", cause));
+                 }
+                 Err(s)
+--- a/tests/testsuite/config.rs
++++ b/tests/testsuite/config.rs
+@@ -69,7 +69,7 @@
+ fn assert_error(error: CargoError, msgs: &str) {
+     let causes = error
+-        .causes()
++        .iter_chain()
+         .map(|e| e.to_string())
+         .collect::<Vec<_>>()
+         .join("\n");
index 276c5af3c496c44fbf800e4c3745459401c84e85..aacfbe5352203aaa6a7670b4de40829719289134 100644 (file)
@@ -4,3 +4,4 @@
 2002_disable-net-tests.patch
 2003_force-use-system-libssh2.patch
 2005_disable_fetch_cross_tests.patch
+1001_failure_deprecated_fix.patch