diff options
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs | 1 | ||||
-rw-r--r-- | crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/diagnostics/match_check/usefulness.rs | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index 44d5f6b22..3efbce773 100644 --- a/crates/hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs | |||
@@ -376,6 +376,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
376 | // https://github.com/rust-lang/rust/blob/25c15cdbe/compiler/rustc_mir_build/src/thir/pattern/check_match.rs#L200-L201 | 376 | // https://github.com/rust-lang/rust/blob/25c15cdbe/compiler/rustc_mir_build/src/thir/pattern/check_match.rs#L200-L201 |
377 | 377 | ||
378 | let witnesses = report.non_exhaustiveness_witnesses; | 378 | let witnesses = report.non_exhaustiveness_witnesses; |
379 | // FIXME Report witnesses | ||
379 | // eprintln!("compute_match_usefulness(..) -> {:?}", &witnesses); | 380 | // eprintln!("compute_match_usefulness(..) -> {:?}", &witnesses); |
380 | if !witnesses.is_empty() { | 381 | if !witnesses.is_empty() { |
381 | if let Ok(source_ptr) = source_map.expr_syntax(id) { | 382 | if let Ok(source_ptr) = source_map.expr_syntax(id) { |
diff --git a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs index a47082617..1f4219b42 100644 --- a/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs +++ b/crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs | |||
@@ -864,7 +864,8 @@ impl Fields { | |||
864 | pat: PatId, | 864 | pat: PatId, |
865 | cx: &MatchCheckCtx<'_>, | 865 | cx: &MatchCheckCtx<'_>, |
866 | ) -> Self { | 866 | ) -> Self { |
867 | // FIXME(iDawer): these alocations and clones are so unfortunate (+1 for switching to references) | 867 | // FIXME(iDawer): Factor out pattern deep cloning. See discussion: |
868 | // https://github.com/rust-analyzer/rust-analyzer/pull/8717#discussion_r633086640 | ||
868 | let mut arena = cx.pattern_arena.borrow_mut(); | 869 | let mut arena = cx.pattern_arena.borrow_mut(); |
869 | match arena[pat].kind.as_ref() { | 870 | match arena[pat].kind.as_ref() { |
870 | PatKind::Deref { subpattern } => { | 871 | PatKind::Deref { subpattern } => { |
diff --git a/crates/hir_ty/src/diagnostics/match_check/usefulness.rs b/crates/hir_ty/src/diagnostics/match_check/usefulness.rs index 61fba41bf..83b094a89 100644 --- a/crates/hir_ty/src/diagnostics/match_check/usefulness.rs +++ b/crates/hir_ty/src/diagnostics/match_check/usefulness.rs | |||
@@ -376,9 +376,10 @@ impl PatIdExt for PatId { | |||
376 | fn expand_or_pat(self, cx: &MatchCheckCtx<'_>) -> Vec<Self> { | 376 | fn expand_or_pat(self, cx: &MatchCheckCtx<'_>) -> Vec<Self> { |
377 | fn expand(pat: PatId, vec: &mut Vec<PatId>, pat_arena: &mut PatternArena) { | 377 | fn expand(pat: PatId, vec: &mut Vec<PatId>, pat_arena: &mut PatternArena) { |
378 | if let PatKind::Or { pats } = pat_arena[pat].kind.as_ref() { | 378 | if let PatKind::Or { pats } = pat_arena[pat].kind.as_ref() { |
379 | // FIXME(iDawer): Factor out pattern deep cloning. See discussion: | ||
380 | // https://github.com/rust-analyzer/rust-analyzer/pull/8717#discussion_r633086640 | ||
379 | let pats = pats.clone(); | 381 | let pats = pats.clone(); |
380 | for pat in pats { | 382 | for pat in pats { |
381 | // FIXME(iDawer): Ugh, I want to go back to references (PatId -> &Pat) | ||
382 | let pat = pat_arena.alloc(pat.clone()); | 383 | let pat = pat_arena.alloc(pat.clone()); |
383 | expand(pat, vec, pat_arena); | 384 | expand(pat, vec, pat_arena); |
384 | } | 385 | } |