Address review comments
This commit is contained in:
parent
e3945bd3a8
commit
88cd821e62
2 changed files with 7 additions and 5 deletions
|
@ -734,8 +734,8 @@ impl BindingAnnotation {
|
|||
}
|
||||
|
||||
pub fn cap_ref_mutability(mut self, mutbl: Mutability) -> Self {
|
||||
if let ByRef::Yes(old_mutbl) = self.0 {
|
||||
self.0 = ByRef::Yes(cmp::min(old_mutbl, mutbl));
|
||||
if let ByRef::Yes(old_mutbl) = &mut self.0 {
|
||||
*old_mutbl = cmp::min(*old_mutbl, mutbl);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
|
|
@ -447,10 +447,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// This is because a `& &mut` cannot mutate the underlying value.
|
||||
ByRef::Yes(Mutability::Not) => Mutability::Not,
|
||||
});
|
||||
}
|
||||
|
||||
if pat.span.at_least_rust_2024() && self.tcx.features().ref_pat_eat_one_layer_2024 {
|
||||
max_ref_mutability = cmp::min(max_ref_mutability, inner_mutability);
|
||||
def_bm = def_bm.cap_ref_mutability(max_ref_mutability);
|
||||
if pat.span.at_least_rust_2024() && self.tcx.features().ref_pat_eat_one_layer_2024 {
|
||||
def_bm = def_bm.cap_ref_mutability(max_ref_mutability);
|
||||
if def_bm.0 == ByRef::Yes(Mutability::Not) {
|
||||
max_ref_mutability = Mutability::Not;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue