From f78cdcb6364cf938bfeb71da0c7eca62e257d537 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 2 Oct 2012 11:37:37 -0700 Subject: 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. --- src/libcore/task/local_data.rs | 32 ++++++++++++++++---------------- src/libcore/task/local_data_priv.rs | 2 +- src/libcore/task/spawn.rs | 20 ++++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/libcore/task') 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 = &fn(+v: @T); +pub type LocalDataKey = &fn(v: @T); /** * Remove a task-local data value from the table, returning the @@ -62,7 +62,7 @@ pub unsafe fn local_data_get( * that value is overwritten (and its destructor is run). */ pub unsafe fn local_data_set( - key: LocalDataKey, +data: @T) { + key: LocalDataKey, data: @T) { local_set(rt::rust_get_task(), key, data) } @@ -79,7 +79,7 @@ pub unsafe fn local_data_modify( #[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( } unsafe fn local_set( - task: *rust_task, key: LocalDataKey, +data: @T) { + task: *rust_task, key: LocalDataKey, 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) -> TCB { +fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList, + is_main: bool, notifier: Option) -> TCB { let notifier = move notifier; notifier.iter(|x| { x.failed = false; }); @@ -327,7 +327,7 @@ struct AutoNotify { } } -fn AutoNotify(+chan: Chan) -> AutoNotify { +fn AutoNotify(chan: Chan) -> 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>, + fn make_child_wrapper(child: *rust_task, child_arc: TaskGroupArc, + ancestors: AncestorList, is_main: bool, + notify_chan: Option>, +f: fn~()) -> fn~() { let child_data = ~mut Some((move child_arc, move ancestors)); return fn~(move notify_chan, move child_data, move f) { -- cgit 1.4.1-3-g733a5