-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
part of the infrastructure for public & private dependencies in the resolver #6653
Changes from 12 commits
c3e67c3
363105f
8c4c380
3e0a07f
38c5819
ed09ea2
ac9ba10
9b8b12c
c1ca055
a81fcb2
9e437ac
d016ceb
12e474b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use std::collections::{BTreeMap, HashMap, HashSet}; | ||
use std::collections::{HashMap, HashSet}; | ||
use std::rc::Rc; | ||
|
||
// "ensure" seems to require "bail" be in scope (macro hygiene issue?). | ||
|
@@ -12,7 +12,9 @@ use crate::util::CargoResult; | |
use crate::util::Graph; | ||
|
||
use super::errors::ActivateResult; | ||
use super::types::{ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer}; | ||
use super::types::{ | ||
ConflictMap, ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer, | ||
}; | ||
|
||
pub use super::encode::{EncodableDependency, EncodablePackageId, EncodableResolve}; | ||
pub use super::encode::{Metadata, WorkspaceResolve}; | ||
|
@@ -25,8 +27,20 @@ pub use super::resolve::Resolve; | |
#[derive(Clone)] | ||
pub struct Context { | ||
pub activations: Activations, | ||
/// list the features that are activated for each package | ||
pub resolve_features: im_rc::HashMap<PackageId, Rc<HashSet<InternedString>>>, | ||
/// get the package that will be linking to a native library by its links attribute | ||
pub links: im_rc::HashMap<InternedString, PackageId>, | ||
/// for each package the list of names it can see, | ||
/// then for each name the exact version that name represents and weather the name is public. | ||
pub public_dependency: | ||
im_rc::HashMap<PackageId, im_rc::HashMap<InternedString, (PackageId, bool)>>, | ||
|
||
// This is somewhat redundant with the `resolve_graph` that stores the same data, | ||
// but for querying in the opposite order. | ||
/// a way to look up for a package in activations what packages required it | ||
/// and all of the exact deps that it fulfilled. | ||
pub parents: Graph<PackageId, Rc<Vec<Dependency>>>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In our past debugging we've found that cloning a I think we explicitly removed I haven't read the whole patch yet though, so I'll likely find what happens soon. |
||
|
||
// These are two cheaply-cloneable lists (O(1) clone) which are effectively | ||
// hash maps but are built up as "construction lists". We'll iterate these | ||
|
@@ -38,6 +52,7 @@ pub struct Context { | |
pub warnings: RcList<String>, | ||
} | ||
|
||
/// list all the activated versions of a particular crate name from a source | ||
pub type Activations = im_rc::HashMap<(InternedString, SourceId), Rc<Vec<Summary>>>; | ||
|
||
impl Context { | ||
|
@@ -46,6 +61,8 @@ impl Context { | |
resolve_graph: RcList::new(), | ||
resolve_features: im_rc::HashMap::new(), | ||
links: im_rc::HashMap::new(), | ||
public_dependency: im_rc::HashMap::new(), | ||
parents: Graph::new(), | ||
resolve_replacements: RcList::new(), | ||
activations: im_rc::HashMap::new(), | ||
warnings: RcList::new(), | ||
|
@@ -147,7 +164,7 @@ impl Context { | |
pub fn is_conflicting( | ||
&self, | ||
parent: Option<PackageId>, | ||
conflicting_activations: &BTreeMap<PackageId, ConflictReason>, | ||
conflicting_activations: &ConflictMap, | ||
) -> bool { | ||
conflicting_activations | ||
.keys() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably already have this for all the other fields but could a comment be added here for this new field about what this is a map to/from?