about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJules Bertholet <julesbertholet@quoi.xyz>2024-05-10 13:53:48 -0400
committerGitHub <noreply@github.com>2024-05-10 13:53:48 -0400
commit6d5c6f541f5dc9f3142c84bbc5203e57c0a4a18c (patch)
treef91c829eb49aa0ba99c6a9556f962669f845067c
parent7951311c1bbcfc8f3487004f1df7e97a2ac6dc80 (diff)
downloadrust-6d5c6f541f5dc9f3142c84bbc5203e57c0a4a18c.tar.gz
rust-6d5c6f541f5dc9f3142c84bbc5203e57c0a4a18c.zip
Add comment on `cap_to_weakly_not`
Co-authored-by: Guillaume Boisseau <Nadrieril@users.noreply.github.com>
-rw-r--r--compiler/rustc_hir_typeck/src/pat.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs
index b18da758c1c..7029f5433d8 100644
--- a/compiler/rustc_hir_typeck/src/pat.rs
+++ b/compiler/rustc_hir_typeck/src/pat.rs
@@ -2141,6 +2141,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         let mut inherited_ref_mutbl_match = false;
         if match_ergonomics_mode != MatchErgonomicsMode::Legacy {
             if pat_mutbl == Mutability::Not {
+                // Prevent the inner pattern from binding with `ref mut`.
                 pat_info.max_ref_mutbl = pat_info.max_ref_mutbl.cap_to_weakly_not(
                     inner.span.find_ancestor_inside(pat.span).map(|end| pat.span.until(end)),
                 );