From: Jeffrey Yasskin Date: Sat, 15 Aug 2015 05:32:48 +0000 (-0700) Subject: Make activation_error always return an error. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~17^2~74^2~3^2~12 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c83d86e8c0b49bceea7ae732524e287a133942db;p=cargo.git Make activation_error always return an error. --- diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index f89e25d45..b290884ab 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -398,8 +398,8 @@ 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)) + Ok(Err(activation_error(&cx, registry, last_err, parent, dep, prev_active, + &candidates))) } #[inline(never)] // see notes at the top of the module @@ -410,9 +410,9 @@ fn activation_error(cx: &Context, parent: &Summary, dep: &Dependency, prev_active: &[Rc], - candidates: &[Rc]) -> CargoResult> { + candidates: &[Rc]) -> Box { match err { - Some(e) => return Err(e), + Some(e) => return e, None => {} } if candidates.len() > 0 { @@ -447,7 +447,7 @@ fn activation_error(cx: &Context, .collect::>() .connect(", "))); - return Err(human(msg)) + return human(msg) } // Once we're all the way down here, we're definitely lost in the @@ -467,7 +467,10 @@ fn activation_error(cx: &Context, let mut msg = msg; let all_req = semver::VersionReq::parse("*").unwrap(); let new_dep = dep.clone().set_version_req(all_req); - let mut candidates: Vec = try!(registry.query(&new_dep)); + let mut candidates: Vec = match registry.query(&new_dep) { + Ok(candidates) => candidates, + Err(e) => return e, + }; candidates.sort_by(|a, b| { b.version().cmp(a.version()) }); @@ -492,7 +495,7 @@ fn activation_error(cx: &Context, a path dependency's locked version"); } - Err(human(msg)) + human(msg) } // Returns if `a` and `b` are compatible in the semver sense. This is a