about summary refs log tree commit diff
path: root/src/libsyntax/ext/mtwt.rs
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-08 13:28:32 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-13 17:03:47 -0500
commit0dac05dd627612232403c07ca8bd6d3376eec64a (patch)
tree656a23a7314866c8fa5cc6ca787111db41d90834 /src/libsyntax/ext/mtwt.rs
parent2160427900ea675e494274d42a8d8485724f440e (diff)
downloadrust-0dac05dd627612232403c07ca8bd6d3376eec64a.tar.gz
rust-0dac05dd627612232403c07ca8bd6d3376eec64a.zip
libsyntax: use unboxed closures
Diffstat (limited to 'src/libsyntax/ext/mtwt.rs')
-rw-r--r--src/libsyntax/ext/mtwt.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs
index 48120b575ac..a4e06aeaf63 100644
--- a/src/libsyntax/ext/mtwt.rs
+++ b/src/libsyntax/ext/mtwt.rs
@@ -105,9 +105,11 @@ pub fn apply_renames(renames: &RenameList, ctxt: SyntaxContext) -> SyntaxContext
 }
 
 /// Fetch the SCTable from TLS, create one if it doesn't yet exist.
-pub fn with_sctable<T>(op: |&SCTable| -> T) -> T {
+pub fn with_sctable<T, F>(op: F) -> T where
+    F: FnOnce(&SCTable) -> T,
+{
     thread_local!(static SCTABLE_KEY: SCTable = new_sctable_internal())
-    SCTABLE_KEY.with(|slot| op(slot))
+    SCTABLE_KEY.with(move |slot| op(slot))
 }
 
 // Make a fresh syntax context table with EmptyCtxt in slot zero
@@ -167,12 +169,14 @@ type ResolveTable = HashMap<(Name,SyntaxContext),Name>;
 
 // okay, I admit, putting this in TLS is not so nice:
 // fetch the SCTable from TLS, create one if it doesn't yet exist.
-fn with_resolve_table_mut<T>(op: |&mut ResolveTable| -> T) -> T {
+fn with_resolve_table_mut<T, F>(op: F) -> T where
+    F: FnOnce(&mut ResolveTable) -> T,
+{
     thread_local!(static RESOLVE_TABLE_KEY: RefCell<ResolveTable> = {
         RefCell::new(HashMap::new())
     })
 
-    RESOLVE_TABLE_KEY.with(|slot| op(&mut *slot.borrow_mut()))
+    RESOLVE_TABLE_KEY.with(move |slot| op(&mut *slot.borrow_mut()))
 }
 
 /// Resolve a syntax object to a name, per MTWT.