Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion serde-generate/src/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn get_dependency_map_with_external_dependencies<'a>(
/// Classic topological sorting algorithm except that it doesn't abort in case of cycles.
pub fn best_effort_topological_sort<T>(children: &BTreeMap<T, BTreeSet<T>>) -> Vec<T>
where
T: Clone + std::cmp::Ord + std::cmp::Eq + std::hash::Hash,
T: Clone + std::fmt::Debug + std::cmp::Ord + std::cmp::Eq + std::hash::Hash,
{
// Build the initial queue so that we pick up nodes with less children first (and otherwise
// those with smaller key first).
Expand Down Expand Up @@ -81,6 +81,9 @@ where
// 2. Schedule all the (yet unseen) children then this node for a second visit.
// (If possible, visit children by increasing key.)
queue.push(node.clone());
if !children.contains_key(&node) {
panic!("The node {:?} is missing", node);
}
for child in children[&node].iter().rev() {
if !seen.contains(child) {
queue.push(child.clone());
Expand Down
6 changes: 5 additions & 1 deletion serde-generate/src/solidity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,11 @@ impl SolRegistry {
loop {
let mut new_level = HashSet::new();
for key in level {
for depend in self.names.get(&key).unwrap().get_dependency() {
let name = self.names.get(&key);
let Some(name) = name else {
panic!("The key {key:?} is absent from the list of names");
};
for depend in name.get_dependency() {
if depend == *start_key {
return true;
}
Expand Down
Loading