Add comment on cap_to_weakly_not
Co-authored-by: Guillaume Boisseau <Nadrieril@users.noreply.github.com>
This commit is contained in:
parent
7951311c1b
commit
6d5c6f541f
1 changed files with 1 additions and 0 deletions
|
@ -2141,6 +2141,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
let mut inherited_ref_mutbl_match = false;
|
let mut inherited_ref_mutbl_match = false;
|
||||||
if match_ergonomics_mode != MatchErgonomicsMode::Legacy {
|
if match_ergonomics_mode != MatchErgonomicsMode::Legacy {
|
||||||
if pat_mutbl == Mutability::Not {
|
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(
|
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)),
|
inner.span.find_ancestor_inside(pat.span).map(|end| pat.span.until(end)),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue