fix the issue

This commit is contained in:
Folkert 2021-08-20 22:42:29 +02:00
parent aa042f3357
commit 807e00ca96
2 changed files with 48 additions and 4 deletions

View file

@ -46,7 +46,14 @@ pub fn infer_borrow<'a>(
// component (in top-sorted order, from primitives (std-lib) to main)
let successor_map = &make_successor_mapping(arena, procs);
let successors = move |key: &Symbol| successor_map[key].iter().copied();
let successors = move |key: &Symbol| {
let slice = match successor_map.get(key) {
None => &[] as &[_],
Some(s) => s.as_slice(),
};
slice.iter().copied()
};
let mut symbols = Vec::with_capacity_in(procs.len(), arena);
symbols.extend(procs.keys().map(|x| x.0));
@ -217,7 +224,10 @@ impl<'a> DeclarationToIndex<'a> {
}
}
}
unreachable!("symbol/layout combo must be in DeclarationToIndex")
unreachable!(
"symbol/layout {:?} {:?} combo must be in DeclarationToIndex",
needle_symbol, needle_layout
)
}
}