From e67adf40c98c95bb25a27a66c5b3f20a8094b296 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 17 Mar 2024 16:35:47 +0100 Subject: [PATCH] Don't assume place validity when we don't know --- crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs b/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs index 82b80a53e3..dfe082cb56 100644 --- a/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs +++ b/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs @@ -65,7 +65,9 @@ impl<'p> MatchCheckCtx<'p> { arms: &[MatchArm<'p>], scrut_ty: Ty, ) -> Result, ()> { - compute_match_usefulness(self, arms, scrut_ty, PlaceValidity::ValidOnly, None) + // FIXME: Determine place validity correctly. For now, err on the safe side. + let place_validity = PlaceValidity::MaybeInvalid; + compute_match_usefulness(self, arms, scrut_ty, place_validity, None) } fn is_uninhabited(&self, ty: &Ty) -> bool {