Skip to content

Commit

Permalink
Simplify calc_default_binding_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-Bertholet committed Apr 16, 2024
1 parent 88cd821 commit 3efbe3e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
AdjustMode::ResetAndConsumeRef(ref_pat_mutbl) => {
let mutbls_match = def_bm.0 == ByRef::Yes(ref_pat_mutbl);
if pat.span.at_least_rust_2024() && self.tcx.features().ref_pat_eat_one_layer_2024 {
let max_ref_mutbl = cmp::min(max_ref_mutbl, ref_pat_mutbl);
if mutbls_match {
debug!("consuming inherited reference");
(expected, INITIAL_BM, max_ref_mutbl, true)
(expected, INITIAL_BM, cmp::min(max_ref_mutbl, ref_pat_mutbl), true)
} else {
let (new_ty, new_bm, max_ref_mutbl) = if ref_pat_mutbl == Mutability::Mut {
self.peel_off_references(
Expand Down

0 comments on commit 3efbe3e

Please sign in to comment.