diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-04 19:58:31 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-04 19:59:47 -0700 |
| commit | 8fc60af441a1375ee73a0efe4524b54ff039e69a (patch) | |
| tree | df2e886ac825f6f95b35a72f2767f20f2ea72741 /src/libstd | |
| parent | f5dfd9b3ce5dd6fbe567ba07e89c70a4db2c4cd4 (diff) | |
| download | rust-8fc60af441a1375ee73a0efe4524b54ff039e69a.tar.gz rust-8fc60af441a1375ee73a0efe4524b54ff039e69a.zip | |
Remove by-copy mode from std, mostly
One instance remains in net_tcp due to a foreign fn. Lots of instances remain in serialization.rs, but IIRC that is being removed. I had to do unholy things to task-perf-word-count-generic to get it to compile after demoding pipes. I may well have messed up its performance, but it passes.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 2 | ||||
| -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 | 15 | ||||
| -rw-r--r-- | src/libstd/net_tcp.rs | 21 | ||||
| -rw-r--r-- | src/libstd/net_url.rs | 12 | ||||
| -rw-r--r-- | src/libstd/par.rs | 10 | ||||
| -rw-r--r-- | src/libstd/smallintmap.rs | 6 | ||||
| -rw-r--r-- | src/libstd/std.rc | 1 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 2 | ||||
| -rw-r--r-- | src/libstd/test.rs | 2 | ||||
| -rw-r--r-- | src/libstd/time.rs | 2 | ||||
| -rw-r--r-- | src/libstd/timer.rs | 2 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 8 | ||||
| -rw-r--r-- | src/libstd/uv_iotask.rs | 7 | ||||
| -rw-r--r-- | src/libstd/uv_ll.rs | 12 |
26 files changed, 83 insertions, 79 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/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 90476ea101a..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) } @@ -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 8c95410d4e8..1027acfb569 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -1,4 +1,5 @@ //! High-level interface to libuv's TCP functionality +#[warn(deprecated_mode)]; use ip = net_ip; use uv::iotask; @@ -324,7 +325,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)); @@ -558,8 +559,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,8 +576,8 @@ 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>>(); @@ -749,7 +750,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 +786,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 +814,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 } @@ -1474,7 +1475,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/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 7622f1b8de6..cc076772e6e 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -20,6 +20,7 @@ not required in or otherwise suitable for the core library. #[allow(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; +#[warn(deprecated_mode)]; #[forbid(deprecated_pattern)]; extern mod core(vers = "0.4"); diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 88869773e5d..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. * diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 2eac3729c22..162a5ecc5fc 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; diff --git a/src/libstd/time.rs b/src/libstd/time.rs index aef3bb2ac0a..627a3b8eeae 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}; diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 821015edd1a..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; 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_iotask.rs b/src/libstd/uv_iotask.rs index 2e31e15a70d..ad40d96e4f7 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -4,8 +4,7 @@ * 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::addr_of; @@ -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); } diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index f8c3882d15e..8b428d8d6d8 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -19,7 +19,7 @@ * This module's implementation will hopefully be, eventually, replaced * with per-platform, generated source files from rust-bindgen. */ - +#[warn(deprecated_mode)]; #[allow(non_camel_case_types)]; // C types use libc::size_t; @@ -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; @@ -1357,8 +1357,8 @@ pub mod test { fn impl_uv_tcp_server(server_ip: &str, server_port: int, - +kill_server_msg: ~str, - +server_resp_msg: ~str, + kill_server_msg: ~str, + server_resp_msg: ~str, server_chan: *comm::Chan<~str>, continue_chan: *comm::Chan<bool>) unsafe { let test_loop = loop_new(); |
