X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fmono_hash_map.rs;h=fb0169920ee28fedc71d6b8882935c8429797cd1;hb=d4b592ed17471622d27deeab8a1d8d89bc5c17d1;hp=124ae68760260b93ca6aa76f0b0d030c9cb4935d;hpb=20e843f202e5e92d549670227b16230c07922c94;p=rust.git diff --git a/src/mono_hash_map.rs b/src/mono_hash_map.rs index 124ae687602..fb0169920ee 100644 --- a/src/mono_hash_map.rs +++ b/src/mono_hash_map.rs @@ -1,6 +1,6 @@ -//! This is a "monotonic `HashMap`": A `HashMap` that, when shared, can be pushed to but not +//! This is a "monotonic `FxHashMap`": A `FxHashMap` that, when shared, can be pushed to but not //! otherwise mutated. We also box items in the map. This means we can safely provide -//! shared references into existing items in the `HashMap`, because they will not be dropped +//! shared references into existing items in the `FxHashMap`, because they will not be dropped //! (from being removed) or moved (because they are boxed). //! The API is is completely tailored to what `memory.rs` needs. It is still in //! a separate file to minimize the amount of code that has to care about the unsafety. @@ -21,8 +21,8 @@ impl MonoHashMap { /// This function exists for priroda to be able to iterate over all evaluator memory. /// /// The function is somewhat roundabout with the closure argument because internally the - /// `MonoHashMap` uses a `RefCell`. When iterating over the `HashMap` inside the `RefCell`, - /// we need to keep a borrow to the `HashMap` inside the iterator. The borrow is only alive + /// `MonoHashMap` uses a `RefCell`. When iterating over the `FxHashMap` inside the `RefCell`, + /// we need to keep a borrow to the `FxHashMap` inside the iterator. The borrow is only alive /// as long as the `Ref` returned by `RefCell::borrow()` is alive. So we can't return the /// iterator, as that would drop the `Ref`. We can't return both, as it's not possible in Rust /// to have a struct/tuple with a field that refers to another field. @@ -64,7 +64,7 @@ fn filter_map_collect(&self, mut f: impl FnMut(&K, &V) -> Option) -> Vec