diff options
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/once.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index a75088120f8..1bcdc760fc6 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -15,6 +15,7 @@ use int; use mem::drop; +use ops::FnOnce; use sync::atomic; use sync::{StaticMutex, MUTEX_INIT}; @@ -57,7 +58,7 @@ impl Once { /// /// When this function returns, it is guaranteed that some initialization /// has run and completed (it may not be the closure specified). - pub fn doit(&'static self, f: ||) { + pub fn doit<F>(&'static self, f: F) where F: FnOnce() { // Optimize common path: load is much cheaper than fetch_add. if self.cnt.load(atomic::SeqCst) < 0 { return |
