mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 21:11:44 +00:00
try im-rs
This commit is contained in:
parent
9caf0bac4c
commit
a703851abe
|
@ -59,6 +59,7 @@ url = "1.1"
|
||||||
clap = "2.31.2"
|
clap = "2.31.2"
|
||||||
unicode-width = "0.1.5"
|
unicode-width = "0.1.5"
|
||||||
openssl = { version = '0.10.11', optional = true }
|
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.
|
# 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`
|
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
|
||||||
|
|
|
@ -5,6 +5,7 @@ use core::interning::InternedString;
|
||||||
use core::{Dependency, FeatureValue, PackageId, SourceId, Summary};
|
use core::{Dependency, FeatureValue, PackageId, SourceId, Summary};
|
||||||
use util::CargoResult;
|
use util::CargoResult;
|
||||||
use util::Graph;
|
use util::Graph;
|
||||||
|
use im_rc;
|
||||||
|
|
||||||
use super::errors::ActivateResult;
|
use super::errors::ActivateResult;
|
||||||
use super::types::{ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer};
|
use super::types::{ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer};
|
||||||
|
@ -19,12 +20,9 @@ pub use super::resolve::Resolve;
|
||||||
// possible.
|
// possible.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Context {
|
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 activations: Activations,
|
||||||
pub resolve_features: HashMap<PackageId, Rc<HashSet<InternedString>>>,
|
pub resolve_features: im_rc::HashMap<PackageId, Rc<HashSet<InternedString>>>,
|
||||||
pub links: HashMap<InternedString, PackageId>,
|
pub links: im_rc::HashMap<InternedString, PackageId>,
|
||||||
|
|
||||||
// These are two cheaply-cloneable lists (O(1) clone) which are effectively
|
// 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
|
// 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 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 {
|
impl Context {
|
||||||
pub fn new() -> Context {
|
pub fn new() -> Context {
|
||||||
Context {
|
Context {
|
||||||
resolve_graph: RcList::new(),
|
resolve_graph: RcList::new(),
|
||||||
resolve_features: HashMap::new(),
|
resolve_features: im_rc::HashMap::new(),
|
||||||
links: HashMap::new(),
|
links: im_rc::HashMap::new(),
|
||||||
resolve_replacements: RcList::new(),
|
resolve_replacements: RcList::new(),
|
||||||
activations: HashMap::new(),
|
activations: im_rc::HashMap::new(),
|
||||||
warnings: RcList::new(),
|
warnings: RcList::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ extern crate termcolor;
|
||||||
extern crate toml;
|
extern crate toml;
|
||||||
extern crate unicode_width;
|
extern crate unicode_width;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
extern crate im_rc;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue