Print similar-layout procs when borrow fails to find one

This commit is contained in:
Ayaz Hafiz 2022-12-12 14:13:07 -06:00
parent 4cdb8c0cd7
commit 00ff6dcad7
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -162,9 +162,15 @@ impl<'a> DeclarationToIndex<'a> {
}
}
}
let similar = self
.elements
.iter()
.filter_map(|((s, lay), _)| if *s == needle_symbol { Some(lay) } else { None })
.collect::<std::vec::Vec<_>>();
unreachable!(
"symbol/layout {:?} {:#?} combo must be in DeclarationToIndex",
needle_symbol, needle_layout
"symbol/layout {:?} {:#?} combo must be in DeclarationToIndex\nHowever {} similar layouts were found:\n{:#?}",
needle_symbol, needle_layout, similar.len(), similar
)
}
}