diff options
| author | Simon BD <simon@server> | 2012-10-06 13:15:18 -0500 |
|---|---|---|
| committer | Simon BD <simon@server> | 2012-10-06 13:15:18 -0500 |
| commit | 0e3bec0ced8d781cdd93996e7b8eeedb13f81ba8 (patch) | |
| tree | 4738dcf131910061f5253ee5ef42960b9aef35f5 /src/libstd | |
| parent | d4a54837d4ab28219727e1f1e0c131ba6033ba94 (diff) | |
| parent | f96a2a2ca16a44f869336f7e28fc261551c1184c (diff) | |
Merge remote-tracking branch 'original/incoming' into incoming
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 2 | ||||
| -rw-r--r-- | src/libstd/arena.rs | 8 | ||||
| -rw-r--r-- | src/libstd/bitv.rs | 4 | ||||
| -rw-r--r-- | src/libstd/c_vec.rs | 3 | ||||
| -rw-r--r-- | src/libstd/cell.rs | 2 | ||||
| -rw-r--r-- | src/libstd/comm.rs | 4 | ||||
| -rw-r--r-- | src/libstd/dbg.rs | 2 | ||||
| -rw-r--r-- | src/libstd/deque.rs | 4 | ||||
| -rw-r--r-- | src/libstd/ebml.rs | 15 | ||||
| -rw-r--r-- | src/libstd/ebml2.rs | 3 | ||||
| -rw-r--r-- | src/libstd/fun_treemap.rs | 6 | ||||
| -rw-r--r-- | src/libstd/getopts.rs | 7 | ||||
| -rw-r--r-- | src/libstd/json.rs | 4 | ||||
| -rw-r--r-- | src/libstd/list.rs | 6 | ||||
| -rw-r--r-- | src/libstd/map.rs | 17 | ||||
| -rw-r--r-- | src/libstd/net_tcp.rs | 52 | ||||
| -rw-r--r-- | src/libstd/net_url.rs | 12 | ||||
| -rw-r--r-- | src/libstd/par.rs | 10 | ||||
| -rw-r--r-- | src/libstd/serialization.rs | 79 | ||||
| -rw-r--r-- | src/libstd/smallintmap.rs | 6 | ||||
| -rw-r--r-- | src/libstd/std.rc | 105 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 6 | ||||
| -rw-r--r-- | src/libstd/test.rs | 12 | ||||
| -rw-r--r-- | src/libstd/time.rs | 23 | ||||
| -rw-r--r-- | src/libstd/timer.rs | 12 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 8 | ||||
| -rw-r--r-- | src/libstd/uv_global_loop.rs | 10 | ||||
| -rw-r--r-- | src/libstd/uv_iotask.rs | 17 | ||||
| -rw-r--r-- | src/libstd/uv_ll.rs | 6 |
29 files changed, 220 insertions, 225 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 60db62ce01a..addabb2ddb9 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; /** * Concurrency-enabled mechanisms for sharing mutable and/or immutable state * between tasks. diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index 4d2b910fa85..6a2ac88f714 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -31,9 +31,10 @@ use libc::size_t; #[abi = "rust-intrinsic"] extern mod rusti { - fn move_val_init<T>(&dst: T, -src: T); + fn move_val_init<T>(dst: &mut T, -src: T); fn needs_drop<T>() -> bool; } + extern mod rustrt { #[rust_stack] fn rust_call_tydesc_glue(root: *u8, tydesc: *TypeDesc, field: size_t); @@ -127,7 +128,6 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) { (reinterpret_cast(&(p & !1)), p & 1 == 1) } -// The duplication between the POD and non-POD functions is annoying. impl &Arena { // Functions for the POD part of the arena fn alloc_pod_grow(n_bytes: uint, align: uint) -> *u8 { @@ -166,7 +166,7 @@ impl &Arena { let tydesc = sys::get_type_desc::<T>(); let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align); let ptr: *mut T = reinterpret_cast(&ptr); - rusti::move_val_init(*ptr, op()); + rusti::move_val_init(&mut (*ptr), op()); return reinterpret_cast(&ptr); } } @@ -217,7 +217,7 @@ impl &Arena { // has *not* been initialized yet. *ty_ptr = reinterpret_cast(&tydesc); // Actually initialize it - rusti::move_val_init(*ptr, op()); + rusti::move_val_init(&mut(*ptr), op()); // Now that we are done, update the tydesc to indicate that // the object is there. *ty_ptr = bitpack_tydesc_ptr(tydesc, true); diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 77f0d39c338..91af4a3d653 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -1,4 +1,4 @@ -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; use vec::{to_mut, from_elem}; @@ -553,7 +553,7 @@ pure fn land(w0: uint, w1: uint) -> uint { return w0 & w1; } pure fn right(_w0: uint, w1: uint) -> uint { return w1; } impl Bitv: ops::Index<uint,bool> { - pure fn index(+i: uint) -> bool { + pure fn index(i: uint) -> bool { self.get(i) } } diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 1ff5b63ee12..06d56ed1ae5 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -25,6 +25,7 @@ * great care must be taken to ensure that a reference to the c_vec::t is * still held if needed. */ +#[forbid(deprecated_mode)]; /** * The type representing a foreign chunk of memory @@ -111,7 +112,7 @@ pub fn get<T: Copy>(t: CVec<T>, ofs: uint) -> T { * * Fails if `ofs` is greater or equal to the length of the vector */ -pub fn set<T: Copy>(t: CVec<T>, ofs: uint, +v: T) { +pub fn set<T: Copy>(t: CVec<T>, ofs: uint, v: T) { assert ofs < len(t); unsafe { *ptr::mut_offset((*t).base, ofs) = v }; } diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index 866dbce1c08..c888957728a 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -1,4 +1,4 @@ -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; /// A dynamic, mutable location. /// /// Similar to a mutable option type, but friendlier. diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 4d87ebeac99..1a897a2c2fa 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -16,11 +16,11 @@ pub struct DuplexStream<T: Send, U: Send> { } impl<T: Send, U: Send> DuplexStream<T, U> : Channel<T> { - fn send(+x: T) { + fn send(x: T) { self.chan.send(move x) } - fn try_send(+x: T) -> bool { + fn try_send(x: T) -> bool { self.chan.try_send(move x) } } diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index f85d4655ad1..f141a028e65 100644 --- a/src/libstd/dbg.rs +++ b/src/libstd/dbg.rs @@ -1,4 +1,4 @@ -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; //! Unsafe debugging functions for inspecting values. use cast::reinterpret_cast; diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index f4fbc11c4f7..37798d9a627 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -1,5 +1,5 @@ //! A deque. Untested as of yet. Likely buggy -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; #[forbid(non_camel_case_types)]; use option::{Some, None}; @@ -200,7 +200,7 @@ mod tests { assert (deq.get(3) == d); } - fn test_parameterized<T: Copy Eq Owned>(a: T, +b: T, +c: T, +d: T) { + fn test_parameterized<T: Copy Eq Owned>(a: T, b: T, c: T, d: T) { let deq: deque::Deque<T> = deque::create::<T>(); assert (deq.size() == 0u); deq.add_front(a); diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 238e9d77a77..3df5a70a0c1 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -1,3 +1,4 @@ +#[forbid(deprecated_mode)]; // Simple Extensible Binary Markup Language (ebml) reader and writer on a // cursor model. See the specification here: // http://www.matroska.org/technical/specs/rfc/index.html @@ -17,7 +18,7 @@ pub type Doc = {data: @~[u8], start: uint, end: uint}; type TaggedDoc = {tag: uint, doc: Doc}; impl Doc: ops::Index<uint,Doc> { - pure fn index(+tag: uint) -> Doc { + pure fn index(tag: uint) -> Doc { unsafe { get_doc(self, tag) } @@ -563,11 +564,11 @@ impl EbmlDeserializer: serialization::Deserializer { #[test] fn test_option_int() { - fn serialize_1<S: serialization::Serializer>(&&s: S, v: int) { + fn serialize_1<S: serialization::Serializer>(s: &S, v: int) { s.emit_i64(v as i64); } - fn serialize_0<S: serialization::Serializer>(&&s: S, v: Option<int>) { + fn serialize_0<S: serialization::Serializer>(s: &S, v: Option<int>) { do s.emit_enum(~"core::option::t") { match v { None => s.emit_enum_variant( @@ -581,11 +582,11 @@ fn test_option_int() { } } - fn deserialize_1<S: serialization::Deserializer>(&&s: S) -> int { + fn deserialize_1<S: serialization::Deserializer>(s: &S) -> int { s.read_i64() as int } - fn deserialize_0<S: serialization::Deserializer>(&&s: S) -> Option<int> { + fn deserialize_0<S: serialization::Deserializer>(s: &S) -> Option<int> { do s.read_enum(~"core::option::t") { do s.read_enum_variant |i| { match i { @@ -608,11 +609,11 @@ fn test_option_int() { debug!("v == %?", v); let bytes = do io::with_bytes_writer |wr| { let ebml_w = ebml::Writer(wr); - serialize_0(ebml_w, v); + serialize_0(&ebml_w, v); }; let ebml_doc = ebml::Doc(@bytes); let deser = ebml_deserializer(ebml_doc); - let v1 = deserialize_0(deser); + let v1 = deserialize_0(&deser); debug!("v1 == %?", v1); assert v == v1; } diff --git a/src/libstd/ebml2.rs b/src/libstd/ebml2.rs index 30d68da06f5..f88aad1ac63 100644 --- a/src/libstd/ebml2.rs +++ b/src/libstd/ebml2.rs @@ -1,3 +1,4 @@ +#[forbid(deprecated_mode)]; use serialization2; // Simple Extensible Binary Markup Language (ebml) reader and writer on a @@ -31,7 +32,7 @@ struct TaggedDoc { } impl Doc: ops::Index<uint,Doc> { - pure fn index(+tag: uint) -> Doc { + pure fn index(tag: uint) -> Doc { unsafe { get_doc(self, tag) } diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 2973c8cc9f7..a1e29b03b45 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -1,4 +1,4 @@ -#[warn(deprecated_mode)]; +#[forbid(deprecated_mode)]; /*! * A functional key,value store that works on anything. @@ -26,7 +26,7 @@ enum TreeNode<K, V> { pub fn init<K, V>() -> Treemap<K, V> { @Empty } /// Insert a value into the map -pub fn insert<K: Copy Eq Ord, V: Copy>(m: Treemap<K, V>, +k: K, +v: V) +pub fn insert<K: Copy Eq Ord, V: Copy>(m: Treemap<K, V>, k: K, v: V) -> Treemap<K, V> { @match m { @Empty => Node(@k, @v, @Empty, @Empty), @@ -41,7 +41,7 @@ pub fn insert<K: Copy Eq Ord, V: Copy>(m: Treemap<K, V>, +k: K, +v: V) } /// Find a value based on the key -pub fn find<K: Eq Ord, V: Copy>(m: Treemap<K, V>, +k: K) -> Option<V> { +pub fn find<K: Eq Ord, V: Copy>(m: Treemap<K, V>, k: K) -> Option<V> { match *m { Empty => None, Node(@ref kk, @copy v, left, right) => { diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 771eaaeca7f..6da51571e34 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -61,8 +61,7 @@ * do_work(input, output); * } */ - -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; use core::cmp::Eq; use core::result::{Err, Ok}; @@ -162,7 +161,7 @@ fn name_str(nm: &Name) -> ~str { }; } -fn find_opt(opts: &[Opt], +nm: Name) -> Option<uint> { +fn find_opt(opts: &[Opt], nm: Name) -> Option<uint> { vec::position(opts, |opt| opt.name == nm) } @@ -214,7 +213,7 @@ pub type Result = result::Result<Matches, Fail_>; */ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result unsafe { let n_opts = vec::len::<Opt>(opts); - fn f(+_x: uint) -> ~[Optval] { return ~[]; } + fn f(_x: uint) -> ~[Optval] { return ~[]; } let vals = vec::to_mut(vec::from_fn(n_opts, f)); let mut free: ~[~str] = ~[]; let l = vec::len(args); diff --git a/src/libstd/json.rs b/src/libstd/json.rs index f244f2869a6..09d00216209 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -1,6 +1,6 @@ // Rust JSON serialization library // Copyright (c) 2011 Google Inc. -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; #[forbid(non_camel_case_types)]; //! json serialization @@ -399,7 +399,7 @@ priv impl Parser { while char::is_whitespace(self.ch) { self.bump(); } } - fn parse_ident(ident: &str, +value: Json) -> Result<Json, Error> { + fn parse_ident(ident: &str, value: Json) -> Result<Json, Error> { if str::all(ident, |c| c == self.next_char()) { self.bump(); Ok(move value) diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 4ff493f5ab9..396edb54885 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -1,5 +1,5 @@ //! A standard linked list -#[warn(deprecated_mode)]; +#[forbid(deprecated_mode)]; use core::cmp::Eq; use core::option; @@ -56,7 +56,7 @@ pub fn find<T: Copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> { } /// Returns true if a list contains an element with the given value -pub fn has<T: Copy Eq>(ls: @List<T>, +elt: T) -> bool { +pub fn has<T: Copy Eq>(ls: @List<T>, elt: T) -> bool { for each(ls) |e| { if *e == elt { return true; } } @@ -114,7 +114,7 @@ pub pure fn append<T: Copy>(l: @List<T>, m: @List<T>) -> @List<T> { /* /// Push one element into the front of a list, returning a new list /// THIS VERSION DOESN'T ACTUALLY WORK -pure fn push<T: Copy>(ll: &mut @list<T>, +vv: T) { +pure fn push<T: Copy>(ll: &mut @list<T>, vv: T) { ll = &mut @cons(vv, *ll) } */ diff --git a/src/libstd/map.rs b/src/libstd/map.rs index cc42c562376..765d40339d3 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -1,6 +1,5 @@ //! A map type - -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; use io::WriterUtil; use to_str::ToStr; @@ -28,7 +27,7 @@ pub trait Map<K:Eq IterBytes Hash Copy, V: Copy> { * * 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; @@ -59,7 +58,7 @@ pub trait Map<K:Eq IterBytes Hash Copy, V: Copy> { 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); @@ -213,7 +212,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 => { @@ -294,7 +293,7 @@ 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)) } @@ -348,7 +347,7 @@ pub mod chained { } impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: ops::Index<K, V> { - pure fn index(+k: K) -> V { + pure fn index(k: K) -> V { unsafe { self.get(k) } @@ -382,7 +381,7 @@ pub fn set_add<K:Eq IterBytes Hash Const Copy>(set: Set<K>, key: K) -> bool { } /// Convert a set into a vector. -pub fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] { +pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] { do vec::build_sized(s.size()) |push| { for s.each_key() |k| { push(k); @@ -459,7 +458,7 @@ impl<K: Eq IterBytes Hash Copy, V: Copy> @Mut<LinearMap<K, V>>: } } - 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)) diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 546231da633..249551fbb7d 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -1,4 +1,6 @@ //! High-level interface to libuv's TCP functionality +// XXX Need FFI fixes +#[allow(deprecated_mode)]; use ip = net_ip; use uv::iotask; @@ -121,8 +123,8 @@ pub fn connect(input_ip: ip::IpAddr, port: uint, let result_po = core::comm::Port::<ConnAttempt>(); let closed_signal_po = core::comm::Port::<()>(); let conn_data = { - result_ch: core::comm::Chan(result_po), - closed_signal_ch: core::comm::Chan(closed_signal_po) + 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 reader_po = core::comm::Port::<result::Result<~[u8], TcpErrData>>(); @@ -130,7 +132,7 @@ pub fn connect(input_ip: ip::IpAddr, port: uint, *(stream_handle_ptr as *mut uv::ll::uv_tcp_t) = uv::ll::tcp_t(); let socket_data = @{ reader_po: reader_po, - reader_ch: core::comm::Chan(reader_po), + reader_ch: core::comm::Chan(&reader_po), stream_handle_ptr: stream_handle_ptr, connect_req: uv::ll::connect_t(), write_req: uv::ll::write_t(), @@ -324,7 +326,7 @@ pub fn read_start(sock: &TcpSocket) * * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on */ pub fn read_stop(sock: &TcpSocket, - +read_port: comm::Port<result::Result<~[u8], TcpErrData>>) -> + read_port: comm::Port<result::Result<~[u8], TcpErrData>>) -> 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)); @@ -471,7 +473,7 @@ pub fn accept(new_conn: TcpNewConnection) *(stream_handle_ptr as *mut uv::ll::uv_tcp_t) = uv::ll::tcp_t(); let client_socket_data = @{ reader_po: reader_po, - reader_ch: core::comm::Chan(reader_po), + reader_ch: core::comm::Chan(&reader_po), stream_handle_ptr : stream_handle_ptr, connect_req : uv::ll::connect_t(), write_req : uv::ll::write_t(), @@ -482,7 +484,7 @@ pub fn accept(new_conn: TcpNewConnection) (*client_socket_data_ptr).stream_handle_ptr; let result_po = core::comm::Port::<Option<TcpErrData>>(); - let result_ch = core::comm::Chan(result_po); + let result_ch = core::comm::Chan(&result_po); // UNSAFE LIBUV INTERACTION BEGIN // .. normally this happens within the context of @@ -558,8 +560,8 @@ pub fn accept(new_conn: TcpNewConnection) */ pub fn listen(host_ip: ip::IpAddr, port: uint, backlog: uint, iotask: IoTask, - +on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>), - +new_connect_cb: fn~(TcpNewConnection, + on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>), + new_connect_cb: fn~(TcpNewConnection, comm::Chan<Option<TcpErrData>>)) -> result::Result<(), TcpListenErrData> unsafe { do listen_common(move host_ip, port, backlog, iotask, on_establish_cb) @@ -575,17 +577,17 @@ pub fn listen(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<Option<TcpErrData>>), - +on_connect_cb: fn~(*uv::ll::uv_tcp_t)) + on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>), + on_connect_cb: fn~(*uv::ll::uv_tcp_t)) -> result::Result<(), TcpListenErrData> unsafe { let stream_closed_po = core::comm::Port::<()>(); let kill_po = core::comm::Port::<Option<TcpErrData>>(); - let kill_ch = core::comm::Chan(kill_po); + 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_data = { server_stream_ptr: server_stream_ptr, - stream_closed_ch: core::comm::Chan(stream_closed_po), + stream_closed_ch: core::comm::Chan(&stream_closed_po), kill_ch: kill_ch, on_connect_cb: move on_connect_cb, iotask: iotask, @@ -749,7 +751,7 @@ impl TcpSocket { /// Implementation of `io::reader` trait for a buffered `net::tcp::tcp_socket` impl TcpSocketBuf: io::Reader { - fn read(buf: &[mut u8], +len: uint) -> uint { + fn read(buf: &[mut u8], len: uint) -> uint { // Loop until our buffer has enough data in it for us to read from. while self.data.buf.len() < len { let read_result = read(&self.data.sock, 0u); @@ -785,13 +787,13 @@ impl TcpSocketBuf: io::Reader { let mut bytes = ~[0]; if self.read(bytes, 1u) == 0 { fail } else { bytes[0] as int } } - fn unread_byte(+amt: int) { + fn unread_byte(amt: int) { self.data.buf.unshift(amt as u8); } fn eof() -> bool { false // noop } - fn seek(+dist: int, +seek: io::SeekStyle) { + fn seek(dist: int, seek: io::SeekStyle) { log(debug, fmt!("tcp_socket_buf seek stub %? %?", dist, seek)); // noop } @@ -813,7 +815,7 @@ impl TcpSocketBuf: io::Writer { err_data.err_name, err_data.err_msg)); } } - fn seek(+dist: int, +seek: io::SeekStyle) { + fn seek(dist: int, seek: io::SeekStyle) { log(debug, fmt!("tcp_socket_buf seek stub %? %?", dist, seek)); // noop } @@ -832,7 +834,7 @@ impl TcpSocketBuf: io::Writer { fn tear_down_socket_data(socket_data: @TcpSocketData) unsafe { let closed_po = core::comm::Port::<()>(); - let closed_ch = core::comm::Chan(closed_po); + let closed_ch = core::comm::Chan(&closed_po); let close_data = { closed_ch: closed_ch }; @@ -895,7 +897,7 @@ fn read_stop_common_impl(socket_data: *TcpSocketData) -> result::Result<(), TcpErrData> unsafe { let stream_handle_ptr = (*socket_data).stream_handle_ptr; let stop_po = core::comm::Port::<Option<TcpErrData>>(); - let stop_ch = core::comm::Chan(stop_po); + let stop_ch = core::comm::Chan(&stop_po); do iotask::interact((*socket_data).iotask) |loop_ptr| unsafe { log(debug, ~"in interact cb for tcp::read_stop"); match uv::ll::read_stop(stream_handle_ptr as *uv::ll::uv_stream_t) { @@ -922,7 +924,7 @@ fn read_start_common_impl(socket_data: *TcpSocketData) result::Result<~[u8], TcpErrData>>, TcpErrData> unsafe { let stream_handle_ptr = (*socket_data).stream_handle_ptr; let start_po = core::comm::Port::<Option<uv::ll::uv_err_data>>(); - let start_ch = core::comm::Chan(start_po); + let start_ch = core::comm::Chan(&start_po); log(debug, ~"in tcp::read_start before interact loop"); do iotask::interact((*socket_data).iotask) |loop_ptr| unsafe { log(debug, fmt!("in tcp::read_start interact cb %?", loop_ptr)); @@ -961,7 +963,7 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData, let write_buf_vec_ptr = ptr::addr_of(&write_buf_vec); let result_po = core::comm::Port::<TcpWriteResult>(); let write_data = { - result_ch: core::comm::Chan(result_po) + result_ch: core::comm::Chan(&result_po) }; let write_data_ptr = ptr::addr_of(&write_data); do iotask::interact((*socket_data_ptr).iotask) |loop_ptr| unsafe { @@ -1277,10 +1279,10 @@ mod test { let expected_resp = ~"pong"; let server_result_po = core::comm::Port::<~str>(); - let server_result_ch = core::comm::Chan(server_result_po); + let server_result_ch = core::comm::Chan(&server_result_po); let cont_po = core::comm::Port::<()>(); - let cont_ch = core::comm::Chan(cont_po); + let cont_ch = core::comm::Chan(&cont_po); // server do task::spawn_sched(task::ManualThreads(1u)) { let actual_req = do comm::listen |server_ch| { @@ -1343,10 +1345,10 @@ mod test { let expected_resp = ~"pong"; let server_result_po = core::comm::Port::<~str>(); - let server_result_ch = core::comm::Chan(server_result_po); + let server_result_ch = core::comm::Chan(&server_result_po); let cont_po = core::comm::Port::<()>(); - let cont_ch = core::comm::Chan(cont_po); + let cont_ch = core::comm::Chan(&cont_po); // server do task::spawn_sched(task::ManualThreads(1u)) { let actual_req = do comm::listen |server_ch| { @@ -1474,7 +1476,7 @@ mod test { str::from_bytes(new_bytes) } - fn run_tcp_test_server(server_ip: &str, server_port: uint, +resp: ~str, + fn run_tcp_test_server(server_ip: &str, server_port: uint, resp: ~str, server_ch: comm::Chan<~str>, cont_ch: comm::Chan<()>, iotask: IoTask) -> ~str { diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 40c9f96f5e8..0ab4d89f363 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -1,5 +1,5 @@ //! Types/fns concerning URLs (see RFC 3986) -// tjc: forbid deprecated modes again after a snapshot +#[forbid(deprecated_mode)]; use core::cmp::Eq; use map::HashMap; @@ -27,15 +27,15 @@ type UserInfo = { pub type Query = ~[(~str, ~str)]; -pub fn Url(scheme: ~str, +user: Option<UserInfo>, +host: ~str, - +port: Option<~str>, +path: ~str, +query: Query, - +fragment: Option<~str>) -> Url { +pub fn Url(scheme: ~str, user: Option<UserInfo>, host: ~str, + port: Option<~str>, path: ~str, query: Query, + fragment: Option<~str>) -> Url { Url { scheme: move scheme, user: move user, host: move host, port: move port, path: move path, query: move query, 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} } @@ -726,7 +726,7 @@ impl Url : Eq { } impl Url: IterBytes { - pure fn iter_bytes(+lsb0: bool, f: to_bytes::Cb) { + pure fn iter_bytes(lsb0: bool, f: to_bytes::Cb) { unsafe { self.to_str() }.iter_bytes(lsb0, f) } } diff --git a/src/libstd/par.rs b/src/libstd/par.rs index 65e41dba5d8..e5336b7204d 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -1,3 +1,5 @@ +#[forbid(deprecated_mode)]; + use future_spawn = future::spawn; @@ -72,7 +74,7 @@ fn map_slices<A: Copy Send, B: Copy Send>( } /// A parallel version of map. -pub fn map<A: Copy Send, B: Copy Send>(xs: &[A], +f: fn~((&A)) -> B) -> ~[B] { +pub fn map<A: Copy Send, B: Copy Send>(xs: &[A], f: fn~((&A)) -> B) -> ~[B] { vec::concat(map_slices(xs, || { fn~(_base: uint, slice : &[A], copy f) -> ~[B] { vec::map(slice, |x| f(x)) @@ -82,7 +84,7 @@ pub fn map<A: Copy Send, B: Copy Send>(xs: &[A], +f: fn~((&A)) -> B) -> ~[B] { /// A parallel version of mapi. pub fn mapi<A: Copy Send, B: Copy Send>(xs: &[A], - +f: fn~(uint, (&A)) -> B) -> ~[B] { + f: fn~(uint, (&A)) -> B) -> ~[B] { let slices = map_slices(xs, || { fn~(base: uint, slice : &[A], copy f) -> ~[B] { vec::mapi(slice, |i, x| { @@ -119,7 +121,7 @@ pub fn mapi_factory<A: Copy Send, B: Copy Send>( } /// Returns true if the function holds for all elements in the vector. -pub fn alli<A: Copy Send>(xs: &[A], +f: fn~(uint, (&A)) -> bool) -> bool { +pub fn alli<A: Copy Send>(xs: &[A], f: fn~(uint, (&A)) -> bool) -> bool { do vec::all(map_slices(xs, || { fn~(base: uint, slice : &[A], copy f) -> bool { vec::alli(slice, |i, x| { @@ -130,7 +132,7 @@ pub fn alli<A: Copy Send>(xs: &[A], +f: fn~(uint, (&A)) -> bool) -> bool { } /// Returns true if the function holds for any elements in the vector. -pub fn any<A: Copy Send>(xs: &[A], +f: fn~(&(A)) -> bool) -> bool { +pub fn any<A: Copy Send>(xs: &[A], f: fn~(&(A)) -> bool) -> bool { do vec::any(map_slices(xs, || { fn~(_base : uint, slice: &[A], copy f) -> bool { vec::any(slice, |x| f(x)) diff --git a/src/libstd/serialization.rs b/src/libstd/serialization.rs index e9067bc6404..8ba00e65dec 100644 --- a/src/libstd/serialization.rs +++ b/src/libstd/serialization.rs @@ -1,10 +1,12 @@ //! Support code for serialization. +#[allow(deprecated_mode)]; + /* Core serialization interfaces. */ -trait Serializer { +pub trait Serializer { // Primitive types: fn emit_nil(); fn emit_uint(v: uint); @@ -37,7 +39,7 @@ trait Serializer { fn emit_tup_elt(idx: uint, f: fn()); } -trait Deserializer { +pub trait Deserializer { // Primitive types: fn read_nil() -> (); @@ -81,7 +83,7 @@ trait Deserializer { // // In some cases, these should eventually be coded as traits. -fn emit_from_vec<S: Serializer, T>(&&s: S, &&v: ~[T], f: fn(&&x: T)) { +pub fn emit_from_vec<S: Serializer, T>(&&s: S, &&v: ~[T], f: fn(&&x: T)) { do s.emit_vec(vec::len(v)) { for vec::eachi(v) |i,e| { do s.emit_vec_elt(i) { @@ -91,7 +93,7 @@ fn emit_from_vec<S: Serializer, T>(&&s: S, &&v: ~[T], f: fn(&&x: T)) { } } -fn read_to_vec<D: Deserializer, T: Copy>(&&d: D, f: fn() -> T) -> ~[T] { +pub fn read_to_vec<D: Deserializer, T: Copy>(&&d: D, f: fn() -> T) -> ~[T] { do d.read_vec |len| { do vec::from_fn(len) |i| { d.read_vec_elt(i, || f()) @@ -99,7 +101,7 @@ fn read_to_vec<D: Deserializer, T: Copy>(&&d: D, f: fn() -> T) -> ~[T] { } } -trait SerializerHelpers { +pub trait SerializerHelpers { fn emit_from_vec<T>(&&v: ~[T], f: fn(&&x: T)); } @@ -109,7 +111,7 @@ impl<S: Serializer> S: SerializerHelpers { } } -trait DeserializerHelpers { +pub trait DeserializerHelpers { fn read_to_vec<T: Copy>(f: fn() -> T) -> ~[T]; } @@ -119,127 +121,128 @@ impl<D: Deserializer> D: DeserializerHelpers { } } -fn serialize_uint<S: Serializer>(&&s: S, v: uint) { +pub fn serialize_uint<S: Serializer>(&&s: S, v: uint) { s.emit_uint(v); } -fn deserialize_uint<D: Deserializer>(&&d: D) -> uint { +pub fn deserialize_uint<D: Deserializer>(&&d: D) -> uint { d.read_uint() } -fn serialize_u8<S: Serializer>(&&s: S, v: u8) { +pub fn serialize_u8<S: Serializer>(&&s: S, v: u8) { s.emit_u8(v); } -fn deserialize_u8<D: Deserializer>(&&d: D) -> u8 { +pub fn deserialize_u8<D: Deserializer>(&&d: D) -> u8 { d.read_u8() } -fn serialize_u16<S: Serializer>(&&s: S, v: u16) { +pub fn serialize_u16<S: Serializer>(&&s: S, v: u16) { s.emit_u16(v); } -fn deserialize_u16<D: Deserializer>(&&d: D) -> u16 { +pub fn deserialize_u16<D: Deserializer>(&&d: D) -> u16 { d.read_u16() } -fn serialize_u32<S: Serializer>(&&s: S, v: u32) { +pub fn serialize_u32<S: Serializer>(&&s: S, v: u32) { s.emit_u32(v); } -fn deserialize_u32<D: Deserializer>(&&d: D) -> u32 { +pub fn deserialize_u32<D: Deserializer>(&&d: D) -> u32 { d.read_u32() } -fn serialize_u64<S: Serializer>(&&s: S, v: u64) { +pub fn serialize_u64<S: Serializer>(&&s: S, v: u64) { s.emit_u64(v); } -fn deserialize_u64<D: Deserializer>(&&d: D) -> u64 { +pub fn deserialize_u64<D: Deserializer>(&&d: D) -> u64 { d.read_u64() } -fn serialize_int<S: Serializer>(&&s: S, v: int) { +pub fn serialize_int<S: Serializer>(&&s: S, v: int) { s.emit_int(v); } -fn deserialize_int<D: Deserializer>(&&d: D) -> int { +pub fn deserialize_int<D: Deserializer>(&&d: D) -> int { d.read_int() } -fn serialize_i8<S: Serializer>(&&s: S, v: i8) { +pub fn serialize_i8<S: Serializer>(&&s: S, v: i8) { s.emit_i8(v); } -fn deserialize_i8<D: Deserializer>(&&d: D) -> i8 { +pub fn deserialize_i8<D: Deserializer>(&&d: D) -> i8 { d.read_i8() } -fn serialize_i16<S: Serializer>(&&s: S, v: i16) { +pub fn serialize_i16<S: Serializer>(&&s: S, v: i16) { s.emit_i16(v); } -fn deserialize_i16<D: Deserializer>(&&d: D) -> i16 { +pub fn deserialize_i16<D: Deserializer>(&&d: D) -> i16 { d.read_i16() } -fn serialize_i32<S: Serializer>(&&s: S, v: i32) { +pub fn serialize_i32<S: Serializer>(&&s: S, v: i32) { s.emit_i32(v); } -fn deserialize_i32<D: Deserializer>(&&d: D) -> i32 { +pub fn deserialize_i32<D: Deserializer>(&&d: D) -> i32 { d.read_i32() } -fn serialize_i64<S: Serializer>(&&s: S, v: i64) { +pub fn serialize_i64<S: Serializer>(&&s: S, v: i64) { s.emit_i64(v); } -fn deserialize_i64<D: Deserializer>(&&d: D) -> i64 { +pub fn deserialize_i64<D: Deserializer>(&&d: D) -> i64 { d.read_i64() } -fn serialize_str<S: Serializer>(&&s: S, v: &str) { +pub fn serialize_str<S: Serializer>(&&s: S, v: &str) { s.emit_str(v); } -fn deserialize_str<D: Deserializer>(&&d: D) -> ~str { +pub fn deserialize_str<D: Deserializer>(&&d: D) -> ~str { d.read_str() } -fn serialize_float<S: Serializer>(&&s: S, v: float) { +pub fn serialize_float<S: Serializer>(&&s: S, v: float) { s.emit_float(v); } -fn deserialize_float<D: Deserializer>(&&d: D) -> float { +pub fn deserialize_float<D: Deserializer>(&&d: D) -> float { d.read_float() } -fn serialize_f32<S: Serializer>(&&s: S, v: f32) { +pub fn serialize_f32<S: Serializer>(&&s: S, v: f32) { s.emit_f32(v); } -fn deserialize_f32<D: Deserializer>(&&d: D) -> f32 { +pub fn deserialize_f32<D: Deserializer>(&&d: D) -> f32 { d.read_f32() } -fn serialize_f64<S: Serializer>(&&s: S, v: f64) { +pub fn serialize_f64<S: Serializer>(&&s: S, v: f64) { s.emit_f64(v); } -fn deserialize_f64<D: Deserializer>(&&d: D) -> f64 { +pub fn deserialize_f64<D: Deserializer>(&&d: D) -> f64 { d.read_f64() } -fn serialize_bool<S: Serializer>(&&s: S, v: bool) { +pub fn serialize_bool<S: Serializer>(&&s: S, v: bool) { s.emit_bool(v); } -fn deserialize_bool<D: Deserializer>(&&d: D) -> bool { +pub fn deserialize_bool<D: Deserializer>(&&d: D) -> bool { d.read_bool() } -fn serialize_Option<S: Serializer,T>(&&s: S, &&v: Option<T>, st: fn(&&x: T)) { +pub fn serialize_Option<S: Serializer,T>(&&s: S, &&v: Option<T>, + st: fn(&&x: T)) { do s.emit_enum(~"option") { match v { None => do s.emit_enum_variant(~"none", 0u, 0u) { @@ -254,7 +257,7 @@ fn serialize_Option<S: Serializer,T>(&&s: S, &&v: Option<T>, st: fn(&&x: T)) { } } -fn deserialize_Option<D: Deserializer,T: Copy>(&&d: D, st: fn() -> T) +pub fn deserialize_Option<D: Deserializer,T: Copy>(&&d: D, st: fn() -> T) -> Option<T> { do d.read_enum(~"option") { do d.read_enum_variant |i| { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 58ecbb0d6c3..1582d90ce2d 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). */ -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; use core::option; use core::option::{Some, None}; @@ -103,7 +103,7 @@ impl<V: Copy> SmallIntMap<V>: map::Map<uint, V> { pure fn find(key: uint) -> Option<V> { 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) { @@ -131,7 +131,7 @@ impl<V: Copy> SmallIntMap<V>: map::Map<uint, V> { } impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> { - pure fn index(+key: uint) -> V { + pure fn index(key: uint) -> V { unsafe { get(self, key) } diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 6a5658d24eb..7fc3004bbcf 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -18,86 +18,72 @@ not required in or otherwise suitable for the core library. #[no_core]; -#[legacy_exports]; - #[allow(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; +// XXX this is set to allow because there are two methods in serialization +// that can't be silenced otherwise. Most every module is set to forbid +#[allow(deprecated_mode)]; #[forbid(deprecated_pattern)]; extern mod core(vers = "0.4"); use core::*; -export net, net_tcp, net_ip, net_url; -export uv, uv_ll, uv_iotask, uv_global_loop; -export c_vec, timer; -export sync, arc, comm; -export bitv, deque, fun_treemap, list, map; -export smallintmap, sort, treemap; -export rope, arena, par; -export ebml, ebml2; -export dbg, getopts, json, rand, sha1, term, time; -export prettyprint, prettyprint2; -export test, tempfile, serialization, serialization2; -export cmp; -export base64; -export cell; - // General io and system-services modules -mod net; -mod net_ip; -mod net_tcp; -mod net_url; +pub mod net; +pub mod net_ip; +pub mod net_tcp; +pub mod net_url; // libuv modules -mod uv; -mod uv_ll; -mod uv_iotask; -mod uv_global_loop; +pub mod uv; +pub mod uv_ll; +pub mod uv_iotask; +pub mod uv_global_loop; // Utility modules -mod c_vec; -mod timer; -mod cell; +pub mod c_vec; +pub mod timer; +pub mod cell; // Concurrency -mod sync; -mod arc; -mod comm; +pub mod sync; +pub mod arc; +pub mod comm; // Collections -mod bitv; -mod deque; -mod fun_treemap; -mod list; -mod map; -mod rope; -mod smallintmap; -mod sort; -mod treemap; +pub mod bitv; +pub mod deque; +pub mod fun_treemap; +pub mod list; +pub mod map; +pub mod rope; +pub mod smallintmap; +pub mod sort; +pub mod treemap; // And ... other stuff -mod ebml; -mod ebml2; -mod dbg; -mod getopts; -mod json; -mod sha1; -mod md4; -mod tempfile; -mod term; -mod time; -mod prettyprint; -mod prettyprint2; -mod arena; -mod par; -mod cmp; -mod base64; +pub mod ebml; +pub mod ebml2; +pub mod dbg; +pub mod getopts; +pub mod json; +pub mod sha1; +pub mod md4; +pub mod tempfile; +pub mod term; +pub mod time; +pub mod prettyprint; +pub mod prettyprint2; +pub mod arena; +pub mod par; +pub mod cmp; +pub mod base64; #[cfg(unicode)] mod unicode; @@ -105,10 +91,9 @@ mod unicode; // Compiler support modules -mod test; -#[legacy_exports] -mod serialization; -mod serialization2; +pub mod test; +pub mod serialization; +pub mod serialization2; // Local Variables: // mode: rust; diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index f66134d3892..908f3936f4e 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; /** * The concurrency primitives you know and love. * @@ -773,7 +773,7 @@ mod tests { let m = ~Mutex(); let m2 = ~m.clone(); let mut sharedstate = ~0; - let ptr = ptr::p2::addr_of(&(*sharedstate)); + let ptr = ptr::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::p2::addr_of(&(*sharedstate)); + let ptr = ptr::addr_of(&(*sharedstate)); do task::spawn { let sharedstate: &mut int = unsafe { cast::reinterpret_cast(&ptr) }; diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 5fb7df1f68c..9790622332a 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -5,7 +5,7 @@ // simplest interface possible for representing and running tests // while providing a base that other test frameworks may build off of. -#[warn(deprecated_mode)]; +#[forbid(deprecated_mode)]; use core::cmp::Eq; use either::Either; @@ -286,7 +286,7 @@ fn run_tests(opts: &TestOpts, tests: &[TestDesc], let mut done_idx = 0; let p = core::comm::Port(); - let ch = core::comm::Chan(p); + let ch = core::comm::Chan(&p); while done_idx < total { while wait_idx < concurrency && run_idx < total { @@ -421,7 +421,7 @@ mod tests { should_fail: false }; let p = core::comm::Port(); - let ch = core::comm::Chan(p); + let ch = core::comm::Chan(&p); run_test(desc, ch); let (_, res) = core::comm::recv(p); assert res != TrOk; @@ -437,7 +437,7 @@ mod tests { should_fail: false }; let p = core::comm::Port(); - let ch = core::comm::Chan(p); + let ch = core::comm::Chan(&p); run_test(desc, ch); let (_, res) = core::comm::recv(p); assert res == TrIgnored; @@ -454,7 +454,7 @@ mod tests { should_fail: true }; let p = core::comm::Port(); - let ch = core::comm::Chan(p); + let ch = core::comm::Chan(&p); run_test(desc, ch); let (_, res) = core::comm::recv(p); assert res == TrOk; @@ -470,7 +470,7 @@ mod tests { should_fail: true }; let p = core::comm::Port(); - let ch = core::comm::Chan(p); + let ch = core::comm::Chan(&p); run_test(desc, ch); let (_, res) = core::comm::recv(p); assert res == TrFailed; diff --git a/src/libstd/time.rs b/src/libstd/time.rs index aef3bb2ac0a..65872a013ab 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -1,4 +1,4 @@ -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; use core::cmp::Eq; use libc::{c_char, c_int, c_long, size_t, time_t}; @@ -7,16 +7,17 @@ use result::{Result, Ok, Err}; #[abi = "cdecl"] extern mod rustrt { - #[legacy_exports]; - fn get_time(&sec: i64, &nsec: i32); - fn precise_time_ns(&ns: u64); + #[legacy_exports] + fn get_time(sec: &mut i64, nsec: &mut i32); + + fn precise_time_ns(ns: &mut u64); fn rust_tzset(); // FIXME: The i64 values can be passed by-val when #2064 is fixed. fn rust_gmtime(&&sec: i64, &&nsec: i32, &&result: Tm); fn rust_localtime(&&sec: i64, &&nsec: i32, &&result: Tm); - fn rust_timegm(&&tm: Tm, &sec: i64); - fn rust_mktime(&&tm: Tm, &sec: i64); + fn rust_timegm(&&tm: Tm, sec: &mut i64); + fn rust_mktime(&&tm: Tm, sec: &mut i64); } /// A record specifying a time value in seconds and nanoseconds. @@ -36,20 +37,22 @@ impl Timespec : Eq { pub fn get_time() -> Timespec { let mut sec = 0i64; let mut nsec = 0i32; - rustrt::get_time(sec, nsec); + rustrt::get_time(&mut sec, &mut nsec); return {sec: sec, nsec: nsec}; } + /** * Returns the current value of a high-resolution performance counter * in nanoseconds since an unspecified epoch. */ pub fn precise_time_ns() -> u64 { let mut ns = 0u64; - rustrt::precise_time_ns(ns); + rustrt::precise_time_ns(&mut ns); ns } + /** * Returns the current value of a high-resolution performance counter * in seconds since an unspecified epoch. @@ -762,9 +765,9 @@ impl Tm { fn to_timespec() -> Timespec { let mut sec = 0i64; if self.tm_gmtoff == 0_i32 { - rustrt::rust_timegm(self, sec); + rustrt::rust_timegm(self, &mut sec); } else { - rustrt::rust_mktime(self, sec); + rustrt::rust_mktime(self, &mut sec); } { sec: sec, nsec: self.tm_nsec } } diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 2aca87b942e..c9c28c4e1f0 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -1,6 +1,6 @@ //! Utilities that leverage libuv's `uv_timer_*` API -// tjc: forbid deprecated modes again after snap +#[forbid(deprecated_mode)]; use uv = uv; use uv::iotask; @@ -27,7 +27,7 @@ pub fn delayed_send<T: Copy Send>(iotask: IoTask, msecs: uint, ch: comm::Chan<T>, val: T) { unsafe { let timer_done_po = core::comm::Port::<()>(); - let timer_done_ch = core::comm::Chan(timer_done_po); + let timer_done_ch = core::comm::Chan(&timer_done_po); let timer_done_ch_ptr = ptr::addr_of(&timer_done_ch); let timer = uv::ll::timer_t(); let timer_ptr = ptr::addr_of(&timer); @@ -74,7 +74,7 @@ pub fn delayed_send<T: Copy Send>(iotask: IoTask, */ pub fn sleep(iotask: IoTask, msecs: uint) { let exit_po = core::comm::Port::<()>(); - let exit_ch = core::comm::Chan(exit_po); + let exit_ch = core::comm::Chan(&exit_po); delayed_send(iotask, msecs, exit_ch, ()); core::comm::recv(exit_po); } @@ -103,7 +103,7 @@ pub fn recv_timeout<T: Copy Send>(iotask: IoTask, msecs: uint, wait_po: comm::Port<T>) -> Option<T> { let timeout_po = comm::Port::<()>(); - let timeout_ch = comm::Chan(timeout_po); + let timeout_ch = comm::Chan(&timeout_po); delayed_send(iotask, msecs, timeout_ch, ()); // FIXME: This could be written clearer (#2618) either::either( @@ -162,7 +162,7 @@ mod test { #[test] fn test_gl_timer_sleep_stress2() { let po = core::comm::Port(); - let ch = core::comm::Chan(po); + let ch = core::comm::Chan(&po); let hl_loop = uv::global_loop::get(); let repeat = 20u; @@ -240,7 +240,7 @@ mod test { for iter::repeat(times as uint) { let expected = rand::Rng().gen_str(16u); let test_po = core::comm::Port::<~str>(); - let test_ch = core::comm::Chan(test_po); + let test_ch = core::comm::Chan(&test_po); do task::spawn() { delayed_send(hl_loop, 50u, test_ch, expected); diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 184dfd36279..8ab0dc7f2e7 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -5,7 +5,7 @@ * very naive algorithm, but it will probably be updated to be a * red-black tree or something else. */ -#[warn(deprecated_mode)]; +#[forbid(deprecated_mode)]; use core::cmp::{Eq, Ord}; use core::option::{Some, None}; @@ -26,7 +26,7 @@ enum TreeNode<K, V> = { pub fn TreeMap<K, V>() -> TreeMap<K, V> { @mut None } /// Insert a value into the map -pub fn insert<K: Copy Eq Ord, V: Copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { +pub fn insert<K: Copy Eq Ord, V: Copy>(m: &mut TreeEdge<K, V>, k: K, v: V) { match copy *m { None => { *m = Some(@TreeNode({key: k, @@ -48,7 +48,7 @@ pub fn insert<K: Copy Eq Ord, V: Copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { } /// Find a value based on the key -pub fn find<K: Copy Eq Ord, V: Copy>(m: &const TreeEdge<K, V>, +k: K) +pub fn find<K: Copy Eq Ord, V: Copy>(m: &const TreeEdge<K, V>, k: K) -> Option<V> { match copy *m { None => None, @@ -121,7 +121,7 @@ mod tests { insert(m, 1, ()); let n = @mut 0; - fn t(n: @mut int, +k: int, +_v: ()) { + fn t(n: @mut int, k: int, _v: ()) { assert (*n == k); *n += 1; } traverse(m, |x,y| t(n, *x, *y)); diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 869c3efa38f..79f6bafb4a4 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -133,12 +133,12 @@ mod test { fn impl_uv_hl_simple_timer(iotask: IoTask) unsafe { let exit_po = core::comm::Port::<bool>(); - let exit_ch = core::comm::Chan(exit_po); - let exit_ch_ptr = ptr::p2::addr_of(&exit_ch); + let exit_ch = core::comm::Chan(&exit_po); + let exit_ch_ptr = ptr::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::p2::addr_of(&timer_handle); + let timer_ptr = ptr::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); @@ -166,7 +166,7 @@ mod test { fn test_gl_uv_global_loop_high_level_global_timer() unsafe { let hl_loop = get_gl(); let exit_po = comm::Port::<()>(); - let exit_ch = comm::Chan(exit_po); + let exit_ch = comm::Chan(&exit_po); task::spawn_sched(task::ManualThreads(1u), || { impl_uv_hl_simple_timer(hl_loop); core::comm::send(exit_ch, ()); @@ -182,7 +182,7 @@ mod test { fn test_stress_gl_uv_global_loop_high_level_global_timer() unsafe { let hl_loop = get_gl(); let exit_po = core::comm::Port::<()>(); - let exit_ch = core::comm::Chan(exit_po); + let exit_ch = core::comm::Chan(&exit_po); let cycles = 5000u; for iter::repeat(cycles) { task::spawn_sched(task::ManualThreads(1u), || { diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index 4a4a34704be..ad40d96e4f7 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -4,11 +4,10 @@ * The I/O task runs in its own single-threaded scheduler. By using the * `interact` function you can execute code in a uv callback. */ - -// tjc: forbid deprecated modes again after a snapshot +#[forbid(deprecated_mode)]; use libc::c_void; -use ptr::p2::addr_of; +use ptr::addr_of; use comm = core::comm; use comm::{Port, Chan, listen}; use task::TaskBuilder; @@ -60,7 +59,7 @@ pub fn spawn_iotask(task: task::TaskBuilder) -> IoTask { * via ports/chans. */ pub unsafe fn interact(iotask: IoTask, - +cb: fn~(*c_void)) { + cb: fn~(*c_void)) { send_msg(iotask, Interaction(move cb)); } @@ -125,7 +124,7 @@ type IoTaskLoopData = { }; fn send_msg(iotask: IoTask, - +msg: IoTaskMsg) unsafe { + msg: IoTaskMsg) unsafe { iotask.op_chan.send(move msg); ll::async_send(iotask.async_handle); } @@ -184,7 +183,7 @@ mod test { let async_handle = ll::async_t(); let ah_ptr = ptr::addr_of(&async_handle); let exit_po = core::comm::Port::<()>(); - let exit_ch = core::comm::Chan(exit_po); + let exit_ch = core::comm::Chan(&exit_po); let ah_data = { iotask: iotask, exit_ch: exit_ch @@ -202,7 +201,7 @@ mod test { // high_level_loop unsafe fn spawn_test_loop(exit_ch: comm::Chan<()>) -> IoTask { let iotask_port = comm::Port::<IoTask>(); - let iotask_ch = comm::Chan(iotask_port); + let iotask_ch = comm::Chan(&iotask_port); do task::spawn_sched(task::ManualThreads(1u)) { run_loop(iotask_ch); exit_ch.send(()); @@ -223,7 +222,7 @@ mod test { #[test] fn test_uv_iotask_async() unsafe { let exit_po = core::comm::Port::<()>(); - let exit_ch = core::comm::Chan(exit_po); + let exit_ch = core::comm::Chan(&exit_po); let iotask = spawn_test_loop(exit_ch); // using this handle to manage the lifetime of the high_level_loop, @@ -233,7 +232,7 @@ mod test { // lives until, at least, all of the impl_uv_hl_async() runs have been // called, at least. let work_exit_po = core::comm::Port::<()>(); - let work_exit_ch = core::comm::Chan(work_exit_po); + let work_exit_ch = core::comm::Chan(&work_exit_po); for iter::repeat(7u) { do task::spawn_sched(task::ManualThreads(1u)) { impl_uv_iotask_async(iotask); diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index f0594475d04..f8c3882d15e 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -1466,12 +1466,12 @@ pub mod test { let kill_server_msg = ~"does a dog have buddha nature?"; let server_resp_msg = ~"mu!"; let client_port = core::comm::Port::<~str>(); - let client_chan = core::comm::Chan::<~str>(client_port); + let client_chan = core::comm::Chan::<~str>(&client_port); let server_port = core::comm::Port::<~str>(); - let server_chan = core::comm::Chan::<~str>(server_port); + let server_chan = core::comm::Chan::<~str>(&server_port); let continue_port = core::comm::Port::<bool>(); - let continue_chan = core::comm::Chan::<bool>(continue_port); + let continue_chan = core::comm::Chan::<bool>(&continue_port); let continue_chan_ptr = ptr::addr_of(&continue_chan); do task::spawn_sched(task::ManualThreads(1)) { |
