From 799e0f76903f694632db29bf7fc38c8a7f1453b6 Mon Sep 17 00:00:00 2001 From: dianne Date: Thu, 30 Jan 2025 16:03:02 -0800 Subject: add FIXMEs for diagnostic improvements --- compiler/rustc_hir_typeck/src/pat.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index be72af63fe5..1e28571807e 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -2384,6 +2384,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // NB: This assumes that `&` patterns can match against mutable // references (RFC 3627, Rule 5). If we implement a pattern typing // ruleset with Rule 4 but not Rule 5, we'll need to check that here. + // FIXME(ref_pat_eat_one_layer_2024_structural): If we already tried + // matching the real reference, the error message should explain that + // falling back to the inherited reference didn't work. This should be + // the same error as the old-Edition version below. debug_assert!(ref_pat_matches_mut_ref); self.error_inherited_ref_mutability_mismatch(pat, pat_prefix_span); } @@ -2418,6 +2422,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { // Otherwise, use the common logic below for matching the inner // reference type. + // FIXME(ref_pat_eat_one_layer_2024_structural): If this results in a + // mutability mismatch, the error message should explain that falling + // back to the inherited reference didn't work. This should be the same + // error as the Edition 2024 version above. } } else { // The expected type isn't a reference type, so only match against the -- cgit 1.4.1-3-g733a5