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

Commit e110c78

Browse files
author
Jonas Schievink
committed
Revert "Record diverging match arms in InferenceResult"
This reverts commit 319611b.
1 parent 9f1bb17 commit e110c78

File tree

4 files changed

+0
-30
lines changed

4 files changed

+0
-30
lines changed

crates/hir-ty/src/infer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@ pub struct InferenceResult {
333333
assoc_resolutions: FxHashMap<ExprOrPatId, AssocItemId>,
334334
pub diagnostics: Vec<InferenceDiagnostic>,
335335
pub type_of_expr: ArenaMap<ExprId, Ty>,
336-
/// For each match expr, record diverging arm's expr.
337-
pub diverging_arms: FxHashMap<ExprId, Vec<ExprId>>,
338336
/// For each pattern record the type it resolves to.
339337
///
340338
/// **Note**: When a pattern type is resolved it may still contain

crates/hir-ty/src/infer/expr.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ impl<'a> InferenceContext<'a> {
375375

376376
let matchee_diverges = self.diverges;
377377
let mut all_arms_diverge = Diverges::Always;
378-
let mut diverging_arms = Vec::new();
379378

380379
for arm in arms.iter() {
381380
self.diverges = Diverges::Maybe;
@@ -388,15 +387,11 @@ impl<'a> InferenceContext<'a> {
388387
}
389388

390389
let arm_ty = self.infer_expr_inner(arm.expr, &expected);
391-
if self.diverges.is_always() {
392-
diverging_arms.push(arm.expr);
393-
}
394390
all_arms_diverge &= self.diverges;
395391
coerce.coerce(self, Some(arm.expr), &arm_ty);
396392
}
397393

398394
self.diverges = matchee_diverges | all_arms_diverge;
399-
self.result.diverging_arms.insert(tgt_expr, diverging_arms);
400395

401396
coerce.complete()
402397
}

crates/hir/src/semantics.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,6 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
481481
pub fn is_unsafe_ident_pat(&self, ident_pat: &ast::IdentPat) -> bool {
482482
self.imp.is_unsafe_ident_pat(ident_pat)
483483
}
484-
485-
pub fn is_diverging_match_arm(&self, match_arm: &ast::MatchArm) -> Option<bool> {
486-
self.imp.is_diverging_match_arm(match_arm)
487-
}
488484
}
489485

490486
impl<'db> SemanticsImpl<'db> {
@@ -1425,10 +1421,6 @@ impl<'db> SemanticsImpl<'db> {
14251421
.map(|ty| ty.original.is_packed(self.db))
14261422
.unwrap_or(false)
14271423
}
1428-
1429-
fn is_diverging_match_arm(&self, match_arm: &ast::MatchArm) -> Option<bool> {
1430-
self.analyze(match_arm.syntax())?.is_diverging_match_arm(self.db, match_arm)
1431-
}
14321424
}
14331425

14341426
fn macro_call_to_macro_id(

crates/hir/src/source_analyzer.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -782,21 +782,6 @@ impl SourceAnalyzer {
782782
false
783783
}
784784

785-
pub(crate) fn is_diverging_match_arm(
786-
&self,
787-
db: &dyn HirDatabase,
788-
match_arm: &ast::MatchArm,
789-
) -> Option<bool> {
790-
let infer = self.infer.as_ref()?;
791-
let match_expr = match_arm.syntax().ancestors().find_map(ast::MatchExpr::cast)?;
792-
let match_id = self.expr_id(db, &match_expr.into())?;
793-
let diverging_arms = infer.diverging_arms.get(&match_id)?;
794-
let match_arm_expr = match_arm.expr()?;
795-
let match_arm_expr_id = self.expr_id(db, &match_arm_expr)?;
796-
797-
Some(diverging_arms.contains(&match_arm_expr_id))
798-
}
799-
800785
fn resolve_impl_method_or_trait_def(
801786
&self,
802787
db: &dyn HirDatabase,

0 commit comments

Comments
 (0)