diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-07 14:15:25 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-13 17:03:47 -0500 |
| commit | cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b (patch) | |
| tree | 18a305205c51df4501a5e5e73c4b275242fb5a25 /src/libstd/sync | |
| parent | be53d619f874cbe8e4d87f900060561d16405d53 (diff) | |
| download | rust-cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b.tar.gz rust-cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b.zip | |
libstd: use unboxed closures
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 |
