From: Eh2406 Date: Sat, 3 Mar 2018 16:17:05 +0000 (-0500) Subject: `Context` no longer needs replacements nor its lifetime X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~64^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a81e08be7de49e1aa631d7e8a79f8d11abec78ce;p=cargo.git `Context` no longer needs replacements nor its lifetime --- diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index c169121a3..c461b9d6a 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -326,7 +326,7 @@ enum GraphNode { // risk of being cloned *a lot* so we want to make this as cheap to clone as // possible. #[derive(Clone)] -struct Context<'a> { +struct Context { // TODO: Both this and the two maps below are super expensive to clone. We should // switch to persistent hash maps if we can at some point or otherwise // make these much cheaper to clone in general. @@ -340,8 +340,6 @@ struct Context<'a> { resolve_graph: RcList, resolve_replacements: RcList<(PackageId, PackageId)>, - replacements: &'a [(PackageIdSpec, Dependency)], - // These warnings are printed after resolution. warnings: RcList, } @@ -360,7 +358,6 @@ pub fn resolve(summaries: &[(Summary, Method)], links: HashMap::new(), resolve_replacements: RcList::new(), activations: HashMap::new(), - replacements, warnings: RcList::new(), }; let _p = profile::start("resolving"); @@ -676,9 +673,9 @@ impl<'a> RegistryQueryer<'a> { } #[derive(Clone)] -struct BacktrackFrame<'a> { +struct BacktrackFrame { cur: usize, - context_backup: Context<'a>, + context_backup: Context, deps_backup: BinaryHeap, remaining_candidates: RemainingCandidates, parent: Summary, @@ -760,12 +757,12 @@ impl RemainingCandidates { /// /// If all dependencies can be activated and resolved to a version in the /// dependency graph, cx.resolve is returned. -fn activate_deps_loop<'a>( - mut cx: Context<'a>, +fn activate_deps_loop( + mut cx: Context, registry: &mut RegistryQueryer, summaries: &[(Summary, Method)], config: Option<&Config>, -) -> CargoResult> { +) -> CargoResult { // Note that a `BinaryHeap` is used for the remaining dependencies that need // activation. This heap is sorted such that the "largest value" is the most // constrained dependency, or the one with the least candidates. @@ -952,9 +949,9 @@ fn activate_deps_loop<'a>( /// If the outcome could differ, resets `cx` and `remaining_deps` to that /// level and returns the next candidate. /// If all candidates have been exhausted, returns None. -fn find_candidate<'a>( - backtrack_stack: &mut Vec>, - cx: &mut Context<'a>, +fn find_candidate( + backtrack_stack: &mut Vec, + cx: &mut Context, remaining_deps: &mut BinaryHeap, parent: &mut Summary, cur: &mut usize, @@ -1278,7 +1275,7 @@ fn build_requirements<'a, 'b: 'a>(s: &'a Summary, method: &'b Method) Ok(reqs) } -impl<'a> Context<'a> { +impl Context { /// Activate this summary by inserting it into our list of known activations. /// /// Returns true if this summary with the given method is already activated.