diff options
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/comm.rs | 44 | ||||
| -rw-r--r-- | src/libcore/option.rs | 4 | ||||
| -rw-r--r-- | src/libcore/os.rs | 6 | ||||
| -rw-r--r-- | src/libcore/private.rs | 16 | ||||
| -rw-r--r-- | src/libcore/run.rs | 2 | ||||
| -rw-r--r-- | src/libcore/task.rs | 42 | ||||
| -rw-r--r-- | src/libcore/task/spawn.rs | 2 |
7 files changed, 58 insertions, 58 deletions
diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index 64c38d13e49..c9cd1a21b45 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -32,8 +32,8 @@ will once again be the preferred module for intertask communication. */ -// NB: transitionary, de-mode-ing -// tjc: re-forbid deprecated modes after snapshot +// NB: transitionary, de-mode-ing. +#[forbid(deprecated_mode)]; #[forbid(deprecated_pattern)]; use either::Either; @@ -74,7 +74,7 @@ pub fn Port<T: Send>() -> Port<T> { impl<T: Send> Port<T> { - fn chan() -> Chan<T> { Chan(self) } + fn chan() -> Chan<T> { Chan(&self) } fn send(v: T) { self.chan().send(move v) } fn recv() -> T { recv(self) } fn peek() -> bool { peek(self) } @@ -166,7 +166,7 @@ fn as_raw_port<T: Send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U { * Constructs a channel. The channel is bound to the port used to * construct it. */ -pub fn Chan<T: Send>(&&p: Port<T>) -> Chan<T> { +pub fn Chan<T: Send>(p: &Port<T>) -> Chan<T> { Chan_(rustrt::get_port_id((**p).po)) } @@ -304,19 +304,19 @@ extern mod rusti { #[test] -fn create_port_and_chan() { let p = Port::<int>(); Chan(p); } +fn create_port_and_chan() { let p = Port::<int>(); Chan(&p); } #[test] fn send_int() { let p = Port::<int>(); - let c = Chan(p); + let c = Chan(&p); send(c, 22); } #[test] fn send_recv_fn() { let p = Port::<int>(); - let c = Chan::<int>(p); + let c = Chan::<int>(&p); send(c, 42); assert (recv(p) == 42); } @@ -324,7 +324,7 @@ fn send_recv_fn() { #[test] fn send_recv_fn_infer() { let p = Port(); - let c = Chan(p); + let c = Chan(&p); send(c, 42); assert (recv(p) == 42); } @@ -332,23 +332,23 @@ fn send_recv_fn_infer() { #[test] fn chan_chan_infer() { let p = Port(), p2 = Port::<int>(); - let c = Chan(p); - send(c, Chan(p2)); + let c = Chan(&p); + send(c, Chan(&p2)); recv(p); } #[test] fn chan_chan() { let p = Port::<Chan<int>>(), p2 = Port::<int>(); - let c = Chan(p); - send(c, Chan(p2)); + let c = Chan(&p); + send(c, Chan(&p2)); recv(p); } #[test] fn test_peek() { let po = Port(); - let ch = Chan(po); + let ch = Chan(&po); assert !peek(po); send(ch, ()); assert peek(po); @@ -360,8 +360,8 @@ fn test_peek() { fn test_select2_available() { let po_a = Port(); let po_b = Port(); - let ch_a = Chan(po_a); - let ch_b = Chan(po_b); + let ch_a = Chan(&po_a); + let ch_b = Chan(&po_b); send(ch_a, ~"a"); @@ -376,8 +376,8 @@ fn test_select2_available() { fn test_select2_rendezvous() { let po_a = Port(); let po_b = Port(); - let ch_a = Chan(po_a); - let ch_b = Chan(po_b); + let ch_a = Chan(&po_a); + let ch_b = Chan(&po_b); for iter::repeat(10) { do task::spawn { @@ -400,8 +400,8 @@ fn test_select2_rendezvous() { fn test_select2_stress() { let po_a = Port(); let po_b = Port(); - let ch_a = Chan(po_a); - let ch_b = Chan(po_b); + let ch_a = Chan(&po_a); + let ch_b = Chan(&po_b); let msgs = 100; let times = 4u; @@ -436,7 +436,7 @@ fn test_select2_stress() { #[test] fn test_recv_chan() { let po = Port(); - let ch = Chan(po); + let ch = Chan(&po); send(ch, ~"flower"); assert recv_chan(ch) == ~"flower"; } @@ -445,7 +445,7 @@ fn test_recv_chan() { #[should_fail] #[ignore(cfg(windows))] fn test_recv_chan_dead() { - let ch = Chan(Port()); + let ch = Chan(&Port()); send(ch, ~"flower"); recv_chan(ch); } @@ -454,7 +454,7 @@ fn test_recv_chan_dead() { #[ignore(cfg(windows))] fn test_recv_chan_wrong_task() { let po = Port(); - let ch = Chan(po); + let ch = Chan(&po); send(ch, ~"flower"); assert result::is_err(&task::try(|| recv_chan(ch) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 1cdd4511e29..c222592a928 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -326,10 +326,10 @@ impl<T: Eq> Option<T> : Eq { #[test] fn test_unwrap_ptr() { let x = ~0; - let addr_x = ptr::p2::addr_of(&(*x)); + let addr_x = ptr::addr_of(&(*x)); let opt = Some(x); let y = unwrap(opt); - let addr_y = ptr::p2::addr_of(&(*y)); + let addr_y = ptr::addr_of(&(*y)); assert addr_x == addr_y; } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 68571da3a1e..1a9bd03539e 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -132,7 +132,7 @@ mod global_env { let env_ch = get_global_env_chan(); let po = comm::Port(); comm::send(env_ch, MsgGetEnv(str::from_slice(n), - comm::Chan(po))); + comm::Chan(&po))); comm::recv(po) } @@ -141,14 +141,14 @@ mod global_env { let po = comm::Port(); comm::send(env_ch, MsgSetEnv(str::from_slice(n), str::from_slice(v), - comm::Chan(po))); + comm::Chan(&po))); comm::recv(po) } pub fn env() -> ~[(~str,~str)] { let env_ch = get_global_env_chan(); let po = comm::Port(); - comm::send(env_ch, MsgEnv(comm::Chan(po))); + comm::send(env_ch, MsgEnv(comm::Chan(&po))); comm::recv(po) } diff --git a/src/libcore/private.rs b/src/libcore/private.rs index c1b2b32edaf..395e63ad30f 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -63,7 +63,7 @@ pub unsafe fn chan_from_global_ptr<T: Send>( let (setup_po, setup_ch) = do task_fn().spawn_conversation |move f, setup_po, setup_ch| { let po = comm::Port::<T>(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); comm::send(setup_ch, ch); // Wait to hear if we are the official instance of @@ -109,7 +109,7 @@ pub fn test_from_global_chan1() { // The global channel let globchan = 0; - let globchanp = ptr::p2::addr_of(&globchan); + let globchanp = ptr::addr_of(&globchan); // Create the global channel, attached to a new task let ch = unsafe { @@ -122,7 +122,7 @@ pub fn test_from_global_chan1() { }; // Talk to it let po = comm::Port(); - comm::send(ch, comm::Chan(po)); + comm::send(ch, comm::Chan(&po)); assert comm::recv(po) == true; // This one just reuses the previous channel @@ -135,7 +135,7 @@ pub fn test_from_global_chan1() { // Talk to the original global task let po = comm::Port(); - comm::send(ch, comm::Chan(po)); + comm::send(ch, comm::Chan(&po)); assert comm::recv(po) == true; } @@ -145,10 +145,10 @@ pub fn test_from_global_chan2() { for iter::repeat(100) { // The global channel let globchan = 0; - let globchanp = ptr::p2::addr_of(&globchan); + let globchanp = ptr::addr_of(&globchan); let resultpo = comm::Port(); - let resultch = comm::Chan(resultpo); + let resultch = comm::Chan(&resultpo); // Spawn a bunch of tasks that all want to compete to // create the global channel @@ -165,7 +165,7 @@ pub fn test_from_global_chan2() { } }; let po = comm::Port(); - comm::send(ch, comm::Chan(po)); + comm::send(ch, comm::Chan(&po)); // We are The winner if our version of the // task was installed let winner = comm::recv(po); @@ -203,7 +203,7 @@ pub fn test_from_global_chan2() { */ pub unsafe fn weaken_task(f: fn(comm::Port<()>)) { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); unsafe { rustrt::rust_task_weaken(cast::reinterpret_cast(&ch)); } diff --git a/src/libcore/run.rs b/src/libcore/run.rs index f3e98f6ba82..7ebca94f357 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -296,7 +296,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> // or the other. FIXME (#2625): Surely there's a much more // clever way to do this. let p = comm::Port(); - let ch = comm::Chan(p); + let ch = comm::Chan(&p); do task::spawn_sched(task::SingleThreaded) { let errput = readclose(pipe_err.in); comm::send(ch, (2, move errput)); diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 5ca35a7f562..efe6948ecef 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -479,10 +479,10 @@ impl TaskBuilder { */ fn spawn_listener<A: Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> { let setup_po = comm::Port(); - let setup_ch = comm::Chan(setup_po); + let setup_ch = comm::Chan(&setup_po); do self.spawn |move f| { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); comm::send(setup_ch, ch); f(move po); } @@ -496,7 +496,7 @@ impl TaskBuilder { (+f: fn~(comm::Port<A>, comm::Chan<B>)) -> (comm::Port<B>, comm::Chan<A>) { let from_child = comm::Port(); - let to_parent = comm::Chan(from_child); + let to_parent = comm::Chan(&from_child); let to_child = do self.spawn_listener |move f, from_parent| { f(from_parent, to_parent) }; @@ -518,7 +518,7 @@ impl TaskBuilder { */ fn try<T: Send>(+f: fn~() -> T) -> Result<T,()> { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); let mut result = None; let fr_task_builder = self.future_result(|+r| { @@ -772,7 +772,7 @@ fn test_cant_dup_task_builder() { #[test] #[ignore(cfg(windows))] fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); do spawn_unlinked { do spawn_unlinked { // Give middle task a chance to fail-but-not-kill-us. @@ -802,7 +802,7 @@ fn test_spawn_unlinked_sup_fail_down() { #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_linked_sup_fail_up() { // child fails; parent fails let po = comm::Port::<()>(); - let _ch = comm::Chan(po); + let _ch = comm::Chan(&po); // Unidirectional "parenting" shouldn't override bidirectional linked. // We have to cheat with opts - the interface doesn't support them because // they don't make sense (redundant with task().supervised()). @@ -845,7 +845,7 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails let po = comm::Port::<()>(); - let _ch = comm::Chan(po); + let _ch = comm::Chan(&po); // Default options are to spawn linked & unsupervised. do spawn { fail; } comm::recv(po); // We should get punted awake @@ -917,7 +917,7 @@ fn test_spawn_linked_sup_propagate_sibling() { #[test] fn test_run_basic() { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); do task().spawn { comm::send(ch, ()); } @@ -927,7 +927,7 @@ fn test_run_basic() { #[test] fn test_add_wrapper() { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); let b0 = task(); let b1 = do b0.add_wrapper |body| { fn~() { @@ -961,7 +961,7 @@ fn test_back_to_the_future_result() { #[test] fn test_spawn_listiner_bidi() { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); let ch = do spawn_listener |po| { // Now the child has a port called 'po' to read from and // an environment-captured channel called 'ch'. @@ -1017,7 +1017,7 @@ fn test_spawn_sched_no_threads() { #[test] fn test_spawn_sched() { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); fn f(i: int, ch: comm::Chan<()>) { let parent_sched_id = rt::rust_get_sched_id(); @@ -1041,7 +1041,7 @@ fn test_spawn_sched() { #[test] fn test_spawn_sched_childs_on_same_sched() { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); do spawn_sched(SingleThreaded) { let parent_sched_id = rt::rust_get_sched_id(); @@ -1075,9 +1075,9 @@ fn test_spawn_sched_blocking() { for iter::repeat(20u) { let start_po = comm::Port(); - let start_ch = comm::Chan(start_po); + let start_ch = comm::Chan(&start_po); let fin_po = comm::Port(); - let fin_ch = comm::Chan(fin_po); + let fin_ch = comm::Chan(&fin_po); let lock = testrt::rust_dbg_lock_create(); @@ -1105,12 +1105,12 @@ fn test_spawn_sched_blocking() { } let setup_po = comm::Port(); - let setup_ch = comm::Chan(setup_po); + let setup_ch = comm::Chan(&setup_po); let parent_po = comm::Port(); - let parent_ch = comm::Chan(parent_po); + let parent_ch = comm::Chan(&parent_po); do spawn { let child_po = comm::Port(); - comm::send(setup_ch, comm::Chan(child_po)); + comm::send(setup_ch, comm::Chan(&child_po)); pingpong(child_po, parent_ch); }; @@ -1128,13 +1128,13 @@ fn test_spawn_sched_blocking() { #[cfg(test)] fn avoid_copying_the_body(spawnfn: fn(+v: fn~())) { let p = comm::Port::<uint>(); - let ch = comm::Chan(p); + let ch = comm::Chan(&p); let x = ~1; - let x_in_parent = ptr::p2::addr_of(&(*x)) as uint; + let x_in_parent = ptr::addr_of(&(*x)) as uint; do spawnfn { - let x_in_child = ptr::p2::addr_of(&(*x)) as uint; + let x_in_child = ptr::addr_of(&(*x)) as uint; comm::send(ch, x_in_child); } @@ -1195,7 +1195,7 @@ fn test_avoid_copying_the_body_unlinked() { #[test] fn test_platform_thread() { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); do task().sched_mode(PlatformThread).spawn { comm::send(ch, ()); } diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index ff07150cfa2..2033db0d58d 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -636,7 +636,7 @@ pub fn spawn_raw(opts: TaskOpts, +f: fn~()) { #[test] fn test_spawn_raw_simple() { let po = comm::Port(); - let ch = comm::Chan(po); + let ch = comm::Chan(&po); do spawn_raw(default_task_opts()) { comm::send(ch, ()); } |
