diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-09-18 18:04:40 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-09-20 08:45:39 -0400 |
| commit | 440d9372a2b8dfd01a98ba16a68f750792ab43fa (patch) | |
| tree | af667449b3ce047046f8ee89e34370b1199e6e99 /compiler | |
| parent | db1fb85cff63ad5fffe435e17128f99f9e1d970c (diff) | |
| download | rust-440d9372a2b8dfd01a98ba16a68f750792ab43fa.tar.gz rust-440d9372a2b8dfd01a98ba16a68f750792ab43fa.zip | |
Workaround ICE with if-let and RFC 2229
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/astconv/mod.rs | 11 |
2 files changed, 8 insertions, 9 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index b1526cf78d2..03e8534ef28 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -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() { diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index 2f2223ee822..33df541eb2b 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -2417,13 +2417,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let substs = InternalSubsts::for_item(tcx, def_id, |param, _| { if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) { // Our own parameters are the resolved lifetimes. - match param.kind { - GenericParamDefKind::Lifetime - if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] => - { + if let GenericParamDefKind::Lifetime = param.kind { + if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] { self.ast_region_to_region(lifetime, None).into() + } else { + bug!() } - _ => bug!(), + } else { + bug!() } } else { match param.kind { |
