diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-02 11:37:37 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-02 14:31:39 -0700 |
| commit | f78cdcb6364cf938bfeb71da0c7eca62e257d537 (patch) | |
| tree | cb3f93224e4757b5f77709e576ca6f24ce0981ec /src/libcore/task | |
| parent | a5042d58ee86af13b6910fa1884b7c1fe9423ae7 (diff) | |
| download | rust-f78cdcb6364cf938bfeb71da0c7eca62e257d537.tar.gz rust-f78cdcb6364cf938bfeb71da0c7eca62e257d537.zip | |
Removing explicit uses of + mode
This removes most explicit uses of the + argument mode. Pending a snapshot, I had to remove the forbid(deprecated_modes) pragma from a bunch of files. I'll put it back! + mode still has to be used in a few places for functions that get moved (see task.rs) The changes outside core and std are due to the to_bytes trait and making the compiler (with legacy modes on) agree with the libraries (with legacy modes off) about modes.
Diffstat (limited to 'src/libcore/task')
| -rw-r--r-- | src/libcore/task/local_data.rs | 32 | ||||
| -rw-r--r-- | src/libcore/task/local_data_priv.rs | 2 | ||||
| -rw-r--r-- | src/libcore/task/spawn.rs | 20 |
3 files changed, 27 insertions, 27 deletions
diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index eda76518001..2130354229a 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -37,7 +37,7 @@ use local_data_priv::{ * * These two cases aside, the interface is safe. */ -pub type LocalDataKey<T: Owned> = &fn(+v: @T); +pub type LocalDataKey<T: Owned> = &fn(v: @T); /** * Remove a task-local data value from the table, returning the @@ -62,7 +62,7 @@ pub unsafe fn local_data_get<T: Owned>( * that value is overwritten (and its destructor is run). */ pub unsafe fn local_data_set<T: Owned>( - key: LocalDataKey<T>, +data: @T) { + key: LocalDataKey<T>, data: @T) { local_set(rt::rust_get_task(), key, data) } @@ -79,7 +79,7 @@ pub unsafe fn local_data_modify<T: Owned>( #[test] pub fn test_tls_multitask() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_set(my_key, @~"parent data"); do task::spawn unsafe { assert local_data_get(my_key).is_none(); // TLS shouldn't carry over. @@ -95,7 +95,7 @@ pub fn test_tls_multitask() unsafe { #[test] pub fn test_tls_overwrite() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_set(my_key, @~"first data"); local_data_set(my_key, @~"next data"); // Shouldn't leak. assert *(local_data_get(my_key).get()) == ~"next data"; @@ -103,7 +103,7 @@ pub fn test_tls_overwrite() unsafe { #[test] pub fn test_tls_pop() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_set(my_key, @~"weasel"); assert *(local_data_pop(my_key).get()) == ~"weasel"; // Pop must remove the data from the map. @@ -112,7 +112,7 @@ pub fn test_tls_pop() unsafe { #[test] pub fn test_tls_modify() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_modify(my_key, |data| { match data { Some(@ref val) => fail ~"unwelcome value: " + *val, @@ -136,7 +136,7 @@ pub fn test_tls_crust_automorestack_memorial_bug() unsafe { // jump over to the rust stack, which causes next_c_sp to get recorded as // Something within a rust stack segment. Then a subsequent upcall (esp. // for logging, think vsnprintf) would run on a stack smaller than 1 MB. - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } do task::spawn { unsafe { local_data_set(my_key, @~"hax"); } } @@ -144,9 +144,9 @@ pub fn test_tls_crust_automorestack_memorial_bug() unsafe { #[test] pub fn test_tls_multiple_types() unsafe { - fn str_key(+_x: @~str) { } - fn box_key(+_x: @@()) { } - fn int_key(+_x: @int) { } + fn str_key(_x: @~str) { } + fn box_key(_x: @@()) { } + fn int_key(_x: @int) { } do task::spawn unsafe { local_data_set(str_key, @~"string data"); local_data_set(box_key, @@()); @@ -156,9 +156,9 @@ pub fn test_tls_multiple_types() unsafe { #[test] pub fn test_tls_overwrite_multiple_types() { - fn str_key(+_x: @~str) { } - fn box_key(+_x: @@()) { } - fn int_key(+_x: @int) { } + fn str_key(_x: @~str) { } + fn box_key(_x: @@()) { } + fn int_key(_x: @int) { } do task::spawn unsafe { local_data_set(str_key, @~"string data"); local_data_set(int_key, @42); @@ -172,9 +172,9 @@ pub fn test_tls_overwrite_multiple_types() { #[should_fail] #[ignore(cfg(windows))] pub fn test_tls_cleanup_on_failure() unsafe { - fn str_key(+_x: @~str) { } - fn box_key(+_x: @@()) { } - fn int_key(+_x: @int) { } + fn str_key(_x: @~str) { } + fn box_key(_x: @@()) { } + fn int_key(_x: @int) { } local_data_set(str_key, @~"parent data"); local_data_set(box_key, @@()); do task::spawn unsafe { // spawn_linked diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 0d3007286c5..499dd073060 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -117,7 +117,7 @@ unsafe fn local_get<T: Owned>( } unsafe fn local_set<T: Owned>( - task: *rust_task, key: LocalDataKey<T>, +data: @T) { + task: *rust_task, key: LocalDataKey<T>, data: @T) { let map = get_task_local_map(task); // Store key+data as *voids. Data is invisibly referenced once; key isn't. diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 982679f9398..786255fe7fa 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -82,7 +82,7 @@ fn taskset_remove(tasks: &mut TaskSet, task: *rust_task) { let was_present = tasks.remove(&task); assert was_present; } -fn taskset_each(tasks: &TaskSet, blk: fn(+v: *rust_task) -> bool) { +fn taskset_each(tasks: &TaskSet, blk: fn(v: *rust_task) -> bool) { tasks.each_key(|k| blk(*k)) } @@ -303,8 +303,8 @@ struct TCB { } } -fn TCB(me: *rust_task, +tasks: TaskGroupArc, +ancestors: AncestorList, - is_main: bool, +notifier: Option<AutoNotify>) -> TCB { +fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList, + is_main: bool, notifier: Option<AutoNotify>) -> TCB { let notifier = move notifier; notifier.iter(|x| { x.failed = false; }); @@ -327,7 +327,7 @@ struct AutoNotify { } } -fn AutoNotify(+chan: Chan<Notification>) -> AutoNotify { +fn AutoNotify(chan: Chan<Notification>) -> AutoNotify { AutoNotify { notify_chan: chan, failed: true // Un-set above when taskgroup successfully made. @@ -377,13 +377,13 @@ fn kill_taskgroup(state: TaskGroupInner, me: *rust_task, is_main: bool) { // see 'None' if Somebody already failed and we got a kill signal.) if newstate.is_some() { let group = option::unwrap(move newstate); - for taskset_each(&group.members) |+sibling| { + for taskset_each(&group.members) |sibling| { // Skip self - killing ourself won't do much good. if sibling != me { rt::rust_task_kill_other(sibling); } } - for taskset_each(&group.descendants) |+child| { + for taskset_each(&group.descendants) |child| { assert child != me; rt::rust_task_kill_other(child); } @@ -486,7 +486,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) } } -fn spawn_raw(+opts: TaskOpts, +f: fn~()) { +fn spawn_raw(opts: TaskOpts, +f: fn~()) { let (child_tg, ancestors, is_main) = gen_child_taskgroup(opts.linked, opts.supervised); @@ -528,9 +528,9 @@ fn spawn_raw(+opts: TaskOpts, +f: fn~()) { // (3a) If any of those fails, it leaves all groups, and does nothing. // (3b) Otherwise it builds a task control structure and puts it in TLS, // (4) ...and runs the provided body function. - fn make_child_wrapper(child: *rust_task, +child_arc: TaskGroupArc, - +ancestors: AncestorList, is_main: bool, - +notify_chan: Option<Chan<Notification>>, + fn make_child_wrapper(child: *rust_task, child_arc: TaskGroupArc, + ancestors: AncestorList, is_main: bool, + notify_chan: Option<Chan<Notification>>, +f: fn~()) -> fn~() { let child_data = ~mut Some((move child_arc, move ancestors)); return fn~(move notify_chan, move child_data, move f) { |
