peepmatic: Apply some review suggestions from @bjorn3

This commit is contained in:
Nick Fitzgerald
2020-05-08 13:47:14 -07:00
parent a9b280ca3a
commit 22a070ed4f
4 changed files with 181 additions and 219 deletions

View File

@@ -54,17 +54,17 @@ pub struct PathId(u16);
/// path mapping.
#[derive(Debug, Default)]
pub struct PathInterner {
// A map from a path (whose owned data is inside `arena`) to the canonical
// `PathId` we assigned it when interning it.
/// A map from a path (whose owned data is inside `arena`) to the canonical
/// `PathId` we assigned it when interning it.
map: HashMap<UnsafePath, PathId>,
// A map from a `PathId` index to an unsafe, self-borrowed path pointing
// into `arena`. It is safe to given these out as safe `Path`s, as long as
// the lifetime is not longer than this `PathInterner`'s lifetime.
/// A map from a `PathId` index to an unsafe, self-borrowed path pointing
/// into `arena`. It is safe to given these out as safe `Path`s, as long as
/// the lifetime is not longer than this `PathInterner`'s lifetime.
paths: Vec<UnsafePath>,
// Bump allocation arena for path data. The bump arena ensures that these
// allocations never move, and are therefore safe for self-references.
/// Bump allocation arena for path data. The bump arena ensures that these
/// allocations never move, and are therefore safe for self-references.
arena: bumpalo::Bump,
}