Skip to content

Commit bcc2120

Browse files
author
Jorge Aparicio
committed
rustc_borrowck: unbox closures used in function arguments
1 parent 24b4922 commit bcc2120

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/librustc_borrowck/borrowck/move_data.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,17 @@ impl<'tcx> MoveData<'tcx> {
521521
return true;
522522
}
523523

524-
// FIXME(#19596) unbox `f`
525-
fn each_extending_path(&self, index: MovePathIndex, f: |MovePathIndex| -> bool) -> bool {
526-
if !f(index) {
524+
// FIXME(#19596) This is a workaround, but there should be better way to do this
525+
fn each_extending_path_<F>(&self, index: MovePathIndex, f: &mut F) -> bool where
526+
F: FnMut(MovePathIndex) -> bool,
527+
{
528+
if !(*f)(index) {
527529
return false;
528530
}
529531

530532
let mut p = self.path_first_child(index);
531533
while p != InvalidMovePathIndex {
532-
if !self.each_extending_path(p, |x| f(x)) {
534+
if !self.each_extending_path_(p, f) {
533535
return false;
534536
}
535537
p = self.path_next_sibling(p);
@@ -538,6 +540,12 @@ impl<'tcx> MoveData<'tcx> {
538540
return true;
539541
}
540542

543+
fn each_extending_path<F>(&self, index: MovePathIndex, mut f: F) -> bool where
544+
F: FnMut(MovePathIndex) -> bool,
545+
{
546+
self.each_extending_path_(index, &mut f)
547+
}
548+
541549
fn each_applicable_move<F>(&self, index0: MovePathIndex, mut f: F) -> bool where
542550
F: FnMut(MoveIndex) -> bool,
543551
{

0 commit comments

Comments
 (0)