Skip to content

Commit

Permalink
Replace im_rc::OrdSet with rpds::HashTrieSet
Browse files Browse the repository at this point in the history
Summary:
the `im`/`im-rc` crate contains logic bugs (we are hitting problems outlined in bodil/im-rs#124 sporadically) and appears unmaintained.

This diff switches to the `rpds` crate which offers the same kind of functionality and appears to be better maintained.

Reviewed By: CatherineGasnier

Differential Revision: D34339520

fbshipit-source-id: 5fd5eab468f46d0fcc5294d3d7142e1c8541fbd5
  • Loading branch information
hverr authored and facebook-github-bot committed Feb 21, 2022
1 parent 4a26c41 commit 485f90e
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 107 deletions.
77 changes: 23 additions & 54 deletions hphp/hack/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hphp/hack/src/depgraph/cargo/depgraph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ path = "../../depgraph/lib.rs"
crate-type = ["lib", "staticlib"]

[dependencies]
im-rc = { version = "14.2", features = ["serde"] }
memmap = "0.7"
ocamlrep = { path = "../../../ocamlrep" }
rpds = "0.11.0"
8 changes: 4 additions & 4 deletions hphp/hack/src/depgraph/depgraph/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use crate::dep::Dep;

use std::ops::Deref;

use im_rc::OrdSet;
use rpds::HashTrieSet;

/// Use a `DepGraphOpener` to initialize a dependency graph from a file.
///
Expand Down Expand Up @@ -153,16 +153,16 @@ impl<'bytes> DepGraph<'bytes> {
}

/// Add the direct typing dependencies for one dependency.
pub fn add_typing_deps_for_dep(&self, acc: &mut OrdSet<Dep>, dep: Dep) {
pub fn add_typing_deps_for_dep(&self, acc: &mut HashTrieSet<Dep>, dep: Dep) {
if let Some(dept_hash_list) = self.hash_list_for(dep) {
for dept in self.hash_list_hashes(dept_hash_list) {
acc.insert(dept);
acc.insert_mut(dept);
}
}
}

/// Query the direct typing dependencies for the given set of dependencies.
pub fn query_typing_deps_multi(&self, deps: &OrdSet<Dep>) -> OrdSet<Dep> {
pub fn query_typing_deps_multi(&self, deps: &HashTrieSet<Dep>) -> HashTrieSet<Dep> {
let mut acc = deps.clone();
for dep in deps {
self.add_typing_deps_for_dep(&mut acc, *dep);
Expand Down
2 changes: 1 addition & 1 deletion hphp/hack/src/deps/cargo/deps_rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ crate-type = ["lib", "staticlib"]

[dependencies]
depgraph = { path = "../../../depgraph/cargo/depgraph" }
im-rc = { version = "14.2", features = ["serde"] }
ocamlrep = { path = "../../../ocamlrep" }
ocamlrep_custom = { path = "../../../ocamlrep_custom" }
ocamlrep_ocamlpool = { path = "../../../ocamlrep_ocamlpool" }
once_cell = "1.8"
oxidized = { path = "../../../oxidized" }
rpds = "0.11.0"
typing_deps_hash = { path = "../typing_deps_hash" }
Loading

0 comments on commit 485f90e

Please sign in to comment.