Skip to content

Commit db60f89

Browse files
committed
Overwrite max_ref_mutbl to Not should not happen in all editions
This commit re-put a bool value `ref_pat_matches_mut_ref` into the if block. In all editions (not 2024 edition), `max_ref_mutbl` shouldn't changed to `MutblCap::Not` here because it would cause mismatch with `def_br = Yes(Mut)` later and debug_assertion in `calc_default_binding_mode()` panics. Signed-off-by: Shunpoco <[email protected]>
1 parent e08cd3c commit db60f89

File tree

1 file changed

+1
-1
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+1
-1
lines changed

compiler/rustc_hir_typeck/src/pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24002400
if (ref_pat_matches_mut_ref && r_mutbl >= pat_mutbl)
24012401
|| r_mutbl == pat_mutbl =>
24022402
{
2403-
if r_mutbl == Mutability::Not {
2403+
if ref_pat_matches_mut_ref && r_mutbl == Mutability::Not {
24042404
pat_info.max_ref_mutbl = MutblCap::Not;
24052405
}
24062406

0 commit comments

Comments
 (0)