about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-30 20:13:30 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-31 22:50:26 -0500
commitbcc2120c2134cd4359d160e55ebbc3c3bcb72f16 (patch)
tree2e710a21ee77cacf6f23f515b1857b7716e0d597 /src
parent24b49228f0dbd5a4b59a5297532f4b9cb4dfdc6a (diff)
downloadrust-bcc2120c2134cd4359d160e55ebbc3c3bcb72f16.tar.gz
rust-bcc2120c2134cd4359d160e55ebbc3c3bcb72f16.zip
rustc_borrowck: unbox closures used in function arguments
Diffstat (limited to 'src')
-rw-r--r--src/librustc_borrowck/borrowck/move_data.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs
index 5d2faa52f1a..547e7d272c6 100644
--- a/src/librustc_borrowck/borrowck/move_data.rs
+++ b/src/librustc_borrowck/borrowck/move_data.rs
@@ -521,15 +521,17 @@ impl<'tcx> MoveData<'tcx> {
         return true;
     }
 
-    // FIXME(#19596) unbox `f`
-    fn each_extending_path(&self, index: MovePathIndex, f: |MovePathIndex| -> bool) -> bool {
-        if !f(index) {
+    // FIXME(#19596) This is a workaround, but there should be better way to do this
+    fn each_extending_path_<F>(&self, index: MovePathIndex, f: &mut F) -> bool where
+        F: FnMut(MovePathIndex) -> bool,
+    {
+        if !(*f)(index) {
             return false;
         }
 
         let mut p = self.path_first_child(index);
         while p != InvalidMovePathIndex {
-            if !self.each_extending_path(p, |x| f(x)) {
+            if !self.each_extending_path_(p, f) {
                 return false;
             }
             p = self.path_next_sibling(p);
@@ -538,6 +540,12 @@ impl<'tcx> MoveData<'tcx> {
         return true;
     }
 
+    fn each_extending_path<F>(&self, index: MovePathIndex, mut f: F) -> bool where
+        F: FnMut(MovePathIndex) -> bool,
+    {
+        self.each_extending_path_(index, &mut f)
+    }
+
     fn each_applicable_move<F>(&self, index0: MovePathIndex, mut f: F) -> bool where
         F: FnMut(MoveIndex) -> bool,
     {