Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 440d937

Browse files
Workaround ICE with if-let and RFC 2229
1 parent db1fb85 commit 440d937

File tree

2 files changed

+8
-9
lines changed
  • compiler

2 files changed

+8
-9
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,15 +1028,13 @@ impl HandlerInner {
10281028
let mut error_codes = self
10291029
.emitted_diagnostic_codes
10301030
.iter()
1031-
.filter_map(|x| {
1032-
match &x {
1031+
.filter_map(|x| match &x {
10331032
DiagnosticId::Error(s)
1034-
if let Ok(Some(_explanation)) = registry.try_find_description(s) =>
1033+
if registry.try_find_description(s).map_or(false, |o| o.is_some()) =>
10351034
{
10361035
Some(s.clone())
10371036
}
10381037
_ => None,
1039-
}
10401038
})
10411039
.collect::<Vec<_>>();
10421040
if !error_codes.is_empty() {

compiler/rustc_typeck/src/astconv/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,13 +2417,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
24172417
let substs = InternalSubsts::for_item(tcx, def_id, |param, _| {
24182418
if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) {
24192419
// Our own parameters are the resolved lifetimes.
2420-
match param.kind {
2421-
GenericParamDefKind::Lifetime
2422-
if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] =>
2423-
{
2420+
if let GenericParamDefKind::Lifetime = param.kind {
2421+
if let hir::GenericArg::Lifetime(lifetime) = &lifetimes[i] {
24242422
self.ast_region_to_region(lifetime, None).into()
2423+
} else {
2424+
bug!()
24252425
}
2426-
_ => bug!(),
2426+
} else {
2427+
bug!()
24272428
}
24282429
} else {
24292430
match param.kind {

0 commit comments

Comments
 (0)