assert that working-set element 0 is None

This commit is contained in:
Dustin J. Mitchell 2021-05-07 22:40:48 +00:00
parent 5f6918fbc7
commit 73b6648d06

View file

@ -21,6 +21,10 @@ impl WorkingSet {
/// Create a new WorkingSet. Typically this is acquired via `replica.working_set()`
pub(crate) fn new(by_index: Vec<Option<Uuid>>) -> Self {
let mut by_uuid = HashMap::new();
// working sets are 1-indexed, so element 0 should always be None
assert!(by_index.is_empty() || by_index[0].is_none());
for (index, uuid) in by_index.iter().enumerate() {
if let Some(uuid) = uuid {
by_uuid.insert(*uuid, index);