From e7c49666be180eba2720cce09d4d2116b1ef4d20 Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Tue, 1 Jun 2021 01:44:51 +0500 Subject: Expand fixme comments --- crates/hir_ty/src/diagnostics/expr.rs | 1 + crates/hir_ty/src/diagnostics/match_check/deconstruct_pat.rs | 3 ++- crates/hir_ty/src/diagnostics/match_check/usefulness.rs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty') 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> { // https://github.com/rust-lang/rust/blob/25c15cdbe/compiler/rustc_mir_build/src/thir/pattern/check_match.rs#L200-L201 let witnesses = report.non_exhaustiveness_witnesses; + // FIXME Report witnesses // eprintln!("compute_match_usefulness(..) -> {:?}", &witnesses); if !witnesses.is_empty() { 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 { pat: PatId, cx: &MatchCheckCtx<'_>, ) -> Self { - // FIXME(iDawer): these alocations and clones are so unfortunate (+1 for switching to references) + // FIXME(iDawer): Factor out pattern deep cloning. See discussion: + // https://github.com/rust-analyzer/rust-analyzer/pull/8717#discussion_r633086640 let mut arena = cx.pattern_arena.borrow_mut(); match arena[pat].kind.as_ref() { 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 { fn expand_or_pat(self, cx: &MatchCheckCtx<'_>) -> Vec { fn expand(pat: PatId, vec: &mut Vec, pat_arena: &mut PatternArena) { if let PatKind::Or { pats } = pat_arena[pat].kind.as_ref() { + // FIXME(iDawer): Factor out pattern deep cloning. See discussion: + // https://github.com/rust-analyzer/rust-analyzer/pull/8717#discussion_r633086640 let pats = pats.clone(); for pat in pats { - // FIXME(iDawer): Ugh, I want to go back to references (PatId -> &Pat) let pat = pat_arena.alloc(pat.clone()); expand(pat, vec, pat_arena); } -- cgit v1.2.3