try im-rs

This commit is contained in:
Eh2406 2018-06-21 16:06:09 -04:00
parent 9caf0bac4c
commit a703851abe
3 changed files with 9 additions and 9 deletions

View file

@ -59,6 +59,7 @@ url = "1.1"
clap = "2.31.2"
unicode-width = "0.1.5"
openssl = { version = '0.10.11', optional = true }
im-rc = "12.1.0"
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`

View file

@ -5,6 +5,7 @@ use core::interning::InternedString;
use core::{Dependency, FeatureValue, PackageId, SourceId, Summary};
use util::CargoResult;
use util::Graph;
use im_rc;
use super::errors::ActivateResult;
use super::types::{ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer};
@ -19,12 +20,9 @@ pub use super::resolve::Resolve;
// possible.
#[derive(Clone)]
pub 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.
pub activations: Activations,
pub resolve_features: HashMap<PackageId, Rc<HashSet<InternedString>>>,
pub links: HashMap<InternedString, PackageId>,
pub resolve_features: im_rc::HashMap<PackageId, Rc<HashSet<InternedString>>>,
pub links: im_rc::HashMap<InternedString, PackageId>,
// 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
@ -36,16 +34,16 @@ pub struct Context {
pub warnings: RcList<String>,
}
pub type Activations = HashMap<(InternedString, SourceId), Rc<Vec<Summary>>>;
pub type Activations = im_rc::HashMap<(InternedString, SourceId), Rc<Vec<Summary>>>;
impl Context {
pub fn new() -> Context {
Context {
resolve_graph: RcList::new(),
resolve_features: HashMap::new(),
links: HashMap::new(),
resolve_features: im_rc::HashMap::new(),
links: im_rc::HashMap::new(),
resolve_replacements: RcList::new(),
activations: HashMap::new(),
activations: im_rc::HashMap::new(),
warnings: RcList::new(),
}
}

View file

@ -62,6 +62,7 @@ extern crate termcolor;
extern crate toml;
extern crate unicode_width;
extern crate url;
extern crate im_rc;
use std::fmt;