Skip to content

Commit 2be26f0

Browse files
committed
add clarifying comments to chars used for label-trimming
1 parent 452c14e commit 2be26f0

File tree

1 file changed

+9
-3
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+9
-3
lines changed

compiler/rustc_hir_typeck/src/pat.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
835835
self.add_rust_2024_migration_desugared_pat(
836836
pat_info.top_info.hir_id,
837837
pat,
838-
't',
838+
't', // last char of `mut`
839839
def_br_mutbl,
840840
);
841841
BindingMode(ByRef::No, Mutability::Mut)
@@ -848,7 +848,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
848848
self.add_rust_2024_migration_desugared_pat(
849849
pat_info.top_info.hir_id,
850850
pat,
851-
if user_br_mutbl.is_mut() { 't' } else { 'f' },
851+
match user_br_mutbl {
852+
Mutability::Not => 'f', // last char of `ref`
853+
Mutability::Mut => 't', // last char of `ref mut`
854+
},
852855
def_br_mutbl,
853856
);
854857
}
@@ -2387,7 +2390,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
23872390
self.add_rust_2024_migration_desugared_pat(
23882391
pat_info.top_info.hir_id,
23892392
pat,
2390-
if pat_mutbl.is_mut() { 't' } else { '&' },
2393+
match pat_mutbl {
2394+
Mutability::Not => '&', // last char of `&`
2395+
Mutability::Mut => 't', // last char of `&mut`
2396+
},
23912397
inh_mut,
23922398
)
23932399
}

0 commit comments

Comments
 (0)