Workaround ICE with if-let and RFC 2229

This commit is contained in:
Mark Rousskov 2021-09-18 18:04:40 -04:00
parent db1fb85cff
commit 440d9372a2
2 changed files with 8 additions and 9 deletions

View file

@ -1028,15 +1028,13 @@ impl HandlerInner {
let mut error_codes = self
.emitted_diagnostic_codes
.iter()
.filter_map(|x| {
match &x {
.filter_map(|x| match &x {
DiagnosticId::Error(s)
if let Ok(Some(_explanation)) = registry.try_find_description(s) =>
if registry.try_find_description(s).map_or(false, |o| o.is_some()) =>
{
Some(s.clone())
}
_ => None,
}
})
.collect::<Vec<_>>();
if !error_codes.is_empty() {