|
1 | 1 | use super::dep_cache::RegistryQueryer;
|
2 | 2 | use super::errors::ActivateResult;
|
3 |
| -use super::types::{ConflictMap, ConflictReason, FeaturesSet, ResolveOpts}; |
| 3 | +use super::types::{ActivationsKey, ConflictMap, ConflictReason, FeaturesSet, ResolveOpts}; |
4 | 4 | use super::RequestedFeatures;
|
5 |
| -use crate::core::{Dependency, PackageId, SourceId, Summary}; |
| 5 | +use crate::core::{Dependency, PackageId, Summary}; |
6 | 6 | use crate::util::interning::InternedString;
|
7 | 7 | use crate::util::Graph;
|
8 | 8 | use anyhow::format_err;
|
9 | 9 | use std::collections::HashMap;
|
10 |
| -use std::num::NonZeroU64; |
11 | 10 | use tracing::debug;
|
12 | 11 |
|
13 | 12 | // A `Context` is basically a bunch of local resolution information which is
|
@@ -39,39 +38,9 @@ pub type ContextAge = usize;
|
39 | 38 | /// By storing this in a hash map we ensure that there is only one
|
40 | 39 | /// semver compatible version of each crate.
|
41 | 40 | /// This all so stores the `ContextAge`.
|
42 |
| -pub type ActivationsKey = (InternedString, SourceId, SemverCompatibility); |
43 |
| - |
44 | 41 | pub type Activations =
|
45 | 42 | im_rc::HashMap<ActivationsKey, (Summary, ContextAge), rustc_hash::FxBuildHasher>;
|
46 | 43 |
|
47 |
| -/// A type that represents when cargo treats two Versions as compatible. |
48 |
| -/// Versions `a` and `b` are compatible if their left-most nonzero digit is the |
49 |
| -/// same. |
50 |
| -#[derive(Clone, Copy, Eq, PartialEq, Hash, Debug, PartialOrd, Ord)] |
51 |
| -pub enum SemverCompatibility { |
52 |
| - Major(NonZeroU64), |
53 |
| - Minor(NonZeroU64), |
54 |
| - Patch(u64), |
55 |
| -} |
56 |
| - |
57 |
| -impl From<&semver::Version> for SemverCompatibility { |
58 |
| - fn from(ver: &semver::Version) -> Self { |
59 |
| - if let Some(m) = NonZeroU64::new(ver.major) { |
60 |
| - return SemverCompatibility::Major(m); |
61 |
| - } |
62 |
| - if let Some(m) = NonZeroU64::new(ver.minor) { |
63 |
| - return SemverCompatibility::Minor(m); |
64 |
| - } |
65 |
| - SemverCompatibility::Patch(ver.patch) |
66 |
| - } |
67 |
| -} |
68 |
| - |
69 |
| -impl PackageId { |
70 |
| - pub fn as_activations_key(self) -> ActivationsKey { |
71 |
| - (self.name(), self.source_id(), self.version().into()) |
72 |
| - } |
73 |
| -} |
74 |
| - |
75 | 44 | impl ResolverContext {
|
76 | 45 | pub fn new() -> ResolverContext {
|
77 | 46 | ResolverContext {
|
|
0 commit comments