aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/match_check
diff options
context:
space:
mode:
authorDawer <[email protected]>2021-05-31 21:44:51 +0100
committerDawer <[email protected]>2021-05-31 21:44:51 +0100
commite7c49666be180eba2720cce09d4d2116b1ef4d20 (patch)
tree3d5a9bd6fa75c44c4964738b57df21bf4e64b29f /crates/hir_ty/src/diagnostics/match_check
parent31b6a750f8e37d011060a17ffd816d721d087844 (diff)
Expand fixme comments
Diffstat (limited to 'crates/hir_ty/src/diagnostics/match_check')
-rw-r--r--crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs3
-rw-r--r--crates/hir_ty/src/diagnostics/match_check/usefulness.rs3
2 files changed, 4 insertions, 2 deletions
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 }