Skip to content

Commit a81e08b

Browse files
committed
Context no longer needs replacements nor its lifetime
1 parent a7846b8 commit a81e08b

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/cargo/core/resolver/mod.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ enum GraphNode {
326326
// risk of being cloned *a lot* so we want to make this as cheap to clone as
327327
// possible.
328328
#[derive(Clone)]
329-
struct Context<'a> {
329+
struct Context {
330330
// TODO: Both this and the two maps below are super expensive to clone. We should
331331
// switch to persistent hash maps if we can at some point or otherwise
332332
// make these much cheaper to clone in general.
@@ -340,8 +340,6 @@ struct Context<'a> {
340340
resolve_graph: RcList<GraphNode>,
341341
resolve_replacements: RcList<(PackageId, PackageId)>,
342342

343-
replacements: &'a [(PackageIdSpec, Dependency)],
344-
345343
// These warnings are printed after resolution.
346344
warnings: RcList<String>,
347345
}
@@ -360,7 +358,6 @@ pub fn resolve(summaries: &[(Summary, Method)],
360358
links: HashMap::new(),
361359
resolve_replacements: RcList::new(),
362360
activations: HashMap::new(),
363-
replacements,
364361
warnings: RcList::new(),
365362
};
366363
let _p = profile::start("resolving");
@@ -676,9 +673,9 @@ impl<'a> RegistryQueryer<'a> {
676673
}
677674

678675
#[derive(Clone)]
679-
struct BacktrackFrame<'a> {
676+
struct BacktrackFrame {
680677
cur: usize,
681-
context_backup: Context<'a>,
678+
context_backup: Context,
682679
deps_backup: BinaryHeap<DepsFrame>,
683680
remaining_candidates: RemainingCandidates,
684681
parent: Summary,
@@ -760,12 +757,12 @@ impl RemainingCandidates {
760757
///
761758
/// If all dependencies can be activated and resolved to a version in the
762759
/// dependency graph, cx.resolve is returned.
763-
fn activate_deps_loop<'a>(
764-
mut cx: Context<'a>,
760+
fn activate_deps_loop(
761+
mut cx: Context,
765762
registry: &mut RegistryQueryer,
766763
summaries: &[(Summary, Method)],
767764
config: Option<&Config>,
768-
) -> CargoResult<Context<'a>> {
765+
) -> CargoResult<Context> {
769766
// Note that a `BinaryHeap` is used for the remaining dependencies that need
770767
// activation. This heap is sorted such that the "largest value" is the most
771768
// constrained dependency, or the one with the least candidates.
@@ -952,9 +949,9 @@ fn activate_deps_loop<'a>(
952949
/// If the outcome could differ, resets `cx` and `remaining_deps` to that
953950
/// level and returns the next candidate.
954951
/// If all candidates have been exhausted, returns None.
955-
fn find_candidate<'a>(
956-
backtrack_stack: &mut Vec<BacktrackFrame<'a>>,
957-
cx: &mut Context<'a>,
952+
fn find_candidate(
953+
backtrack_stack: &mut Vec<BacktrackFrame>,
954+
cx: &mut Context,
958955
remaining_deps: &mut BinaryHeap<DepsFrame>,
959956
parent: &mut Summary,
960957
cur: &mut usize,
@@ -1278,7 +1275,7 @@ fn build_requirements<'a, 'b: 'a>(s: &'a Summary, method: &'b Method)
12781275
Ok(reqs)
12791276
}
12801277

1281-
impl<'a> Context<'a> {
1278+
impl Context {
12821279
/// Activate this summary by inserting it into our list of known activations.
12831280
///
12841281
/// Returns true if this summary with the given method is already activated.

0 commit comments

Comments
 (0)