From bc9efaad9c978f71bd7ac2c91efbc957e25d43fb Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 28 Sep 2012 00:22:18 -0700 Subject: std: Eliminate deprecated patterns --- src/libstd/timer.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'src/libstd/timer.rs') diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 1476d6bdf31..ae79892b873 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -1,7 +1,6 @@ //! Utilities that leverage libuv's `uv_timer_*` API #[forbid(deprecated_mode)]; -#[forbid(deprecated_pattern)]; use uv = uv; use uv::iotask; -- cgit 1.4.1-3-g733a5 From 70ae3e7bf212b0db5949e113858bae1da0e6ae29 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 28 Sep 2012 14:55:31 -0700 Subject: De-export std::{bitv, cell, timer}. Part of #3583. --- src/libstd/bitv.rs | 12 +++++------- src/libstd/cell.rs | 6 +++--- src/libstd/std.rc | 3 --- src/libstd/timer.rs | 10 ++++------ 4 files changed, 12 insertions(+), 19 deletions(-) (limited to 'src/libstd/timer.rs') diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 33065fffd03..370c5ddb566 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -2,8 +2,6 @@ use vec::{to_mut, from_elem}; -export Bitv, from_bytes, from_bools, from_fn; - struct SmallBitv { /// only the lowest nbits of this value are used. the rest is undefined. mut bits: u32 @@ -209,12 +207,12 @@ enum BitvVariant { Big(~BigBitv), Small(~SmallBitv) } enum Op {Union, Intersect, Assign, Difference} // The bitvector type -struct Bitv { +pub struct Bitv { rep: BitvVariant, nbits: uint } -fn Bitv (nbits: uint, init: bool) -> Bitv { +pub fn Bitv (nbits: uint, init: bool) -> Bitv { let rep = if nbits <= 32 { Small(~SmallBitv(if init {!0} else {0})) } @@ -519,7 +517,7 @@ impl Bitv { * with the most significant bits of each byte coming first. Each * bit becomes true if equal to 1 or false if equal to 0. */ -fn from_bytes(bytes: &[u8]) -> Bitv { +pub fn from_bytes(bytes: &[u8]) -> Bitv { from_fn(bytes.len() * 8, |i| { let b = bytes[i / 8] as uint; let offset = i % 8; @@ -530,7 +528,7 @@ fn from_bytes(bytes: &[u8]) -> Bitv { /** * Transform a [bool] into a bitv by converting each bool into a bit. */ -fn from_bools(bools: &[bool]) -> Bitv { +pub fn from_bools(bools: &[bool]) -> Bitv { from_fn(bools.len(), |i| bools[i]) } @@ -538,7 +536,7 @@ fn from_bools(bools: &[bool]) -> Bitv { * Create a bitv of the specified length where the value at each * index is f(index). */ -fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv { +pub fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv { let bitv = Bitv(len, false); for uint::range(0, len) |i| { bitv.set(i, f(i)); diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index 4ef695f4198..43e47e1e1a9 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -3,16 +3,16 @@ /// /// Similar to a mutable option type, but friendlier. -struct Cell { +pub struct Cell { mut value: Option } /// Creates a new full cell with the given value. -fn Cell(+value: T) -> Cell { +pub fn Cell(+value: T) -> Cell { Cell { value: Some(move value) } } -fn empty_cell() -> Cell { +pub fn empty_cell() -> Cell { Cell { value: None } } diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 5370f20cfa1..13f7b967723 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -69,9 +69,7 @@ mod uv_global_loop; #[legacy_exports] mod c_vec; -#[legacy_exports] mod timer; -#[legacy_exports] mod cell; // Concurrency @@ -85,7 +83,6 @@ mod comm; // Collections -#[legacy_exports] mod bitv; #[legacy_exports] mod deque; diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index ae79892b873..a2f9796f89e 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -7,8 +7,6 @@ use uv::iotask; use iotask::IoTask; use comm = core::comm; -export delayed_send, sleep, recv_timeout; - /** * Wait for timeout period then send provided value over a channel * @@ -25,8 +23,8 @@ export delayed_send, sleep, recv_timeout; * * ch - a channel of type T to send a `val` on * * val - a value of type T to send over the provided `ch` */ -fn delayed_send(iotask: IoTask, - msecs: uint, ch: comm::Chan, +val: T) { +pub fn delayed_send(iotask: IoTask, + msecs: uint, ch: comm::Chan, +val: T) { unsafe { let timer_done_po = core::comm::Port::<()>(); let timer_done_ch = core::comm::Chan(timer_done_po); @@ -74,7 +72,7 @@ fn delayed_send(iotask: IoTask, * * `iotask` - a `uv::iotask` that the tcp request will run on * * msecs - an amount of time, in milliseconds, for the current task to block */ -fn sleep(iotask: IoTask, msecs: uint) { +pub fn sleep(iotask: IoTask, msecs: uint) { let exit_po = core::comm::Port::<()>(); let exit_ch = core::comm::Chan(exit_po); delayed_send(iotask, msecs, exit_ch, ()); @@ -101,7 +99,7 @@ fn sleep(iotask: IoTask, msecs: uint) { * on the provided port in the allotted timeout period, then the result will * be a `some(T)`. If not, then `none` will be returned. */ -fn recv_timeout(iotask: IoTask, +pub fn recv_timeout(iotask: IoTask, msecs: uint, wait_po: comm::Port) -> Option { let timeout_po = comm::Port::<()>(); -- cgit 1.4.1-3-g733a5 From b18320446e553a3f8436f87306dded57e16a4b94 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 1 Oct 2012 12:47:02 -0700 Subject: Move over to calling ptr::addr_of Everything should now call ptr::addr_of instead of ptr::p2::addr_of. Only the pipes macro code when compiled by stage0 will call ptr::p2::addr_of. Needs a snapshot to get rid of that. --- doc/tutorial-ffi.md | 2 +- src/libcore/at_vec.rs | 2 +- src/libcore/box.rs | 2 +- src/libcore/comm.rs | 12 +++--- src/libcore/flate.rs | 4 +- src/libcore/gc.rs | 2 +- src/libcore/pipes.rs | 18 ++++----- src/libcore/ptr.rs | 5 +-- src/libcore/str.rs | 2 +- src/libcore/task/spawn.rs | 2 +- src/libcore/vec.rs | 2 +- src/libstd/dbg.rs | 8 ++-- src/libstd/net_ip.rs | 6 +-- src/libstd/net_tcp.rs | 42 ++++++++++----------- src/libstd/sync.rs | 4 +- src/libstd/timer.rs | 4 +- src/libstd/uv_global_loop.rs | 4 +- src/libstd/uv_iotask.rs | 10 ++--- src/libstd/uv_ll.rs | 44 +++++++++++----------- src/libsyntax/ast.rs | 4 +- src/libsyntax/ext/fmt.rs | 2 +- src/libsyntax/ext/pipes/pipec.rs | 6 +-- src/rustc/middle/lang_items.rs | 2 +- src/rustc/middle/liveness.rs | 2 +- src/rustc/middle/trans/build.rs | 6 +-- src/rustc/middle/trans/common.rs | 2 +- src/rustc/middle/typeck/check.rs | 2 +- src/test/auxiliary/test_comm.rs | 6 +-- src/test/bench/msgsend-pipes-shared.rs | 2 +- src/test/bench/msgsend-pipes.rs | 2 +- src/test/bench/msgsend-ring-pipes.rs | 2 +- src/test/bench/pingpong.rs | 2 +- src/test/bench/task-perf-word-count-generic.rs | 2 +- src/test/run-pass/binops.rs | 4 +- .../run-pass/borrowck-borrow-from-expr-block.rs | 2 +- .../run-pass/borrowck-preserve-box-in-discr.rs | 6 +-- .../run-pass/borrowck-preserve-box-in-field.rs | 6 +-- src/test/run-pass/borrowck-preserve-box-in-pat.rs | 6 +-- src/test/run-pass/borrowck-preserve-box-in-uniq.rs | 6 +-- src/test/run-pass/borrowck-preserve-box.rs | 6 +-- src/test/run-pass/borrowck-preserve-expl-deref.rs | 6 +-- src/test/run-pass/cap-clause-move.rs | 24 ++++++------ src/test/run-pass/issue-2718.rs | 4 +- src/test/run-pass/last-use-corner-cases.rs | 8 ++-- src/test/run-pass/pipe-bank-proto.rs | 2 +- src/test/run-pass/pipe-pingpong-bounded.rs | 10 ++--- src/test/run-pass/reflect-visit-data.rs | 2 +- src/test/run-pass/resource-cycle.rs | 12 +++--- src/test/run-pass/rt-sched-1.rs | 2 +- src/test/run-pass/select-macro.rs | 2 +- src/test/run-pass/stable-addr-of.rs | 2 +- src/test/run-pass/task-killjoin-rsrc.rs | 4 +- src/test/run-pass/task-spawn-move-and-copy.rs | 8 ++-- src/test/run-pass/uniq-cc-generic.rs | 2 +- 54 files changed, 169 insertions(+), 172 deletions(-) (limited to 'src/libstd/timer.rs') diff --git a/doc/tutorial-ffi.md b/doc/tutorial-ffi.md index 92ba09856b0..463bd4746fe 100644 --- a/doc/tutorial-ffi.md +++ b/doc/tutorial-ffi.md @@ -231,7 +231,7 @@ fn unix_time_in_microseconds() -> u64 unsafe { mut tv_sec: 0 as c_ulonglong, mut tv_usec: 0 as c_ulonglong }; - lib_c::gettimeofday(ptr::addr_of(x), ptr::null()); + lib_c::gettimeofday(ptr::addr_of(&x), ptr::null()); return (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64); } diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 6377c25b8c4..6936de2bccb 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -5,7 +5,7 @@ #[forbid(deprecated_pattern)]; use cast::transmute; -use ptr::p2::addr_of; +use ptr::addr_of; /// Code for dealing with @-vectors. This is pretty incomplete, and /// contains a bunch of duplication from the code for ~-vectors. diff --git a/src/libcore/box.rs b/src/libcore/box.rs index 43307b92664..d34679f2bd7 100644 --- a/src/libcore/box.rs +++ b/src/libcore/box.rs @@ -24,7 +24,7 @@ pub mod raw { pub pure fn ptr_eq(a: @T, b: @T) -> bool { //! Determine if two shared boxes point to the same object - unsafe { ptr::p2::addr_of(&(*a)) == ptr::p2::addr_of(&(*b)) } + unsafe { ptr::addr_of(&(*a)) == ptr::addr_of(&(*b)) } } impl @const T : Eq { diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index 37468aaaab6..46767bc1172 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -103,7 +103,7 @@ struct PortPtr { // Once the port is detached it's guaranteed not to receive further // messages let yield = 0; - let yieldp = ptr::p2::addr_of(&yield); + let yieldp = ptr::addr_of(&yield); rustrt::rust_port_begin_detach(self.po, yieldp); if yield != 0 { // Need to wait for the port to be detached @@ -176,7 +176,7 @@ pub fn Chan(p: Port) -> Chan { */ pub fn send(ch: Chan, +data: T) { let Chan_(p) = ch; - let data_ptr = ptr::p2::addr_of(&data) as *(); + let data_ptr = ptr::addr_of(&data) as *(); let res = rustrt::rust_port_id_send(p, data_ptr); if res != 0 unsafe { // Data sent successfully @@ -206,10 +206,10 @@ fn peek_chan(ch: comm::Chan) -> bool { /// Receive on a raw port pointer fn recv_(p: *rust_port) -> T { let yield = 0; - let yieldp = ptr::p2::addr_of(&yield); + let yieldp = ptr::addr_of(&yield); let mut res; res = rusti::init::(); - rustrt::port_recv(ptr::p2::addr_of(&res) as *uint, p, yieldp); + rustrt::port_recv(ptr::addr_of(&res) as *uint, p, yieldp); if yield != 0 { // Data isn't available yet, so res has not been initialized. @@ -233,12 +233,12 @@ fn peek_(p: *rust_port) -> bool { pub fn select2(p_a: Port, p_b: Port) -> Either { let ports = ~[(**p_a).po, (**p_b).po]; - let yield = 0, yieldp = ptr::p2::addr_of(&yield); + let yield = 0, yieldp = ptr::addr_of(&yield); let mut resport: *rust_port; resport = rusti::init::<*rust_port>(); do vec::as_imm_buf(ports) |ports, n_ports| { - rustrt::rust_port_select(ptr::p2::addr_of(&resport), ports, + rustrt::rust_port_select(ptr::addr_of(&resport), ports, n_ports as size_t, yieldp); } diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index cfc34b03a94..7c5176494a2 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -34,7 +34,7 @@ pub fn deflate_bytes(bytes: &[const u8]) -> ~[u8] { let res = rustrt::tdefl_compress_mem_to_heap(b as *c_void, len as size_t, - ptr::addr_of(outsz), + ptr::addr_of(&outsz), lz_norm); assert res as int != 0; let out = vec::raw::from_buf(res as *u8, @@ -52,7 +52,7 @@ pub fn inflate_bytes(bytes: &[const u8]) -> ~[u8] { let res = rustrt::tinfl_decompress_mem_to_heap(b as *c_void, len as size_t, - ptr::addr_of(outsz), + ptr::addr_of(&outsz), 0); assert res as int != 0; let out = vec::raw::from_buf(res as *u8, diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index ace4156f5b4..de2e4412812 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -316,7 +316,7 @@ pub fn cleanup_stack_for_failure() { // own stack roots on the stack anyway. let sentinel_box = ~0; let sentinel: **Word = if expect_sentinel() { - cast::reinterpret_cast(&ptr::p2::addr_of(&sentinel_box)) + cast::reinterpret_cast(&ptr::addr_of(&sentinel_box)) } else { ptr::null() }; diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 95edeca9837..4d446df9cd5 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -85,7 +85,7 @@ use option::unwrap; const SPIN_COUNT: uint = 0; macro_rules! move_it ( - { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); move y } } + { $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); move y } } ) #[doc(hidden)] @@ -219,7 +219,7 @@ fn unibuffer() -> ~Buffer> { #[doc(hidden)] pub fn packet() -> *Packet { let b = unibuffer(); - let p = ptr::p2::addr_of(&(b.data)); + let p = ptr::addr_of(&(b.data)); // We'll take over memory management from here. unsafe { forget(move b) } p @@ -359,7 +359,7 @@ pub fn send(+p: SendPacketBuffered, let header = p.header(); let p_ = p.unwrap(); let p = unsafe { &*p_ }; - assert ptr::p2::addr_of(&(p.header)) == header; + assert ptr::addr_of(&(p.header)) == header; assert p.payload.is_none(); p.payload <- Some(move payload); let old_state = swap_state_rel(&mut p.header.state, Full); @@ -377,7 +377,7 @@ pub fn send(+p: SendPacketBuffered, let old_task = swap_task(&mut p.header.blocked_task, ptr::null()); if !old_task.is_null() { rustrt::task_signal_event( - old_task, ptr::p2::addr_of(&(p.header)) as *libc::c_void); + old_task, ptr::addr_of(&(p.header)) as *libc::c_void); rustrt::rust_task_deref(old_task); } @@ -529,7 +529,7 @@ fn sender_terminate(p: *Packet) { if !old_task.is_null() { rustrt::task_signal_event( old_task, - ptr::p2::addr_of(&(p.header)) as *libc::c_void); + ptr::addr_of(&(p.header)) as *libc::c_void); rustrt::rust_task_deref(old_task); } // The receiver will eventually clean up. @@ -744,7 +744,7 @@ pub fn SendPacketBuffered(p: *Packet) p: Some(p), buffer: unsafe { Some(BufferResource( - get_buffer(ptr::p2::addr_of(&((*p).header))))) + get_buffer(ptr::addr_of(&((*p).header))))) } } } @@ -760,7 +760,7 @@ impl SendPacketBuffered { match self.p { Some(packet) => unsafe { let packet = &*packet; - let header = ptr::p2::addr_of(&(packet.header)); + let header = ptr::addr_of(&(packet.header)); //forget(packet); header }, @@ -815,7 +815,7 @@ impl RecvPacketBuffered : Selectable { match self.p { Some(packet) => unsafe { let packet = &*packet; - let header = ptr::p2::addr_of(&(packet.header)); + let header = ptr::addr_of(&(packet.header)); //forget(packet); header }, @@ -838,7 +838,7 @@ pub fn RecvPacketBuffered(p: *Packet) p: Some(p), buffer: unsafe { Some(BufferResource( - get_buffer(ptr::p2::addr_of(&((*p).header))))) + get_buffer(ptr::addr_of(&((*p).header))))) } } } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 9f9d2eea0e6..550b0121e45 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -24,12 +24,9 @@ extern mod rusti { fn addr_of(val: T) -> *T; } -/* -Remove this after snapshot; make p2::addr_of addr_of -*/ /// Get an unsafe pointer to a value #[inline(always)] -pub pure fn addr_of(val: T) -> *T { unsafe { rusti::addr_of(val) } } +pub pure fn addr_of(val: &T) -> *T { unsafe { rusti::addr_of(*val) } } pub mod p2 { /// Get an unsafe pointer to a value diff --git a/src/libcore/str.rs b/src/libcore/str.rs index c6e7116675f..227635944dd 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -1780,7 +1780,7 @@ pub pure fn as_c_str(s: &str, f: fn(*libc::c_char) -> T) -> T { #[inline(always)] pub pure fn as_buf(s: &str, f: fn(*u8, uint) -> T) -> T { unsafe { - let v : *(*u8,uint) = ::cast::reinterpret_cast(&ptr::p2::addr_of(&s)); + let v : *(*u8,uint) = ::cast::reinterpret_cast(&ptr::addr_of(&s)); let (buf,len) = *v; f(buf, len) } diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 2095961e14e..982679f9398 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -66,7 +66,7 @@ use rt::rust_task; use rt::rust_closure; macro_rules! move_it ( - { $x:expr } => { unsafe { let y <- *ptr::p2::addr_of(&($x)); move y } } + { $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); move y } } ) type TaskSet = send_map::linear::LinearMap<*rust_task,()>; diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index a8286eb4e08..d01b24f5354 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -6,7 +6,7 @@ use cmp::{Eq, Ord}; use option::{Some, None}; -use ptr::p2::addr_of; +use ptr::addr_of; use libc::size_t; export append; diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index 26b2a02ec9c..df97df51643 100644 --- a/src/libstd/dbg.rs +++ b/src/libstd/dbg.rs @@ -21,19 +21,19 @@ pub fn debug_tydesc() { } pub fn debug_opaque(+x: T) { - rustrt::debug_opaque(sys::get_type_desc::(), ptr::addr_of(x) as *()); + rustrt::debug_opaque(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } pub fn debug_box(x: @T) { - rustrt::debug_box(sys::get_type_desc::(), ptr::addr_of(x) as *()); + rustrt::debug_box(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } pub fn debug_tag(+x: T) { - rustrt::debug_tag(sys::get_type_desc::(), ptr::addr_of(x) as *()); + rustrt::debug_tag(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } pub fn debug_fn(+x: T) { - rustrt::debug_fn(sys::get_type_desc::(), ptr::addr_of(x) as *()); + rustrt::debug_fn(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } pub unsafe fn ptr_cast(x: @T) -> @U { diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs index 321eb3158a9..9aa29df4a62 100644 --- a/src/libstd/net_ip.rs +++ b/src/libstd/net_ip.rs @@ -89,11 +89,11 @@ fn get_addr(node: &str, iotask: iotask) do str::as_buf(node) |node_ptr, len| unsafe { log(debug, fmt!("slice len %?", len)); let handle = create_uv_getaddrinfo_t(); - let handle_ptr = ptr::addr_of(handle); + let handle_ptr = ptr::addr_of(&handle); let handle_data: GetAddrData = { output_ch: output_ch }; - let handle_data_ptr = ptr::addr_of(handle_data); + let handle_data_ptr = ptr::addr_of(&handle_data); do interact(iotask) |loop_ptr| unsafe { let result = uv_getaddrinfo( loop_ptr, @@ -150,7 +150,7 @@ mod v4 { impl Ipv4Rep: AsUnsafeU32 { // this is pretty dastardly, i know unsafe fn as_u32() -> u32 { - *((ptr::addr_of(self)) as *u32) + *((ptr::addr_of(&self)) as *u32) } } fn parse_to_ipv4_rep(ip: &str) -> result::Result { diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 820c2bfcc4d..aedd53d41cc 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -138,7 +138,7 @@ fn connect(+input_ip: ip::IpAddr, port: uint, result_ch: core::comm::Chan(result_po), closed_signal_ch: core::comm::Chan(closed_signal_po) }; - let conn_data_ptr = ptr::addr_of(conn_data); + let conn_data_ptr = ptr::addr_of(&conn_data); let reader_po = core::comm::Port::>(); let stream_handle_ptr = malloc_uv_tcp_t(); *(stream_handle_ptr as *mut uv::ll::uv_tcp_t) = uv::ll::tcp_t(); @@ -150,7 +150,7 @@ fn connect(+input_ip: ip::IpAddr, port: uint, write_req: uv::ll::write_t(), iotask: iotask }; - let socket_data_ptr = ptr::addr_of(*socket_data); + let socket_data_ptr = ptr::addr_of(&(*socket_data)); log(debug, fmt!("tcp_connect result_ch %?", conn_data.result_ch)); // get an unsafe representation of our stream_handle_ptr that // we can send into the interact cb to be handled in libuv.. @@ -165,7 +165,7 @@ fn connect(+input_ip: ip::IpAddr, port: uint, log(debug, ~"tcp_init successful"); log(debug, ~"dealing w/ ipv4 connection.."); let connect_req_ptr = - ptr::addr_of((*socket_data_ptr).connect_req); + ptr::addr_of(&((*socket_data_ptr).connect_req)); let addr_str = ip::format_addr(&input_ip); let connect_result = match input_ip { ip::Ipv4(ref addr) => { @@ -179,7 +179,7 @@ fn connect(+input_ip: ip::IpAddr, port: uint, uv::ll::tcp_connect( connect_req_ptr, stream_handle_ptr, - ptr::addr_of(in_addr), + ptr::addr_of(&in_addr), tcp_connect_on_connect_cb) } ip::Ipv6(ref addr) => { @@ -188,7 +188,7 @@ fn connect(+input_ip: ip::IpAddr, port: uint, uv::ll::tcp_connect6( connect_req_ptr, stream_handle_ptr, - ptr::addr_of(in_addr), + ptr::addr_of(&in_addr), tcp_connect_on_connect_cb) } }; @@ -264,7 +264,7 @@ fn connect(+input_ip: ip::IpAddr, port: uint, */ fn write(sock: &TcpSocket, raw_write_data: ~[u8]) -> result::Result<(), TcpErrData> unsafe { - let socket_data_ptr = ptr::addr_of(*(sock.socket_data)); + let socket_data_ptr = ptr::addr_of(&(*(sock.socket_data))); write_common_impl(socket_data_ptr, raw_write_data) } @@ -301,7 +301,7 @@ fn write(sock: &TcpSocket, raw_write_data: ~[u8]) */ fn write_future(sock: &TcpSocket, raw_write_data: ~[u8]) -> future::Future> unsafe { - let socket_data_ptr = ptr::addr_of(*(sock.socket_data)); + let socket_data_ptr = ptr::addr_of(&(*(sock.socket_data))); do future_spawn { let data_copy = copy(raw_write_data); write_common_impl(socket_data_ptr, data_copy) @@ -326,7 +326,7 @@ fn write_future(sock: &TcpSocket, raw_write_data: ~[u8]) fn read_start(sock: &TcpSocket) -> result::Result>, TcpErrData> unsafe { - let socket_data = ptr::addr_of(*(sock.socket_data)); + let socket_data = ptr::addr_of(&(*(sock.socket_data))); read_start_common_impl(socket_data) } @@ -341,7 +341,7 @@ fn read_stop(sock: &TcpSocket, +read_port: comm::Port>) -> result::Result<(), TcpErrData> unsafe { log(debug, fmt!("taking the read_port out of commission %?", read_port)); - let socket_data = ptr::addr_of(*sock.socket_data); + let socket_data = ptr::addr_of(&(*sock.socket_data)); read_stop_common_impl(socket_data) } @@ -362,7 +362,7 @@ fn read_stop(sock: &TcpSocket, */ fn read(sock: &TcpSocket, timeout_msecs: uint) -> result::Result<~[u8],TcpErrData> { - let socket_data = ptr::addr_of(*(sock.socket_data)); + let socket_data = ptr::addr_of(&(*(sock.socket_data))); read_common_impl(socket_data, timeout_msecs) } @@ -397,7 +397,7 @@ fn read(sock: &TcpSocket, timeout_msecs: uint) */ fn read_future(sock: &TcpSocket, timeout_msecs: uint) -> future::Future> { - let socket_data = ptr::addr_of(*(sock.socket_data)); + let socket_data = ptr::addr_of(&(*(sock.socket_data))); do future_spawn { read_common_impl(socket_data, timeout_msecs) } @@ -491,7 +491,7 @@ fn accept(new_conn: TcpNewConnection) write_req : uv::ll::write_t(), iotask : iotask }; - let client_socket_data_ptr = ptr::addr_of(*client_socket_data); + let client_socket_data_ptr = ptr::addr_of(&(*client_socket_data)); let client_stream_handle_ptr = (*client_socket_data_ptr).stream_handle_ptr; @@ -596,7 +596,7 @@ fn listen_common(+host_ip: ip::IpAddr, port: uint, backlog: uint, let kill_po = core::comm::Port::>(); let kill_ch = core::comm::Chan(kill_po); let server_stream = uv::ll::tcp_t(); - let server_stream_ptr = ptr::addr_of(server_stream); + let server_stream_ptr = ptr::addr_of(&server_stream); let server_data = { server_stream_ptr: server_stream_ptr, stream_closed_ch: core::comm::Chan(stream_closed_po), @@ -605,7 +605,7 @@ fn listen_common(+host_ip: ip::IpAddr, port: uint, backlog: uint, iotask: iotask, mut active: true }; - let server_data_ptr = ptr::addr_of(server_data); + let server_data_ptr = ptr::addr_of(&server_data); let setup_result = do core::comm::listen |setup_ch| { // this is to address a compiler warning about @@ -627,13 +627,13 @@ fn listen_common(+host_ip: ip::IpAddr, port: uint, backlog: uint, log(debug, fmt!("addr: %?", addr)); let in_addr = uv::ll::ip4_addr(addr_str, port as int); uv::ll::tcp_bind(server_stream_ptr, - ptr::addr_of(in_addr)) + ptr::addr_of(&in_addr)) } ip::Ipv6(ref addr) => { log(debug, fmt!("addr: %?", addr)); let in_addr = uv::ll::ip6_addr(addr_str, port as int); uv::ll::tcp_bind6(server_stream_ptr, - ptr::addr_of(in_addr)) + ptr::addr_of(&in_addr)) } }; match bind_result { @@ -818,7 +818,7 @@ impl TcpSocketBuf: io::Reader { impl TcpSocketBuf: io::Writer { fn write(data: &[const u8]) unsafe { let socket_data_ptr = - ptr::addr_of(*((*(self.data)).sock).socket_data); + ptr::addr_of(&(*((*(self.data)).sock).socket_data)); let w_result = write_common_impl(socket_data_ptr, vec::slice(data, 0, vec::len(data))); if w_result.is_err() { @@ -850,7 +850,7 @@ fn tear_down_socket_data(socket_data: @TcpSocketData) unsafe { let close_data = { closed_ch: closed_ch }; - let close_data_ptr = ptr::addr_of(close_data); + let close_data_ptr = ptr::addr_of(&close_data); let stream_handle_ptr = (*socket_data).stream_handle_ptr; do iotask::interact((*socket_data).iotask) |loop_ptr| unsafe { log(debug, fmt!("interact dtor for tcp_socket stream %? loop %?", @@ -966,18 +966,18 @@ fn read_start_common_impl(socket_data: *TcpSocketData) fn write_common_impl(socket_data_ptr: *TcpSocketData, raw_write_data: ~[u8]) -> result::Result<(), TcpErrData> unsafe { - let write_req_ptr = ptr::addr_of((*socket_data_ptr).write_req); + let write_req_ptr = ptr::addr_of(&((*socket_data_ptr).write_req)); let stream_handle_ptr = (*socket_data_ptr).stream_handle_ptr; let write_buf_vec = ~[ uv::ll::buf_init( vec::raw::to_ptr(raw_write_data), vec::len(raw_write_data)) ]; - let write_buf_vec_ptr = ptr::addr_of(write_buf_vec); + let write_buf_vec_ptr = ptr::addr_of(&write_buf_vec); let result_po = core::comm::Port::(); let write_data = { result_ch: core::comm::Chan(result_po) }; - let write_data_ptr = ptr::addr_of(write_data); + let write_data_ptr = ptr::addr_of(&write_data); do iotask::interact((*socket_data_ptr).iotask) |loop_ptr| unsafe { log(debug, fmt!("in interact cb for tcp::write %?", loop_ptr)); match uv::ll::write(write_req_ptr, diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 2b2cd2b0ba7..f66f2f5b5d3 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -773,7 +773,7 @@ mod tests { let m = ~Mutex(); let m2 = ~m.clone(); let mut sharedstate = ~0; - let ptr = ptr::addr_of(*sharedstate); + let ptr = ptr::p2::addr_of(&(*sharedstate)); do task::spawn { let sharedstate: &mut int = unsafe { cast::reinterpret_cast(&ptr) }; @@ -1045,7 +1045,7 @@ mod tests { let (c,p) = pipes::stream(); let x2 = ~x.clone(); let mut sharedstate = ~0; - let ptr = ptr::addr_of(*sharedstate); + let ptr = ptr::p2::addr_of(&(*sharedstate)); do task::spawn { let sharedstate: &mut int = unsafe { cast::reinterpret_cast(&ptr) }; diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index a2f9796f89e..8aaf7d3fd87 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -28,9 +28,9 @@ pub fn delayed_send(iotask: IoTask, unsafe { let timer_done_po = core::comm::Port::<()>(); let timer_done_ch = core::comm::Chan(timer_done_po); - let timer_done_ch_ptr = ptr::addr_of(timer_done_ch); + let timer_done_ch_ptr = ptr::addr_of(&timer_done_ch); let timer = uv::ll::timer_t(); - let timer_ptr = ptr::addr_of(timer); + let timer_ptr = ptr::addr_of(&timer); do iotask::interact(iotask) |loop_ptr| unsafe { let init_result = uv::ll::timer_init(loop_ptr, timer_ptr); if (init_result == 0i32) { diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 508426588d0..9ccacd1f7f6 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -138,11 +138,11 @@ mod test { fn impl_uv_hl_simple_timer(iotask: IoTask) unsafe { let exit_po = core::comm::Port::(); let exit_ch = core::comm::Chan(exit_po); - let exit_ch_ptr = ptr::addr_of(exit_ch); + let exit_ch_ptr = ptr::p2::addr_of(&exit_ch); log(debug, fmt!("EXIT_CH_PTR newly created exit_ch_ptr: %?", exit_ch_ptr)); let timer_handle = ll::timer_t(); - let timer_ptr = ptr::addr_of(timer_handle); + let timer_ptr = ptr::p2::addr_of(&timer_handle); do iotask::interact(iotask) |loop_ptr| unsafe { log(debug, ~"user code inside interact loop!!!"); let init_status = ll::timer_init(loop_ptr, timer_ptr); diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index c31238ecf4f..ab50cc9d929 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -13,7 +13,7 @@ export interact; export exit; use libc::c_void; -use ptr::addr_of; +use ptr::p2::addr_of; use comm = core::comm; use comm::{Port, Chan, listen}; use task::TaskBuilder; @@ -96,7 +96,7 @@ fn run_loop(iotask_ch: Chan) unsafe { // set up the special async handle we'll use to allow multi-task // communication with this loop let async = ll::async_t(); - let async_handle = addr_of(async); + let async_handle = addr_of(&async); // associate the async handle with the loop ll::async_init(loop_ptr, async_handle, wake_up_cb); @@ -106,7 +106,7 @@ fn run_loop(iotask_ch: Chan) unsafe { async_handle: async_handle, msg_po: Port() }; - ll::set_data_for_uv_handle(async_handle, addr_of(data)); + ll::set_data_for_uv_handle(async_handle, addr_of(&data)); // Send out a handle through which folks can talk to us // while we dwell in the I/O loop @@ -188,14 +188,14 @@ mod test { }; fn impl_uv_iotask_async(iotask: IoTask) unsafe { let async_handle = ll::async_t(); - let ah_ptr = ptr::addr_of(async_handle); + let ah_ptr = ptr::addr_of(&async_handle); let exit_po = core::comm::Port::<()>(); let exit_ch = core::comm::Chan(exit_po); let ah_data = { iotask: iotask, exit_ch: exit_ch }; - let ah_data_ptr = ptr::addr_of(ah_data); + let ah_data_ptr = ptr::addr_of(&ah_data); do interact(iotask) |loop_ptr| unsafe { ll::async_init(loop_ptr, ah_ptr, async_handle_cb); ll::set_data_for_uv_handle(ah_ptr, ah_data_ptr as *libc::c_void); diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index 6d212cd7e92..fca34c01bc1 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -796,7 +796,7 @@ unsafe fn async_send(async_handle: *uv_async_t) { } unsafe fn buf_init(input: *u8, len: uint) -> uv_buf_t { let out_buf = { base: ptr::null(), len: 0 as libc::size_t }; - let out_buf_ptr = ptr::addr_of(out_buf); + let out_buf_ptr = ptr::addr_of(&out_buf); log(debug, fmt!("buf_init - input %u len %u out_buf: %u", input as uint, len as uint, @@ -968,7 +968,7 @@ unsafe fn free_base_of_buf(buf: uv_buf_t) { unsafe fn get_last_err_info(uv_loop: *libc::c_void) -> ~str { let err = last_error(uv_loop); - let err_ptr = ptr::addr_of(err); + let err_ptr = ptr::addr_of(&err); let err_name = str::raw::from_c_str(err_name(err_ptr)); let err_msg = str::raw::from_c_str(strerror(err_ptr)); return fmt!("LIBUV ERROR: name: %s msg: %s", @@ -977,7 +977,7 @@ unsafe fn get_last_err_info(uv_loop: *libc::c_void) -> ~str { unsafe fn get_last_err_data(uv_loop: *libc::c_void) -> uv_err_data { let err = last_error(uv_loop); - let err_ptr = ptr::addr_of(err); + let err_ptr = ptr::addr_of(&err); let err_name = str::raw::from_c_str(err_name(err_ptr)); let err_msg = str::raw::from_c_str(strerror(err_ptr)); { err_name: err_name, err_msg: err_msg } @@ -1120,9 +1120,9 @@ mod test { client_chan: *comm::Chan<~str>) unsafe { let test_loop = loop_new(); let tcp_handle = tcp_t(); - let tcp_handle_ptr = ptr::addr_of(tcp_handle); + let tcp_handle_ptr = ptr::addr_of(&tcp_handle); let connect_handle = connect_t(); - let connect_req_ptr = ptr::addr_of(connect_handle); + let connect_req_ptr = ptr::addr_of(&connect_handle); // this is the persistent payload of data that we // need to pass around to get this example to work. @@ -1138,12 +1138,12 @@ mod test { // this is the enclosing record, we'll pass a ptr to // this to C.. let write_handle = write_t(); - let write_handle_ptr = ptr::addr_of(write_handle); + let write_handle_ptr = ptr::addr_of(&write_handle); log(debug, fmt!("tcp req: tcp stream: %d write_handle: %d", tcp_handle_ptr as int, write_handle_ptr as int)); let client_data = { writer_handle: write_handle_ptr, - req_buf: ptr::addr_of(req_msg), + req_buf: ptr::addr_of(&req_msg), read_chan: client_chan }; let tcp_init_result = tcp_init( @@ -1154,7 +1154,7 @@ mod test { log(debug, ~"building addr..."); let addr = ip4_addr(ip, port); // FIXME ref #2064 - let addr_ptr = ptr::addr_of(addr); + let addr_ptr = ptr::addr_of(&addr); log(debug, fmt!("after build addr in rust. port: %u", addr.sin_port as uint)); @@ -1169,10 +1169,10 @@ mod test { // until its initialized set_data_for_req( connect_req_ptr as *libc::c_void, - ptr::addr_of(client_data) as *libc::c_void); + ptr::addr_of(&client_data) as *libc::c_void); set_data_for_uv_handle( tcp_handle_ptr as *libc::c_void, - ptr::addr_of(client_data) as *libc::c_void); + ptr::addr_of(&client_data) as *libc::c_void); log(debug, ~"before run tcp req loop"); run(test_loop); log(debug, ~"after run tcp req loop"); @@ -1369,13 +1369,13 @@ mod test { continue_chan: *comm::Chan) unsafe { let test_loop = loop_new(); let tcp_server = tcp_t(); - let tcp_server_ptr = ptr::addr_of(tcp_server); + let tcp_server_ptr = ptr::addr_of(&tcp_server); let tcp_client = tcp_t(); - let tcp_client_ptr = ptr::addr_of(tcp_client); + let tcp_client_ptr = ptr::addr_of(&tcp_client); let server_write_req = write_t(); - let server_write_req_ptr = ptr::addr_of(server_write_req); + let server_write_req_ptr = ptr::addr_of(&server_write_req); let resp_str_bytes = str::to_bytes(server_resp_msg); let resp_msg_ptr: *u8 = vec::raw::to_ptr(resp_str_bytes); @@ -1386,20 +1386,20 @@ mod test { let continue_async_handle = async_t(); let continue_async_handle_ptr = - ptr::addr_of(continue_async_handle); + ptr::addr_of(&continue_async_handle); let async_data = { continue_chan: continue_chan }; - let async_data_ptr = ptr::addr_of(async_data); + let async_data_ptr = ptr::addr_of(&async_data); let server_data: tcp_server_data = { client: tcp_client_ptr, server: tcp_server_ptr, server_kill_msg: kill_server_msg, - server_resp_buf: ptr::addr_of(resp_msg), + server_resp_buf: ptr::addr_of(&resp_msg), server_chan: server_chan, server_write_req: server_write_req_ptr }; - let server_data_ptr = ptr::addr_of(server_data); + let server_data_ptr = ptr::addr_of(&server_data); set_data_for_uv_handle(tcp_server_ptr as *libc::c_void, server_data_ptr as *libc::c_void); @@ -1409,7 +1409,7 @@ mod test { if (tcp_init_result == 0i32) { let server_addr = ip4_addr(server_ip, server_port); // FIXME ref #2064 - let server_addr_ptr = ptr::addr_of(server_addr); + let server_addr_ptr = ptr::addr_of(&server_addr); // uv_tcp_bind() let bind_result = tcp_bind(tcp_server_ptr, @@ -1478,13 +1478,13 @@ mod test { let continue_port = core::comm::Port::(); let continue_chan = core::comm::Chan::(continue_port); - let continue_chan_ptr = ptr::addr_of(continue_chan); + let continue_chan_ptr = ptr::addr_of(&continue_chan); - do task::spawn_sched(task::ManualThreads(1u)) { + do task::spawn_sched(task::ManualThreads(1)) { impl_uv_tcp_server(bind_ip, port, kill_server_msg, server_resp_msg, - ptr::addr_of(server_chan), + ptr::addr_of(&server_chan), continue_chan_ptr); }; @@ -1496,7 +1496,7 @@ mod test { do task::spawn_sched(task::ManualThreads(1u)) { impl_uv_tcp_request(request_ip, port, kill_server_msg, - ptr::addr_of(client_chan)); + ptr::addr_of(&client_chan)); }; let msg_from_client = core::comm::recv(server_port); diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 3e62d0b3ab7..67841158ce1 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1094,10 +1094,10 @@ enum ty_ { // since we only care about this for normalizing them to "real" types. impl ty : cmp::Eq { pure fn eq(other: &ty) -> bool { - ptr::addr_of(self) == ptr::addr_of((*other)) + ptr::addr_of(&self) == ptr::addr_of(&(*other)) } pure fn ne(other: &ty) -> bool { - ptr::addr_of(self) != ptr::addr_of((*other)) + ptr::addr_of(&self) != ptr::addr_of(&(*other)) } } diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 619511f0454..ea493eab561 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -188,7 +188,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, return make_conv_call(cx, arg.span, ~"float", cnv, arg); } TyPoly => return make_conv_call(cx, arg.span, ~"poly", cnv, - mk_addr_of(cx, sp, arg)) + mk_addr_of(cx, sp, arg)) } } fn log_conv(c: Conv) { diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index cec2972b2a7..9c10d228a23 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -71,10 +71,10 @@ impl message: gen_send { body += ~"let b = pipe.reuse_buffer();\n"; body += fmt!("let %s = pipes::SendPacketBuffered(\ - ptr::p2::addr_of(&(b.buffer.data.%s)));\n", + ptr::addr_of(&(b.buffer.data.%s)));\n", sp, next.name); body += fmt!("let %s = pipes::RecvPacketBuffered(\ - ptr::p2::addr_of(&(b.buffer.data.%s)));\n", + ptr::addr_of(&(b.buffer.data.%s)));\n", rp, next.name); } else { @@ -351,7 +351,7 @@ impl protocol: gen_init { fmt!("data.%s.set_buffer_(buffer)", s.name))), ext_cx.parse_expr( - fmt!("ptr::p2::addr_of(&(data.%s))", + fmt!("ptr::addr_of(&(data.%s))", self.states[0].name)))); #ast {{ diff --git a/src/rustc/middle/lang_items.rs b/src/rustc/middle/lang_items.rs index ea22e3a7809..7cb2c9eb9cf 100644 --- a/src/rustc/middle/lang_items.rs +++ b/src/rustc/middle/lang_items.rs @@ -179,7 +179,7 @@ impl LanguageItemCollector { } fn collect_local_language_items() { - let this = unsafe { ptr::addr_of(self) }; + let this = unsafe { ptr::addr_of(&self) }; visit_crate(*self.crate, (), mk_simple_visitor(@{ visit_item: |item| { for item.attrs.each |attribute| { diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index 90762c5b714..69b325b03a4 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -416,7 +416,7 @@ fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, let fn_maps = @IrMaps(self.tcx, self.method_map, self.last_use_map); - debug!("creating fn_maps: %x", ptr::addr_of(*fn_maps) as uint); + debug!("creating fn_maps: %x", ptr::addr_of(&(*fn_maps)) as uint); for decl.inputs.each |arg| { debug!("adding argument %d", arg.id); diff --git a/src/rustc/middle/trans/build.rs b/src/rustc/middle/trans/build.rs index 070132b4b18..69de8a2cca3 100644 --- a/src/rustc/middle/trans/build.rs +++ b/src/rustc/middle/trans/build.rs @@ -134,7 +134,7 @@ fn IndirectBr(cx: block, Addr: ValueRef, NumDests: uint) { // lot more efficient) than doing str::as_c_str("", ...) every time. fn noname() -> *libc::c_char unsafe { const cnull: uint = 0u; - return cast::reinterpret_cast(&ptr::addr_of(cnull)); + return cast::reinterpret_cast(&ptr::addr_of(&cnull)); } fn Invoke(cx: block, Fn: ValueRef, Args: ~[ValueRef], @@ -629,8 +629,8 @@ fn Phi(cx: block, Ty: TypeRef, vals: ~[ValueRef], bbs: ~[BasicBlockRef]) fn AddIncomingToPhi(phi: ValueRef, val: ValueRef, bb: BasicBlockRef) { if llvm::LLVMIsUndef(phi) == lib::llvm::True { return; } unsafe { - let valptr = cast::reinterpret_cast(&ptr::addr_of(val)); - let bbptr = cast::reinterpret_cast(&ptr::addr_of(bb)); + let valptr = cast::reinterpret_cast(&ptr::addr_of(&val)); + let bbptr = cast::reinterpret_cast(&ptr::addr_of(&bb)); llvm::LLVMAddIncoming(phi, valptr, bbptr, 1 as c_uint); } } diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 907146be4fd..d68bdb08221 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -645,7 +645,7 @@ impl block { fmt!("[block %d]", node_info.id) } None => { - fmt!("[block %x]", ptr::addr_of(*self) as uint) + fmt!("[block %x]", ptr::addr_of(&(*self)) as uint) } } } diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index 41acc2ce070..368b69cafab 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -605,7 +605,7 @@ impl @fn_ctxt: region_scope { } impl @fn_ctxt { - fn tag() -> ~str { fmt!("%x", ptr::addr_of(*self) as uint) } + fn tag() -> ~str { fmt!("%x", ptr::addr_of(&(*self)) as uint) } fn expr_to_str(expr: @ast::expr) -> ~str { fmt!("expr(%?:%s)", expr.id, diff --git a/src/test/auxiliary/test_comm.rs b/src/test/auxiliary/test_comm.rs index b150b58c638..77f107fda09 100644 --- a/src/test/auxiliary/test_comm.rs +++ b/src/test/auxiliary/test_comm.rs @@ -34,7 +34,7 @@ struct port_ptr { debug!("in the port_ptr destructor"); do task::unkillable { let yield = 0u; - let yieldp = ptr::addr_of(yield); + let yieldp = ptr::addr_of(&yield); rustrt::rust_port_begin_detach(self.po, yieldp); if yield != 0u { task::yield(); @@ -66,10 +66,10 @@ fn recv(p: port) -> T { recv_((**p).po) } /// Receive on a raw port pointer fn recv_(p: *rust_port) -> T { let yield = 0u; - let yieldp = ptr::addr_of(yield); + let yieldp = ptr::addr_of(&yield); let mut res; res = rusti::init::(); - rustrt::port_recv(ptr::addr_of(res) as *uint, p, yieldp); + rustrt::port_recv(ptr::addr_of(&res) as *uint, p, yieldp); if yield != 0u { // Data isn't available yet, so res has not been initialized. diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 392f67d6714..0a55e7572db 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -19,7 +19,7 @@ use io::WriterUtil; use pipes::{Port, Chan, SharedChan}; macro_rules! move_out ( - { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } } + { $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); y } } ) enum request { diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 6ba8b71d8c4..ab67a8c7cb1 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -15,7 +15,7 @@ use io::WriterUtil; use pipes::{Port, PortSet, Chan}; macro_rules! move_out ( - { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } } + { $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); y } } ) enum request { diff --git a/src/test/bench/msgsend-ring-pipes.rs b/src/test/bench/msgsend-ring-pipes.rs index 3c888fd0c8d..119c2065d6b 100644 --- a/src/test/bench/msgsend-ring-pipes.rs +++ b/src/test/bench/msgsend-ring-pipes.rs @@ -24,7 +24,7 @@ proto! ring ( fn macros() { #macro[ [#move_out[x], - unsafe { let y <- *ptr::addr_of(x); y }] + unsafe { let y <- *ptr::addr_of(&x); y }] ]; } diff --git a/src/test/bench/pingpong.rs b/src/test/bench/pingpong.rs index 570ec8c0b6b..70f98934e1b 100644 --- a/src/test/bench/pingpong.rs +++ b/src/test/bench/pingpong.rs @@ -33,7 +33,7 @@ proto! pingpong_unbounded ( // This stuff should go in libcore::pipes macro_rules! move_it ( - { $x:expr } => { let t <- *ptr::addr_of($x); t } + { $x:expr } => { let t <- *ptr::addr_of(&($x)); t } ) macro_rules! follow ( diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index 3add41792f3..62612366524 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -32,7 +32,7 @@ use cmp::Eq; use to_bytes::IterBytes; macro_rules! move_out ( - { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } } + { $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); y } } ) trait word_reader { diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 0cc828132c9..cfcb158a990 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -103,8 +103,8 @@ fn test_class() { unsafe { error!("q = %x, r = %x", - (cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(q))), - (cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(r)))); + (cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))), + (cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r)))); } assert(q == r); r.y = 17; diff --git a/src/test/run-pass/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck-borrow-from-expr-block.rs index ec31225f46b..d180fc4b8ae 100644 --- a/src/test/run-pass/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck-borrow-from-expr-block.rs @@ -7,7 +7,7 @@ fn borrow(x: &int, f: fn(x: &int)) { fn test1(x: @~int) { // Right now, at least, this induces a copy of the unique pointer: do borrow({*x}) |p| { - let x_a = ptr::addr_of(**x); + let x_a = ptr::addr_of(&(**x)); assert (x_a as uint) != to_uint(p); assert unsafe{*x_a} == *p; } diff --git a/src/test/run-pass/borrowck-preserve-box-in-discr.rs b/src/test/run-pass/borrowck-preserve-box-in-discr.rs index 373830d77af..5ed78488b35 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-discr.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-discr.rs @@ -5,13 +5,13 @@ fn main() { match *x { {f: b_x} => { assert *b_x == 3; - assert ptr::addr_of(*x.f) == ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x)); x = @{f: ~4}; - debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(*b_x) as uint); + debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint); assert *b_x == 3; - assert ptr::addr_of(*x.f) != ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) != ptr::addr_of(&(*b_x)); } } } \ No newline at end of file diff --git a/src/test/run-pass/borrowck-preserve-box-in-field.rs b/src/test/run-pass/borrowck-preserve-box-in-field.rs index 7ab2dc4b99d..d7d3aa68faf 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-field.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-field.rs @@ -11,11 +11,11 @@ fn main() { let mut x = @{f: ~3}; do borrow(x.f) |b_x| { assert *b_x == 3; - assert ptr::addr_of(*x.f) == ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x)); x = @{f: ~4}; - debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(*b_x) as uint); + debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint); assert *b_x == 3; - assert ptr::addr_of(*x.f) != ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) != ptr::addr_of(&(*b_x)); } } \ No newline at end of file diff --git a/src/test/run-pass/borrowck-preserve-box-in-pat.rs b/src/test/run-pass/borrowck-preserve-box-in-pat.rs index 599879f82f1..f0944ea3544 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-pat.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-pat.rs @@ -5,13 +5,13 @@ fn main() { match x { @@{f: b_x} => { assert *b_x == 3; - assert ptr::addr_of(x.f) == ptr::addr_of(b_x); + assert ptr::addr_of(&(x.f)) == ptr::addr_of(&(b_x)); *x = @{f: ~4}; - debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(*b_x) as uint); + debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint); assert *b_x == 3; - assert ptr::addr_of(*x.f) != ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) != ptr::addr_of(&(*b_x)); } } } diff --git a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs index bd43ad65cff..b0bb4d8d40c 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-uniq.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-uniq.rs @@ -11,11 +11,11 @@ fn main() { let mut x = ~mut @{f: ~3}; do borrow(x.f) |b_x| { assert *b_x == 3; - assert ptr::addr_of(*x.f) == ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x)); *x = @{f: ~4}; - debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(*b_x) as uint); + debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint); assert *b_x == 3; - assert ptr::addr_of(*x.f) != ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) != ptr::addr_of(&(*b_x)); } } \ No newline at end of file diff --git a/src/test/run-pass/borrowck-preserve-box.rs b/src/test/run-pass/borrowck-preserve-box.rs index 8d59975204b..88f4b459d36 100644 --- a/src/test/run-pass/borrowck-preserve-box.rs +++ b/src/test/run-pass/borrowck-preserve-box.rs @@ -11,11 +11,11 @@ fn main() { let mut x = @3; do borrow(x) |b_x| { assert *b_x == 3; - assert ptr::addr_of(*x) == ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x)) == ptr::addr_of(&(*b_x)); x = @22; - debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(*b_x) as uint); + debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint); assert *b_x == 3; - assert ptr::addr_of(*x) != ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x)) != ptr::addr_of(&(*b_x)); } } \ No newline at end of file diff --git a/src/test/run-pass/borrowck-preserve-expl-deref.rs b/src/test/run-pass/borrowck-preserve-expl-deref.rs index e126ecc4340..ba525eafc51 100644 --- a/src/test/run-pass/borrowck-preserve-expl-deref.rs +++ b/src/test/run-pass/borrowck-preserve-expl-deref.rs @@ -11,11 +11,11 @@ fn main() { let mut x = @{f: ~3}; do borrow((*x).f) |b_x| { assert *b_x == 3; - assert ptr::addr_of(*x.f) == ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x)); x = @{f: ~4}; - debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(*b_x) as uint); + debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint); assert *b_x == 3; - assert ptr::addr_of(*x.f) != ptr::addr_of(*b_x); + assert ptr::addr_of(&(*x.f)) != ptr::addr_of(&(*b_x)); } } diff --git a/src/test/run-pass/cap-clause-move.rs b/src/test/run-pass/cap-clause-move.rs index 260c1d45b76..0561af6ca6d 100644 --- a/src/test/run-pass/cap-clause-move.rs +++ b/src/test/run-pass/cap-clause-move.rs @@ -1,29 +1,29 @@ fn main() { let x = ~1; - let y = ptr::addr_of(*x) as uint; - let lam_copy = fn@(copy x) -> uint { ptr::addr_of(*x) as uint }; - let lam_move = fn@(move x) -> uint { ptr::addr_of(*x) as uint }; + let y = ptr::addr_of(&(*x)) as uint; + let lam_copy = fn@(copy x) -> uint { ptr::addr_of(&(*x)) as uint }; + let lam_move = fn@(move x) -> uint { ptr::addr_of(&(*x)) as uint }; assert lam_copy() != y; assert lam_move() == y; let x = ~2; - let y = ptr::addr_of(*x) as uint; - let lam_copy: fn@() -> uint = |copy x| ptr::addr_of(*x) as uint; - let lam_move: fn@() -> uint = |move x| ptr::addr_of(*x) as uint; + let y = ptr::addr_of(&(*x)) as uint; + let lam_copy: fn@() -> uint = |copy x| ptr::addr_of(&(*x)) as uint; + let lam_move: fn@() -> uint = |move x| ptr::addr_of(&(*x)) as uint; assert lam_copy() != y; assert lam_move() == y; let x = ~3; - let y = ptr::addr_of(*x) as uint; - let snd_copy = fn~(copy x) -> uint { ptr::addr_of(*x) as uint }; - let snd_move = fn~(move x) -> uint { ptr::addr_of(*x) as uint }; + let y = ptr::addr_of(&(*x)) as uint; + let snd_copy = fn~(copy x) -> uint { ptr::addr_of(&(*x)) as uint }; + let snd_move = fn~(move x) -> uint { ptr::addr_of(&(*x)) as uint }; assert snd_copy() != y; assert snd_move() == y; let x = ~4; - let y = ptr::addr_of(*x) as uint; - let lam_copy: fn~() -> uint = |copy x| ptr::addr_of(*x) as uint; - let lam_move: fn~() -> uint = |move x| ptr::addr_of(*x) as uint; + let y = ptr::addr_of(&(*x)) as uint; + let lam_copy: fn~() -> uint = |copy x| ptr::addr_of(&(*x)) as uint; + let lam_move: fn~() -> uint = |move x| ptr::addr_of(&(*x)) as uint; assert lam_copy() != y; assert lam_move() == y; } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 6da4349ba5f..b887b86cf2f 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -201,7 +201,7 @@ mod pingpong { fn liberate_ping(-p: ping) -> pipes::send_packet unsafe { let addr : *pipes::send_packet = match p { - ping(x) => { cast::transmute(ptr::addr_of(x)) } + ping(x) => { cast::transmute(ptr::addr_of(&x)) } }; let liberated_value <- *addr; cast::forget(p); @@ -210,7 +210,7 @@ mod pingpong { fn liberate_pong(-p: pong) -> pipes::send_packet unsafe { let addr : *pipes::send_packet = match p { - pong(x) => { cast::transmute(ptr::addr_of(x)) } + pong(x) => { cast::transmute(ptr::addr_of(&x)) } }; let liberated_value <- *addr; cast::forget(p); diff --git a/src/test/run-pass/last-use-corner-cases.rs b/src/test/run-pass/last-use-corner-cases.rs index 2d8e3aa7b8c..a3088a2c125 100644 --- a/src/test/run-pass/last-use-corner-cases.rs +++ b/src/test/run-pass/last-use-corner-cases.rs @@ -4,14 +4,14 @@ fn main() { // Make sure closing over can be a last use let q = ~10; - let addr = ptr::addr_of(*q); - let f = fn@() -> *int { ptr::addr_of(*q) }; + let addr = ptr::addr_of(&(*q)); + let f = fn@() -> *int { ptr::addr_of(&(*q)) }; assert addr == f(); // But only when it really is the last use let q = ~20; - let f = fn@() -> *int { ptr::addr_of(*q) }; - assert ptr::addr_of(*q) != f(); + let f = fn@() -> *int { ptr::addr_of(&(*q)) }; + assert ptr::addr_of(&(*q)) != f(); // Ensure function arguments and box arguments interact sanely. fn call_me(x: fn() -> int, y: ~int) { assert x() == *y; } diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index 8ac76293284..899b74b2866 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -33,7 +33,7 @@ proto! bank ( ) macro_rules! move_it ( - { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } } + { $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); y } } ) fn switch(+endp: pipes::RecvPacket, diff --git a/src/test/run-pass/pipe-pingpong-bounded.rs b/src/test/run-pass/pipe-pingpong-bounded.rs index f9f091131ab..9bfbbe338e7 100644 --- a/src/test/run-pass/pipe-pingpong-bounded.rs +++ b/src/test/run-pass/pipe-pingpong-bounded.rs @@ -28,7 +28,7 @@ mod pingpong { do pipes::entangle_buffer(buffer) |buffer, data| { data.ping.set_buffer_(buffer); data.pong.set_buffer_(buffer); - ptr::addr_of(data.ping) + ptr::addr_of(&(data.ping)) } } enum ping = server::pong; @@ -38,8 +38,8 @@ mod pingpong { fn ping(+pipe: ping) -> pong { { let b = pipe.reuse_buffer(); - let s = SendPacketBuffered(ptr::addr_of(b.buffer.data.pong)); - let c = RecvPacketBuffered(ptr::addr_of(b.buffer.data.pong)); + let s = SendPacketBuffered(ptr::addr_of(&(b.buffer.data.pong))); + let c = RecvPacketBuffered(ptr::addr_of(&(b.buffer.data.pong))); let message = pingpong::ping(s); pipes::send(pipe, message); c @@ -57,8 +57,8 @@ mod pingpong { fn pong(+pipe: pong) -> ping { { let b = pipe.reuse_buffer(); - let s = SendPacketBuffered(ptr::addr_of(b.buffer.data.ping)); - let c = RecvPacketBuffered(ptr::addr_of(b.buffer.data.ping)); + let s = SendPacketBuffered(ptr::addr_of(&(b.buffer.data.ping))); + let c = RecvPacketBuffered(ptr::addr_of(&(b.buffer.data.ping))); let message = pingpong::pong(s); pipes::send(pipe, message); c diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index affd0ef6162..e27aaa618ac 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -612,7 +612,7 @@ fn get_tydesc_for(&&_t: T) -> *TyDesc { fn main() { let r = (1,2,3,true,false,{x:5,y:4,z:3}); - let p = ptr::addr_of(r) as *c_void; + let p = ptr::addr_of(&r) as *c_void; let u = my_visitor(@{mut ptr1: p, mut ptr2: p, mut vals: ~[]}); diff --git a/src/test/run-pass/resource-cycle.rs b/src/test/run-pass/resource-cycle.rs index 9e0a2c35e2f..26e19ee1b0c 100644 --- a/src/test/run-pass/resource-cycle.rs +++ b/src/test/run-pass/resource-cycle.rs @@ -4,8 +4,8 @@ struct r { v: *int, drop unsafe { debug!("r's dtor: self = %x, self.v = %x, self.v's value = %x", - cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(self)), - cast::reinterpret_cast::<**int, uint>(&ptr::addr_of(self.v)), + cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&self)), + cast::reinterpret_cast::<**int, uint>(&ptr::addr_of(&(self.v))), cast::reinterpret_cast::<*int, uint>(&self.v)); let v2: ~int = cast::reinterpret_cast(&self.v); } } @@ -34,27 +34,27 @@ fn main() unsafe { r: { let rs = r(i1p); debug!("r = %x", - cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(rs))); + cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&rs))); rs } }); debug!("x1 = %x, x1.r = %x", cast::reinterpret_cast::<@t, uint>(&x1), - cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(x1.r))); + cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&(x1.r)))); let x2 = @t({ mut next: None, r: { let rs = r(i2p); debug!("r2 = %x", - cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(rs))); + cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&rs))); rs } }); debug!("x2 = %x, x2.r = %x", cast::reinterpret_cast::<@t, uint>(&x2), - cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(x2.r))); + cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&(x2.r)))); x1.next = Some(x2); x2.next = Some(x1); diff --git a/src/test/run-pass/rt-sched-1.rs b/src/test/run-pass/rt-sched-1.rs index 9604dff64d7..15207b668fe 100644 --- a/src/test/run-pass/rt-sched-1.rs +++ b/src/test/run-pass/rt-sched-1.rs @@ -33,7 +33,7 @@ fn main() unsafe { assert child_sched_id == new_sched_id; comm::send(ch, ()); }; - let fptr = cast::reinterpret_cast(&ptr::addr_of(f)); + let fptr = cast::reinterpret_cast(&ptr::addr_of(&f)); rustrt::start_task(new_task_id, fptr); cast::forget(f); comm::recv(po); diff --git a/src/test/run-pass/select-macro.rs b/src/test/run-pass/select-macro.rs index 15dd56e46c5..78bddffcc1d 100644 --- a/src/test/run-pass/select-macro.rs +++ b/src/test/run-pass/select-macro.rs @@ -28,7 +28,7 @@ macro_rules! select_if ( match move pipes::try_recv($port) { $(Some($message($($(ref $x,)+)* ref next)) => { // FIXME (#2329) we really want move out of enum here. - let $next = unsafe { let x <- *ptr::addr_of(*next); x }; + let $next = unsafe { let x <- *ptr::addr_of(&(*next)); x }; $e })+ _ => fail diff --git a/src/test/run-pass/stable-addr-of.rs b/src/test/run-pass/stable-addr-of.rs index 060994ed48f..dceb80331b4 100644 --- a/src/test/run-pass/stable-addr-of.rs +++ b/src/test/run-pass/stable-addr-of.rs @@ -2,5 +2,5 @@ fn main() { let foo = 1; - assert ptr::addr_of(foo) == ptr::addr_of(foo); + assert ptr::addr_of(&foo) == ptr::addr_of(&foo); } diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index 98d5193c86d..405ba82b790 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -10,7 +10,7 @@ struct notify { drop { error!("notify: task=%? v=%x unwinding=%b b=%b", task::get_task(), - ptr::addr_of(*(self.v)) as uint, + ptr::addr_of(&(*(self.v))) as uint, task::failing(), *(self.v)); let b = *(self.v); @@ -30,7 +30,7 @@ fn joinable(+f: fn~()) -> comm::Port { let b = @mut false; error!("wrapper: task=%? allocated v=%x", task::get_task(), - ptr::addr_of(*b) as uint); + ptr::addr_of(&(*b)) as uint); let _r = notify(c, b); f(); *b = true; diff --git a/src/test/run-pass/task-spawn-move-and-copy.rs b/src/test/run-pass/task-spawn-move-and-copy.rs index 9cedfea6130..7316a927751 100644 --- a/src/test/run-pass/task-spawn-move-and-copy.rs +++ b/src/test/run-pass/task-spawn-move-and-copy.rs @@ -3,16 +3,16 @@ fn main() { let ch = comm::Chan(p); let x = ~1; - let x_in_parent = ptr::addr_of(*x) as uint; + let x_in_parent = ptr::addr_of(&(*x)) as uint; let y = ~2; - let y_in_parent = ptr::addr_of(*y) as uint; + let y_in_parent = ptr::addr_of(&(*y)) as uint; task::spawn(fn~(copy ch, copy y, move x) { - let x_in_child = ptr::addr_of(*x) as uint; + let x_in_child = ptr::addr_of(&(*x)) as uint; comm::send(ch, x_in_child); - let y_in_child = ptr::addr_of(*y) as uint; + let y_in_child = ptr::addr_of(&(*y)) as uint; comm::send(ch, y_in_child); }); // Ensure last-use analysis doesn't move y to child. diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs index 18c3db591f6..592d49cc2a8 100644 --- a/src/test/run-pass/uniq-cc-generic.rs +++ b/src/test/run-pass/uniq-cc-generic.rs @@ -9,7 +9,7 @@ type pointy = { }; fn make_uniq_closure(a: A) -> fn~() -> uint { - fn~() -> uint { ptr::addr_of(a) as uint } + fn~() -> uint { ptr::addr_of(&a) as uint } } fn empty_pointy() -> @pointy { -- cgit 1.4.1-3-g733a5 From f33539e446d6f41d4a3296ed50a8f968e7950483 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 3 Oct 2012 12:21:48 -0700 Subject: Remove uses of + mode from libstd More or less the same as my analogous commit for libcore. Had to remove the forbid(deprecated_modes) pragma from some files -- will restore it after the snapshot. --- src/libstd/arc.rs | 22 +++++++++--------- src/libstd/bitv.rs | 4 ++-- src/libstd/cell.rs | 6 ++--- src/libstd/dbg.rs | 8 +++---- src/libstd/deque.rs | 14 ++++++------ src/libstd/getopts.rs | 25 ++++++++++---------- src/libstd/json.rs | 4 ++-- src/libstd/list.rs | 2 +- src/libstd/map.rs | 52 +++++++++++++++++++++--------------------- src/libstd/net_tcp.rs | 14 ++++++------ src/libstd/net_url.rs | 12 +++++----- src/libstd/rope.rs | 4 ++-- src/libstd/smallintmap.rs | 20 ++++++++-------- src/libstd/std.rc | 3 --- src/libstd/sync.rs | 14 ++++++------ src/libstd/test.rs | 4 ++-- src/libstd/time.rs | 4 ++-- src/libstd/timer.rs | 4 ++-- src/libstd/uv_iotask.rs | 4 ++-- src/libstd/uv_ll.rs | 6 ++--- src/test/bench/graph500-bfs.rs | 2 +- 21 files changed, 113 insertions(+), 115 deletions(-) (limited to 'src/libstd/timer.rs') diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 9d15deab660..60db62ce01a 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap /** * Concurrency-enabled mechanisms for sharing mutable and/or immutable state * between tasks. @@ -66,7 +66,7 @@ impl &Condvar { struct ARC { x: SharedMutableState } /// Create an atomically reference counted wrapper. -pub fn ARC(+data: T) -> ARC { +pub fn ARC(data: T) -> ARC { ARC { x: unsafe { shared_mutable_state(move data) } } } @@ -98,7 +98,7 @@ pub fn clone(rc: &ARC) -> ARC { * unwrap from a task that holds another reference to the same ARC; it is * guaranteed to deadlock. */ -fn unwrap(+rc: ARC) -> T { +fn unwrap(rc: ARC) -> T { let ARC { x: x } <- rc; unsafe { unwrap_shared_mutable_state(move x) } } @@ -113,14 +113,14 @@ struct MutexARCInner { lock: Mutex, failed: bool, data: T } struct MutexARC { x: SharedMutableState> } /// Create a mutex-protected ARC with the supplied data. -pub fn MutexARC(+user_data: T) -> MutexARC { +pub fn MutexARC(user_data: T) -> MutexARC { mutex_arc_with_condvars(move user_data, 1) } /** * Create a mutex-protected ARC with the supplied data and a specified number * of condvars (as sync::mutex_with_condvars). */ -pub fn mutex_arc_with_condvars(+user_data: T, +pub fn mutex_arc_with_condvars(user_data: T, num_condvars: uint) -> MutexARC { let data = MutexARCInner { lock: mutex_with_condvars(num_condvars), @@ -191,7 +191,7 @@ impl &MutexARC { * Will additionally fail if another task has failed while accessing the arc. */ // FIXME(#2585) make this a by-move method on the arc -pub fn unwrap_mutex_arc(+arc: MutexARC) -> T { +pub fn unwrap_mutex_arc(arc: MutexARC) -> T { let MutexARC { x: x } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; let MutexARCInner { failed: failed, data: data, _ } <- inner; @@ -247,14 +247,14 @@ struct RWARC { } /// Create a reader/writer ARC with the supplied data. -pub fn RWARC(+user_data: T) -> RWARC { +pub fn RWARC(user_data: T) -> RWARC { rw_arc_with_condvars(move user_data, 1) } /** * Create a reader/writer ARC with the supplied data and a specified number * of condvars (as sync::rwlock_with_condvars). */ -pub fn rw_arc_with_condvars(+user_data: T, +pub fn rw_arc_with_condvars(user_data: T, num_condvars: uint) -> RWARC { let data = RWARCInner { lock: rwlock_with_condvars(num_condvars), @@ -334,7 +334,7 @@ impl &RWARC { * } * ~~~ */ - fn write_downgrade(blk: fn(+v: RWWriteMode) -> U) -> U { + fn write_downgrade(blk: fn(v: RWWriteMode) -> U) -> U { let state = unsafe { get_shared_mutable_state(&self.x) }; do borrow_rwlock(state).write_downgrade |write_mode| { check_poison(false, state.failed); @@ -344,7 +344,7 @@ impl &RWARC { } /// To be called inside of the write_downgrade block. - fn downgrade(+token: RWWriteMode/&a) -> RWReadMode/&a { + fn downgrade(token: RWWriteMode/&a) -> RWReadMode/&a { // The rwlock should assert that the token belongs to us for us. let state = unsafe { get_shared_immutable_state(&self.x) }; let RWWriteMode((data, t, _poison)) <- token; @@ -369,7 +369,7 @@ impl &RWARC { * in write mode. */ // FIXME(#2585) make this a by-move method on the arc -pub fn unwrap_rw_arc(+arc: RWARC) -> T { +pub fn unwrap_rw_arc(arc: RWARC) -> T { let RWARC { x: x, _ } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; let RWARCInner { failed: failed, data: data, _ } <- inner; diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index bb556ed2ca3..77f0d39c338 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -1,4 +1,4 @@ -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap use vec::{to_mut, from_elem}; @@ -95,7 +95,7 @@ struct BigBitv { mut storage: ~[mut uint] } -fn BigBitv(+storage: ~[mut uint]) -> BigBitv { +fn BigBitv(storage: ~[mut uint]) -> BigBitv { BigBitv {storage: storage} } diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index 43e47e1e1a9..866dbce1c08 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -1,4 +1,4 @@ -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap /// A dynamic, mutable location. /// /// Similar to a mutable option type, but friendlier. @@ -8,7 +8,7 @@ pub struct Cell { } /// Creates a new full cell with the given value. -pub fn Cell(+value: T) -> Cell { +pub fn Cell(value: T) -> Cell { Cell { value: Some(move value) } } @@ -29,7 +29,7 @@ impl Cell { } /// Returns the value, failing if the cell is full. - fn put_back(+value: T) { + fn put_back(value: T) { if !self.is_empty() { fail ~"attempt to put a value back into a full cell"; } diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index df97df51643..f85d4655ad1 100644 --- a/src/libstd/dbg.rs +++ b/src/libstd/dbg.rs @@ -1,4 +1,4 @@ -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap //! Unsafe debugging functions for inspecting values. use cast::reinterpret_cast; @@ -20,7 +20,7 @@ pub fn debug_tydesc() { rustrt::debug_tydesc(sys::get_type_desc::()); } -pub fn debug_opaque(+x: T) { +pub fn debug_opaque(x: T) { rustrt::debug_opaque(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } @@ -28,11 +28,11 @@ pub fn debug_box(x: @T) { rustrt::debug_box(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } -pub fn debug_tag(+x: T) { +pub fn debug_tag(x: T) { rustrt::debug_tag(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } -pub fn debug_fn(+x: T) { +pub fn debug_fn(x: T) { rustrt::debug_fn(sys::get_type_desc::(), ptr::addr_of(&x) as *()); } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index da05174a6f5..f4fbc11c4f7 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -1,5 +1,5 @@ //! A deque. Untested as of yet. Likely buggy -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap #[forbid(non_camel_case_types)]; use option::{Some, None}; @@ -8,8 +8,8 @@ use core::cmp::{Eq}; pub trait Deque { fn size() -> uint; - fn add_front(+v: T); - fn add_back(+v: T); + fn add_front(v: T); + fn add_back(v: T); fn pop_front() -> T; fn pop_back() -> T; fn peek_front() -> T; @@ -27,7 +27,7 @@ pub fn create() -> Deque { * Grow is only called on full elts, so nelts is also len(elts), unlike * elsewhere. */ - fn grow(nelts: uint, lo: uint, +elts: ~[Cell]) + fn grow(nelts: uint, lo: uint, elts: ~[Cell]) -> ~[Cell] { let mut elts = move elts; assert (nelts == vec::len(elts)); @@ -55,7 +55,7 @@ pub fn create() -> Deque { impl Repr: Deque { fn size() -> uint { return self.nelts; } - fn add_front(+t: T) { + fn add_front(t: T) { let oldlo: uint = self.lo; if self.lo == 0u { self.lo = self.elts.len() - 1u; @@ -68,7 +68,7 @@ pub fn create() -> Deque { self.elts.set_elt(self.lo, Some(t)); self.nelts += 1u; } - fn add_back(+t: T) { + fn add_back(t: T) { if self.lo == self.hi && self.nelts != 0u { self.elts.swap(|v| grow(self.nelts, self.lo, move v)); self.lo = 0u; @@ -200,7 +200,7 @@ mod tests { assert (deq.get(3) == d); } - fn test_parameterized(+a: T, +b: T, +c: T, +d: T) { + fn test_parameterized(a: T, +b: T, +c: T, +d: T) { let deq: deque::Deque = deque::create::(); assert (deq.size() == 0u); deq.add_front(a); diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 9d127f5db47..8fd775c4773 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -62,7 +62,7 @@ * } */ -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap use core::cmp::Eq; use core::result::{Err, Ok}; @@ -179,7 +179,7 @@ pub enum Fail_ { } /// Convert a `fail_` enum into an error string -pub fn fail_str(+f: Fail_) -> ~str { +pub fn fail_str(f: Fail_) -> ~str { return match f { ArgumentMissing(ref nm) => { ~"Argument to option '" + *nm + ~"' missing." @@ -335,7 +335,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result unsafe { free: free}); } -fn opt_vals(+mm: Matches, nm: &str) -> ~[Optval] { +fn opt_vals(mm: Matches, nm: &str) -> ~[Optval] { return match find_opt(mm.opts, mkname(nm)) { Some(id) => mm.vals[id], None => { @@ -345,15 +345,15 @@ fn opt_vals(+mm: Matches, nm: &str) -> ~[Optval] { }; } -fn opt_val(+mm: Matches, nm: &str) -> Optval { return opt_vals(mm, nm)[0]; } +fn opt_val(mm: Matches, nm: &str) -> Optval { return opt_vals(mm, nm)[0]; } /// Returns true if an option was matched -pub fn opt_present(+mm: Matches, nm: &str) -> bool { +pub fn opt_present(mm: Matches, nm: &str) -> bool { return vec::len::(opt_vals(mm, nm)) > 0u; } /// Returns true if any of several options were matched -pub fn opts_present(+mm: Matches, names: &[~str]) -> bool { +pub fn opts_present(mm: Matches, names: &[~str]) -> bool { for vec::each(names) |nm| { match find_opt(mm.opts, mkname(*nm)) { Some(_) => return true, @@ -370,7 +370,7 @@ pub fn opts_present(+mm: Matches, names: &[~str]) -> bool { * Fails if the option was not matched or if the match did not take an * argument */ -pub fn opt_str(+mm: Matches, nm: &str) -> ~str { +pub fn opt_str(mm: Matches, nm: &str) -> ~str { return match opt_val(mm, nm) { Val(copy s) => s, _ => fail }; } @@ -380,7 +380,8 @@ pub fn opt_str(+mm: Matches, nm: &str) -> ~str { * Fails if the no option was provided from the given list, or if the no such * option took an argument */ -pub fn opts_str(+mm: Matches, names: &[~str]) -> ~str { +pub fn opts_str(mm: Matches, names: &[~str]) -> ~str { +>>>>>>> Remove uses of + mode from libstd for vec::each(names) |nm| { match opt_val(mm, *nm) { Val(copy s) => return s, @@ -397,7 +398,7 @@ pub fn opts_str(+mm: Matches, names: &[~str]) -> ~str { * * Used when an option accepts multiple values. */ -pub fn opt_strs(+mm: Matches, nm: &str) -> ~[~str] { +pub fn opt_strs(mm: Matches, nm: &str) -> ~[~str] { let mut acc: ~[~str] = ~[]; for vec::each(opt_vals(mm, nm)) |v| { match *v { Val(copy s) => acc.push(s), _ => () } @@ -406,7 +407,7 @@ pub fn opt_strs(+mm: Matches, nm: &str) -> ~[~str] { } /// Returns the string argument supplied to a matching option or none -pub fn opt_maybe_str(+mm: Matches, nm: &str) -> Option<~str> { +pub fn opt_maybe_str(mm: Matches, nm: &str) -> Option<~str> { let vals = opt_vals(mm, nm); if vec::len::(vals) == 0u { return None::<~str>; } return match vals[0] { @@ -423,7 +424,7 @@ pub fn opt_maybe_str(+mm: Matches, nm: &str) -> Option<~str> { * present but no argument was provided, and the argument if the option was * present and an argument was provided. */ -pub fn opt_default(+mm: Matches, nm: &str, def: &str) -> Option<~str> { +pub fn opt_default(mm: Matches, nm: &str, def: &str) -> Option<~str> { let vals = opt_vals(mm, nm); if vec::len::(vals) == 0u { return None::<~str>; } return match vals[0] { Val(copy s) => Some::<~str>(s), @@ -451,7 +452,7 @@ mod tests { use opt = getopts; use result::{Err, Ok}; - fn check_fail_type(+f: Fail_, ft: FailType) { + fn check_fail_type(f: Fail_, ft: FailType) { match f { ArgumentMissing(_) => assert ft == ArgumentMissing_, UnrecognizedOption(_) => assert ft == UnrecognizedOption_, diff --git a/src/libstd/json.rs b/src/libstd/json.rs index d3713bdb29d..f244f2869a6 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -1,6 +1,6 @@ // Rust JSON serialization library // Copyright (c) 2011 Google Inc. -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap #[forbid(non_camel_case_types)]; //! json serialization @@ -370,7 +370,7 @@ priv impl Parser { self.ch } - fn error(+msg: ~str) -> Result { + fn error(msg: ~str) -> Result { Err(Error { line: self.line, col: self.col, msg: @msg }) } diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 5b0931ebdee..4ff493f5ab9 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -29,7 +29,7 @@ pub fn from_vec(v: &[T]) -> @List { * * z - The initial value * * f - The function to apply */ -pub fn foldl(+z: T, ls: @List, f: fn((&T), (&U)) -> T) -> T { +pub fn foldl(z: T, ls: @List, f: fn((&T), (&U)) -> T) -> T { let mut accum: T = z; do iter(ls) |elt| { accum = f(&accum, elt);} accum diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 84fee092562..cc42c562376 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -1,6 +1,6 @@ //! A map type -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap use io::WriterUtil; use to_str::ToStr; @@ -28,10 +28,10 @@ pub trait Map { * * Returns true if the key did not already exist in the map */ - fn insert(+v: K, +v: V) -> bool; + fn insert(v: K, +v: V) -> bool; /// Returns true if the map contains a value for the specified key - fn contains_key(+key: K) -> bool; + fn contains_key(key: K) -> bool; /// Returns true if the map contains a value for the specified /// key, taking the key by reference. @@ -41,31 +41,31 @@ pub trait Map { * Get the value for the specified key. Fails if the key does not exist in * the map. */ - fn get(+key: K) -> V; + fn get(key: K) -> V; /** * Get the value for the specified key. If the key does not exist in * the map then returns none. */ - pure fn find(+key: K) -> Option; + pure fn find(key: K) -> Option; /** * Remove and return a value from the map. Returns true if the * key was present in the map, otherwise false. */ - fn remove(+key: K) -> bool; + fn remove(key: K) -> bool; /// Clear the map, removing all key/value pairs. fn clear(); /// Iterate over all the key/value pairs in the map by value - pure fn each(fn(+key: K, +value: V) -> bool); + pure fn each(fn(key: K, +value: V) -> bool); /// Iterate over all the keys in the map by value - pure fn each_key(fn(+key: K) -> bool); + pure fn each_key(fn(key: K) -> bool); /// Iterate over all the values in the map by value - pure fn each_value(fn(+value: V) -> bool); + pure fn each_value(fn(value: V) -> bool); /// Iterate over all the key/value pairs in the map by reference pure fn each_ref(fn(key: &K, value: &V) -> bool); @@ -201,7 +201,7 @@ pub mod chained { impl T: Map { pure fn size() -> uint { self.count } - fn contains_key(+k: K) -> bool { + fn contains_key(k: K) -> bool { self.contains_key_ref(&k) } @@ -213,7 +213,7 @@ pub mod chained { } } - fn insert(+k: K, +v: V) -> bool { + fn insert(k: K, +v: V) -> bool { let hash = k.hash_keyed(0,0) as uint; match self.search_tbl(&k, hash) { NotFound => { @@ -255,7 +255,7 @@ pub mod chained { } } - pure fn find(+k: K) -> Option { + pure fn find(k: K) -> Option { unsafe { match self.search_tbl(&k, k.hash_keyed(0,0) as uint) { NotFound => None, @@ -265,7 +265,7 @@ pub mod chained { } } - fn get(+k: K) -> V { + fn get(k: K) -> V { let opt_v = self.find(k); if opt_v.is_none() { fail fmt!("Key not found in table: %?", k); @@ -273,7 +273,7 @@ pub mod chained { option::unwrap(move opt_v) } - fn remove(+k: K) -> bool { + fn remove(k: K) -> bool { match self.search_tbl(&k, k.hash_keyed(0,0) as uint) { NotFound => false, FoundFirst(idx, entry) => { @@ -294,15 +294,15 @@ pub mod chained { self.chains = chains(initial_capacity); } - pure fn each(blk: fn(+key: K, +value: V) -> bool) { + pure fn each(blk: fn(key: K, +value: V) -> bool) { self.each_ref(|k, v| blk(*k, *v)) } - pure fn each_key(blk: fn(+key: K) -> bool) { + pure fn each_key(blk: fn(key: K) -> bool) { self.each_key_ref(|p| blk(*p)) } - pure fn each_value(blk: fn(+value: V) -> bool) { + pure fn each_value(blk: fn(value: V) -> bool) { self.each_value_ref(|p| blk(*p)) } @@ -377,7 +377,7 @@ pub fn HashMap() } /// Convenience function for adding keys to a hashmap with nil type keys -pub fn set_add(set: Set, +key: K) -> bool { +pub fn set_add(set: Set, key: K) -> bool { set.insert(key, ()) } @@ -415,13 +415,13 @@ impl @Mut>: } } - fn insert(+key: K, +value: V) -> bool { + fn insert(key: K, value: V) -> bool { do self.borrow_mut |p| { p.insert(key, value) } } - fn contains_key(+key: K) -> bool { + fn contains_key(key: K) -> bool { do self.borrow_const |p| { p.contains_key(&key) } @@ -433,13 +433,13 @@ impl @Mut>: } } - fn get(+key: K) -> V { + fn get(key: K) -> V { do self.borrow_const |p| { p.get(&key) } } - pure fn find(+key: K) -> Option { + pure fn find(key: K) -> Option { unsafe { do self.borrow_const |p| { p.find(&key) @@ -447,7 +447,7 @@ impl @Mut>: } } - fn remove(+key: K) -> bool { + fn remove(key: K) -> bool { do self.borrow_mut |p| { p.remove(&key) } @@ -459,7 +459,7 @@ impl @Mut>: } } - pure fn each(op: fn(+key: K, +value: V) -> bool) { + pure fn each(op: fn(key: K, +value: V) -> bool) { unsafe { do self.borrow_imm |p| { p.each(|k, v| op(*k, *v)) @@ -467,7 +467,7 @@ impl @Mut>: } } - pure fn each_key(op: fn(+key: K) -> bool) { + pure fn each_key(op: fn(key: K) -> bool) { unsafe { do self.borrow_imm |p| { p.each_key(|k| op(*k)) @@ -475,7 +475,7 @@ impl @Mut>: } } - pure fn each_value(op: fn(+value: V) -> bool) { + pure fn each_value(op: fn(value: V) -> bool) { unsafe { do self.borrow_imm |p| { p.each_value(|v| op(*v)) diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 59cb0d36f77..be38f16aff7 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -129,7 +129,7 @@ enum TcpConnectErrData { * the remote host. In the event of failure, a * `net::tcp::tcp_connect_err_data` instance will be returned */ -fn connect(+input_ip: ip::IpAddr, port: uint, +fn connect(input_ip: ip::IpAddr, port: uint, iotask: IoTask) -> result::Result unsafe { let result_po = core::comm::Port::(); @@ -570,7 +570,7 @@ fn accept(new_conn: TcpNewConnection) * successful/normal shutdown, and a `tcp_listen_err_data` enum in the event * of listen exiting because of an error */ -fn listen(+host_ip: ip::IpAddr, port: uint, backlog: uint, +fn listen(host_ip: ip::IpAddr, port: uint, backlog: uint, iotask: IoTask, +on_establish_cb: fn~(comm::Chan>), +new_connect_cb: fn~(TcpNewConnection, @@ -587,7 +587,7 @@ fn listen(+host_ip: ip::IpAddr, port: uint, backlog: uint, } } -fn listen_common(+host_ip: ip::IpAddr, port: uint, backlog: uint, +fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint, iotask: IoTask, +on_establish_cb: fn~(comm::Chan>), +on_connect_cb: fn~(*uv::ll::uv_tcp_t)) @@ -728,7 +728,7 @@ fn listen_common(+host_ip: ip::IpAddr, port: uint, backlog: uint, * * A buffered wrapper that you can cast as an `io::reader` or `io::writer` */ -fn socket_buf(+sock: TcpSocket) -> TcpSocketBuf { +fn socket_buf(sock: TcpSocket) -> TcpSocketBuf { TcpSocketBuf(@{ sock: move sock, mut buf: ~[] }) } @@ -738,7 +738,7 @@ impl TcpSocket { result::Result<~[u8], TcpErrData>>, TcpErrData> { read_start(&self) } - fn read_stop(+read_port: + fn read_stop(read_port: comm::Port>) -> result::Result<(), TcpErrData> { read_stop(&self, move read_port) @@ -1476,7 +1476,7 @@ mod test { */ } - fn buf_write(+w: &W, val: &str) { + fn buf_write(w: &W, val: &str) { log(debug, fmt!("BUF_WRITE: val len %?", str::len(val))); do str::byte_slice(val) |b_slice| { log(debug, fmt!("BUF_WRITE: b_slice len %?", @@ -1485,7 +1485,7 @@ mod test { } } - fn buf_read(+r: &R, len: uint) -> ~str { + fn buf_read(r: &R, len: uint) -> ~str { let new_bytes = (*r).read_bytes(len); log(debug, fmt!("in buf_read.. new_bytes len: %?", vec::len(new_bytes))); diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 920751d690f..6dca075405b 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -1,5 +1,5 @@ //! Types/fns concerning URLs (see RFC 3986) -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after a snapshot use core::cmp::Eq; use map::HashMap; @@ -36,7 +36,7 @@ type UserInfo = { type Query = ~[(~str, ~str)]; -fn Url(+scheme: ~str, +user: Option, +host: ~str, +fn Url(scheme: ~str, +user: Option, +host: ~str, +port: Option<~str>, +path: ~str, +query: Query, +fragment: Option<~str>) -> Url { Url { scheme: move scheme, user: move user, host: move host, @@ -44,7 +44,7 @@ fn Url(+scheme: ~str, +user: Option, +host: ~str, fragment: move fragment } } -fn UserInfo(+user: ~str, +pass: Option<~str>) -> UserInfo { +fn UserInfo(user: ~str, +pass: Option<~str>) -> UserInfo { {user: move user, pass: move pass} } @@ -306,7 +306,7 @@ fn userinfo_from_str(uinfo: &str) -> UserInfo { return UserInfo(user, pass); } -fn userinfo_to_str(+userinfo: UserInfo) -> ~str { +fn userinfo_to_str(userinfo: UserInfo) -> ~str { if option::is_some(&userinfo.pass) { return str::concat(~[copy userinfo.user, ~":", option::unwrap(copy userinfo.pass), @@ -334,7 +334,7 @@ fn query_from_str(rawquery: &str) -> Query { return query; } -fn query_to_str(+query: Query) -> ~str { +fn query_to_str(query: Query) -> ~str { let mut strvec = ~[]; for query.each |kv| { let (k, v) = copy *kv; @@ -681,7 +681,7 @@ impl Url : FromStr { * result in just "http://somehost.com". * */ -fn to_str(+url: Url) -> ~str { +fn to_str(url: Url) -> ~str { let user = if url.user.is_some() { userinfo_to_str(option::unwrap(copy url.user)) } else { diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index d14a4854555..5df4fc10a03 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -379,7 +379,7 @@ Section: Iterating * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ -pub fn loop_chars(rope: Rope, it: fn(+c: char) -> bool) -> bool { +pub fn loop_chars(rope: Rope, it: fn(c: char) -> bool) -> bool { match (rope) { node::Empty => return true, node::Content(x) => return node::loop_chars(x, it) @@ -1037,7 +1037,7 @@ mod node { return result; } - pub fn loop_chars(node: @Node, it: fn(+c: char) -> bool) -> bool { + pub fn loop_chars(node: @Node, it: fn(c: char) -> bool) -> bool { return loop_leaves(node,|leaf| { str::all_between(*leaf.content, leaf.byte_offset, diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 2e7f47e0af0..58ecbb0d6c3 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -2,7 +2,7 @@ * A simple map based on a vector for small integer keys. Space requirements * are O(highest integer key). */ -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap use core::option; use core::option::{Some, None}; @@ -28,7 +28,7 @@ pub fn mk() -> SmallIntMap { * the specified key then the original value is replaced. */ #[inline(always)] -pub fn insert(self: SmallIntMap, key: uint, +val: T) { +pub fn insert(self: SmallIntMap, key: uint, val: T) { //io::println(fmt!("%?", key)); self.v.grow_set_elt(key, &None, Some(val)); } @@ -77,12 +77,12 @@ impl SmallIntMap: map::Map { sz } #[inline(always)] - fn insert(+key: uint, +value: V) -> bool { + fn insert(key: uint, value: V) -> bool { let exists = contains_key(self, key); insert(self, key, value); return !exists; } - fn remove(+key: uint) -> bool { + fn remove(key: uint) -> bool { if key >= self.v.len() { return false; } @@ -93,23 +93,23 @@ impl SmallIntMap: map::Map { fn clear() { self.v.set(~[]); } - fn contains_key(+key: uint) -> bool { + fn contains_key(key: uint) -> bool { contains_key(self, key) } fn contains_key_ref(key: &uint) -> bool { contains_key(self, *key) } - fn get(+key: uint) -> V { get(self, key) } - pure fn find(+key: uint) -> Option { find(self, key) } + fn get(key: uint) -> V { get(self, key) } + pure fn find(key: uint) -> Option { find(self, key) } fn rehash() { fail } - pure fn each(it: fn(+key: uint, +value: V) -> bool) { + pure fn each(it: fn(key: uint, +value: V) -> bool) { self.each_ref(|k, v| it(*k, *v)) } - pure fn each_key(it: fn(+key: uint) -> bool) { + pure fn each_key(it: fn(key: uint) -> bool) { self.each_ref(|k, _v| it(*k)) } - pure fn each_value(it: fn(+value: V) -> bool) { + pure fn each_value(it: fn(value: V) -> bool) { self.each_ref(|_k, v| it(*v)) } pure fn each_ref(it: fn(key: &uint, value: &V) -> bool) { diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 202cb4932db..683ea589b91 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -18,9 +18,6 @@ not required in or otherwise suitable for the core library. #[no_core]; -// tjc: Added legacy_modes back in because it still uses + mode. -// Remove once + mode gets expunged from std. -#[legacy_modes]; #[legacy_exports]; #[allow(vecs_implicitly_copyable)]; diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index f66f2f5b5d3..f66134d3892 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap /** * The concurrency primitives you know and love. * @@ -69,7 +69,7 @@ struct SemInner { enum Sem = Exclusive>; #[doc(hidden)] -fn new_sem(count: int, +q: Q) -> Sem { +fn new_sem(count: int, q: Q) -> Sem { Sem(exclusive(SemInner { mut count: count, waiters: new_waitqueue(), blocked: q })) } @@ -535,7 +535,7 @@ impl &RWlock { * } * ~~~ */ - fn write_downgrade(blk: fn(+v: RWlockWriteMode) -> U) -> U { + fn write_downgrade(blk: fn(v: RWlockWriteMode) -> U) -> U { // Implementation slightly different from the slicker 'write's above. // The exit path is conditional on whether the caller downgrades. let mut _release = None; @@ -551,7 +551,7 @@ impl &RWlock { } /// To be called inside of the write_downgrade block. - fn downgrade(+token: RWlockWriteMode/&a) -> RWlockReadMode/&a { + fn downgrade(token: RWlockWriteMode/&a) -> RWlockReadMode/&a { if !ptr::ref_eq(self, token.lock) { fail ~"Can't downgrade() with a different rwlock's write_mode!"; } @@ -957,7 +957,7 @@ mod tests { drop { self.c.send(()); } } - fn SendOnFailure(+c: pipes::Chan<()>) -> SendOnFailure { + fn SendOnFailure(c: pipes::Chan<()>) -> SendOnFailure { SendOnFailure { c: c } @@ -1038,7 +1038,7 @@ mod tests { } } #[cfg(test)] - fn test_rwlock_exclusion(+x: ~RWlock, mode1: RWlockMode, + fn test_rwlock_exclusion(x: ~RWlock, mode1: RWlockMode, mode2: RWlockMode) { // Test mutual exclusion between readers and writers. Just like the // mutex mutual exclusion test, a ways above. @@ -1083,7 +1083,7 @@ mod tests { test_rwlock_exclusion(~RWlock(), Downgrade, Downgrade); } #[cfg(test)] - fn test_rwlock_handshake(+x: ~RWlock, mode1: RWlockMode, + fn test_rwlock_handshake(x: ~RWlock, mode1: RWlockMode, mode2: RWlockMode, make_mode2_go_first: bool) { // Much like sem_multi_resource. let x2 = ~x.clone(); diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 1df10a4d799..c5d9dd343fa 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -270,7 +270,7 @@ enum TestEvent { type MonitorMsg = (TestDesc, TestResult); fn run_tests(opts: &TestOpts, tests: &[TestDesc], - callback: fn@(+e: TestEvent)) { + callback: fn@(e: TestEvent)) { let mut filtered_tests = filter_tests(opts, tests); callback(TeFiltered(copy filtered_tests)); @@ -379,7 +379,7 @@ fn filter_tests(opts: &TestOpts, type TestFuture = {test: TestDesc, wait: fn@() -> TestResult}; -fn run_test(+test: TestDesc, monitor_ch: comm::Chan) { +fn run_test(test: TestDesc, monitor_ch: comm::Chan) { if test.ignore { core::comm::send(monitor_ch, (copy test, TrIgnored)); return; diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 43cbc6da9bd..aef3bb2ac0a 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -1,4 +1,4 @@ -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap use core::cmp::Eq; use libc::{c_char, c_int, c_long, size_t, time_t}; @@ -589,7 +589,7 @@ pub fn strptime(s: &str, format: &str) -> Result { } } -fn strftime(format: &str, +tm: Tm) -> ~str { +fn strftime(format: &str, tm: Tm) -> ~str { fn parse_type(ch: char, tm: &Tm) -> ~str { //FIXME (#2350): Implement missing types. let die = || #fmt("strftime: can't understand this format %c ", diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 8aaf7d3fd87..2aca87b942e 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -1,6 +1,6 @@ //! Utilities that leverage libuv's `uv_timer_*` API -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after snap use uv = uv; use uv::iotask; @@ -24,7 +24,7 @@ use comm = core::comm; * * val - a value of type T to send over the provided `ch` */ pub fn delayed_send(iotask: IoTask, - msecs: uint, ch: comm::Chan, +val: T) { + msecs: uint, ch: comm::Chan, val: T) { unsafe { let timer_done_po = core::comm::Port::<()>(); let timer_done_ch = core::comm::Chan(timer_done_po); diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index 876aa6f4af0..4a4a34704be 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -5,7 +5,7 @@ * `interact` function you can execute code in a uv callback. */ -#[forbid(deprecated_mode)]; +// tjc: forbid deprecated modes again after a snapshot use libc::c_void; use ptr::p2::addr_of; @@ -22,7 +22,7 @@ pub enum IoTask { }) } -pub fn spawn_iotask(+task: task::TaskBuilder) -> IoTask { +pub fn spawn_iotask(task: task::TaskBuilder) -> IoTask { do listen |iotask_ch| { diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index f0594475d04..50636054821 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -642,7 +642,7 @@ extern mod rustrt { fn rust_uv_addrinfo_as_sockaddr_in(input: *addrinfo) -> *sockaddr_in; fn rust_uv_addrinfo_as_sockaddr_in6(input: *addrinfo) -> *sockaddr_in6; fn rust_uv_malloc_buf_base_of(sug_size: libc::size_t) -> *u8; - fn rust_uv_free_base_of_buf(++buf: uv_buf_t); + fn rust_uv_free_base_of_buf(+buf: uv_buf_t); fn rust_uv_get_stream_handle_from_connect_req( connect_req: *uv_connect_t) -> *uv_stream_t; @@ -661,8 +661,8 @@ extern mod rustrt { fn rust_uv_get_data_for_req(req: *libc::c_void) -> *libc::c_void; fn rust_uv_set_data_for_req(req: *libc::c_void, data: *libc::c_void); - fn rust_uv_get_base_from_buf(++buf: uv_buf_t) -> *u8; - fn rust_uv_get_len_from_buf(++buf: uv_buf_t) -> libc::size_t; + fn rust_uv_get_base_from_buf(+buf: uv_buf_t) -> *u8; + fn rust_uv_get_len_from_buf(+buf: uv_buf_t) -> libc::size_t; // sizeof testing helpers fn rust_uv_helper_uv_tcp_t_size() -> libc::c_uint; diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index f35a3ce735f..a34fcc89c04 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -251,7 +251,7 @@ fn pbfs(&&graph: arc::ARC, key: node_id) -> bfs_result { colors = do par::mapi_factory(*color_vec) { let colors = arc::clone(&color); let graph = arc::clone(&graph); - fn~(i: uint, c: color) -> color { + fn~(+i: uint, +c: color) -> color { let c : color = c; let colors = arc::get(&colors); let graph = arc::get(&graph); -- cgit 1.4.1-3-g733a5