diff options
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/args.rs | 3 | ||||
| -rw-r--r-- | src/libstd/rt/basic.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/borrowck.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/crate_map.rs | 8 | ||||
| -rw-r--r-- | src/libstd/rt/kill.rs | 7 | ||||
| -rw-r--r-- | src/libstd/rt/local.rs | 6 | ||||
| -rw-r--r-- | src/libstd/rt/local_ptr.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/rtio.rs | 4 | ||||
| -rw-r--r-- | src/libstd/rt/sched.rs | 20 | ||||
| -rw-r--r-- | src/libstd/rt/task.rs | 6 |
10 files changed, 30 insertions, 30 deletions
diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index 0d32d2d7dba..a173be64356 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -107,9 +107,8 @@ mod imp { }) } - fn with_lock<T>(f: &fn() -> T) -> T { + fn with_lock<T>(f: || -> T) -> T { static mut lock: Mutex = MUTEX_INIT; - do (|| { unsafe { lock.lock(); diff --git a/src/libstd/rt/basic.rs b/src/libstd/rt/basic.rs index e8f6c4055a0..2c1c5d84be1 100644 --- a/src/libstd/rt/basic.rs +++ b/src/libstd/rt/basic.rs @@ -170,7 +170,7 @@ impl EventLoop for BasicLoop { ~BasicRemote::new(self.messages.clone(), id) as ~RemoteCallback } - fn io<'a>(&'a mut self, f: &fn(&'a mut IoFactory)) { + fn io<'a>(&'a mut self, f: |&'a mut IoFactory|) { f(self.io) } } diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs index bd528cbe61f..d1f69ada301 100644 --- a/src/libstd/rt/borrowck.rs +++ b/src/libstd/rt/borrowck.rs @@ -40,7 +40,7 @@ fn try_take_task_borrow_list() -> Option<~[BorrowRecord]> { } } -fn swap_task_borrow_list(f: &fn(~[BorrowRecord]) -> ~[BorrowRecord]) { +fn swap_task_borrow_list(f: |~[BorrowRecord]| -> ~[BorrowRecord]) { let borrows = match try_take_task_borrow_list() { Some(l) => l, None => ~[] diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs index 8decaea1f47..987b32c0846 100644 --- a/src/libstd/rt/crate_map.rs +++ b/src/libstd/rt/crate_map.rs @@ -79,8 +79,10 @@ fn version(crate_map: &CrateMap) -> i32 { } } -fn do_iter_crate_map<'a>(crate_map: &'a CrateMap<'a>, f: &fn(&ModEntry), - visited: &mut HashSet<*CrateMap<'a>>) { +fn do_iter_crate_map<'a>( + crate_map: &'a CrateMap<'a>, + f: |&ModEntry|, + visited: &mut HashSet<*CrateMap<'a>>) { if visited.insert(crate_map as *CrateMap) { match version(crate_map) { 2 => { @@ -98,7 +100,7 @@ fn do_iter_crate_map<'a>(crate_map: &'a CrateMap<'a>, f: &fn(&ModEntry), } /// Iterates recursively over `crate_map` and all child crate maps -pub fn iter_crate_map<'a>(crate_map: &'a CrateMap<'a>, f: &fn(&ModEntry)) { +pub fn iter_crate_map<'a>(crate_map: &'a CrateMap<'a>, f: |&ModEntry|) { // XXX: use random numbers as keys from the OS-level RNG when there is a nice // way to do this let mut v: HashSet<*CrateMap<'a>> = HashSet::with_capacity_and_keys(0, 0, 32); diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs index f7abc33ce14..fa4746a6bb7 100644 --- a/src/libstd/rt/kill.rs +++ b/src/libstd/rt/kill.rs @@ -369,7 +369,7 @@ impl BlockedTask { // So that KillHandle can be hashed in the taskgroup bookkeeping code. impl IterBytes for KillHandle { - fn iter_bytes(&self, lsb0: bool, f: &fn(buf: &[u8]) -> bool) -> bool { + fn iter_bytes(&self, lsb0: bool, f: |buf: &[u8]| -> bool) -> bool { self.data.iter_bytes(lsb0, f) } } @@ -525,9 +525,8 @@ impl KillHandle { // NB: Takes a pthread mutex -- 'blk' not allowed to reschedule. #[inline] fn add_lazy_tombstone(parent: &mut KillHandle, - blk: &fn(Option<proc() -> bool>) - -> proc() -> bool) { - + blk: |Option<proc() -> bool>| -> proc() -> bool) + { let inner: &mut KillHandleInner = unsafe { &mut *parent.get() }; unsafe { do inner.graveyard_lock.lock { diff --git a/src/libstd/rt/local.rs b/src/libstd/rt/local.rs index 1ddc2f86f4b..d47dae96283 100644 --- a/src/libstd/rt/local.rs +++ b/src/libstd/rt/local.rs @@ -18,7 +18,7 @@ pub trait Local { fn put(value: ~Self); fn take() -> ~Self; fn exists(unused_value: Option<Self>) -> bool; - fn borrow<T>(f: &fn(&mut Self) -> T) -> T; + fn borrow<T>(f: |&mut Self| -> T) -> T; unsafe fn unsafe_take() -> ~Self; unsafe fn unsafe_borrow() -> *mut Self; unsafe fn try_unsafe_borrow() -> Option<*mut Self>; @@ -30,7 +30,7 @@ impl Local for Task { #[inline] fn take() -> ~Task { unsafe { local_ptr::take() } } fn exists(_: Option<Task>) -> bool { local_ptr::exists() } - fn borrow<T>(f: &fn(&mut Task) -> T) -> T { + fn borrow<T>(f: |&mut Task| -> T) -> T { let mut res: Option<T> = None; let res_ptr: *mut Option<T> = &mut res; unsafe { @@ -78,7 +78,7 @@ impl Local for Scheduler { } } } - fn borrow<T>(f: &fn(&mut Scheduler) -> T) -> T { + fn borrow<T>(f: |&mut Scheduler| -> T) -> T { do Local::borrow |task: &mut Task| { match task.sched { Some(~ref mut task) => { diff --git a/src/libstd/rt/local_ptr.rs b/src/libstd/rt/local_ptr.rs index d5d1931a217..862ecd6499a 100644 --- a/src/libstd/rt/local_ptr.rs +++ b/src/libstd/rt/local_ptr.rs @@ -103,7 +103,7 @@ pub fn exists() -> bool { /// # Safety note /// /// Does not validate the pointer type. -pub unsafe fn borrow<T>(f: &fn(&mut T)) { +pub unsafe fn borrow<T>(f: |&mut T|) { let mut value = take(); // XXX: Need a different abstraction from 'finally' here to avoid unsafety diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 775f9d6c3be..f83932f9ffa 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -36,7 +36,7 @@ pub trait EventLoop { /// The asynchronous I/O services. Not all event loops may provide one // FIXME(#9382) this is an awful interface - fn io<'a>(&'a mut self, f: &fn(&'a mut IoFactory)); + fn io<'a>(&'a mut self, f: |&'a mut IoFactory|); } pub trait RemoteCallback { @@ -75,7 +75,7 @@ pub enum CloseBehavior { CloseAsynchronously, } -pub fn with_local_io<T>(f: &fn(&mut IoFactory) -> Option<T>) -> Option<T> { +pub fn with_local_io<T>(f: |&mut IoFactory| -> Option<T>) -> Option<T> { use rt::sched::Scheduler; use rt::local::Local; use io::native; diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index 00895289b6a..e317b76b24d 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -556,7 +556,7 @@ impl Scheduler { pub fn change_task_context(mut ~self, next_task: ~Task, - f: &fn(&mut Scheduler, ~Task)) { + f: |&mut Scheduler, ~Task|) { // The current task is grabbed from TLS, not taken as an input. // Doing an unsafe_take to avoid writing back a null pointer - // We're going to call `put` later to do that. @@ -568,8 +568,8 @@ impl Scheduler { // These transmutes do something fishy with a closure. let f_fake_region = unsafe { - transmute::<&fn(&mut Scheduler, ~Task), - &fn(&mut Scheduler, ~Task)>(f) + transmute::<|&mut Scheduler, ~Task|, + |&mut Scheduler, ~Task|>(f) }; let f_opaque = ClosureConverter::from_fn(f_fake_region); @@ -678,7 +678,7 @@ impl Scheduler { /// in order to prevent that fn from performing further scheduling operations. /// Doing further scheduling could easily result in infinite recursion. pub fn deschedule_running_task_and_then(mut ~self, - f: &fn(&mut Scheduler, BlockedTask)) { + f: |&mut Scheduler, BlockedTask|) { // Trickier - we need to get the scheduler task out of self // and use it as the destination. let stask = self.sched_task.take_unwrap(); @@ -687,7 +687,7 @@ impl Scheduler { } pub fn switch_running_tasks_and_then(~self, next_task: ~Task, - f: &fn(&mut Scheduler, BlockedTask)) { + f: |&mut Scheduler, BlockedTask|) { // This is where we convert the BlockedTask-taking closure into one // that takes just a Task, and is aware of the block-or-killed protocol. do self.change_task_context(next_task) |sched, task| { @@ -829,18 +829,18 @@ impl CleanupJob { } } -// XXX: Some hacks to put a &fn in Scheduler without borrowck +// XXX: Some hacks to put a || closure in Scheduler without borrowck // complaining type UnsafeTaskReceiver = raw::Closure; trait ClosureConverter { - fn from_fn(&fn(&mut Scheduler, ~Task)) -> Self; - fn to_fn(self) -> &fn(&mut Scheduler, ~Task); + fn from_fn(|&mut Scheduler, ~Task|) -> Self; + fn to_fn(self) -> |&mut Scheduler, ~Task|; } impl ClosureConverter for UnsafeTaskReceiver { - fn from_fn(f: &fn(&mut Scheduler, ~Task)) -> UnsafeTaskReceiver { + fn from_fn(f: |&mut Scheduler, ~Task|) -> UnsafeTaskReceiver { unsafe { transmute(f) } } - fn to_fn(self) -> &fn(&mut Scheduler, ~Task) { unsafe { transmute(self) } } + fn to_fn(self) -> |&mut Scheduler, ~Task| { unsafe { transmute(self) } } } // On unix, we read randomness straight from /dev/urandom, but the diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 6d3eec9a921..3fe555de56c 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -282,7 +282,7 @@ impl Task { } } - pub fn run(&mut self, f: &fn()) { + pub fn run(&mut self, f: ||) { rtdebug!("run called on task: {}", borrow::to_uint(self)); // The only try/catch block in the world. Attempt to run the task's @@ -494,7 +494,7 @@ impl Coroutine { static UNWIND_TOKEN: uintptr_t = 839147; impl Unwinder { - pub fn try(&mut self, f: &fn()) { + pub fn try(&mut self, f: ||) { use unstable::raw::Closure; unsafe { @@ -512,7 +512,7 @@ impl Unwinder { code: transmute(code), env: transmute(env), }; - let closure: &fn() = transmute(closure); + let closure: || = transmute(closure); closure(); } } |
