diff --git a/src/libcore/future.rs b/src/libcore/future.rs index e07c03cafb6..efd5ff65aa5 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -87,7 +87,7 @@ pub fn from_port(port: future_pipe::client::waiting) -> } } -pub fn from_fn(+f: ~fn() -> A) -> Future { +pub fn from_fn(f: ~fn() -> A) -> Future { /*! * Create a future from a function. * @@ -99,7 +99,7 @@ pub fn from_fn(+f: ~fn() -> A) -> Future { Future {state: Pending(move f)} } -pub fn spawn(+blk: fn~() -> A) -> Future { +pub fn spawn(blk: fn~() -> A) -> Future { /*! * Create a future from a unique closure. * diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index c53f069174c..791c6bccde8 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -860,7 +860,7 @@ endpoint is passed to the new task. pub fn spawn_service( init: extern fn() -> (SendPacketBuffered, RecvPacketBuffered), - +service: fn~(v: RecvPacketBuffered)) + service: fn~(v: RecvPacketBuffered)) -> SendPacketBuffered { let (client, server) = init(); @@ -884,7 +884,7 @@ receive state. pub fn spawn_service_recv( init: extern fn() -> (RecvPacketBuffered, SendPacketBuffered), - +service: fn~(v: SendPacketBuffered)) + service: fn~(v: SendPacketBuffered)) -> RecvPacketBuffered { let (client, server) = init(); diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 992c8e011f7..c4ef136a592 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -46,7 +46,7 @@ type GlobalPtr = *libc::uintptr_t; pub unsafe fn chan_from_global_ptr( global: GlobalPtr, task_fn: fn() -> task::TaskBuilder, - +f: fn~(comm::Port) + f: fn~(comm::Port) ) -> comm::Chan { enum Msg { diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 06150227e95..8d7791d18d9 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -220,7 +220,7 @@ pub type TaskOpts = { // FIXME (#2585): Replace the 'consumed' bit with move mode on self pub enum TaskBuilder = { opts: TaskOpts, - gen_body: fn@(+v: fn~()) -> fn~(), + gen_body: fn@(v: fn~()) -> fn~(), can_not_copy: Option, mut consumed: bool, }; @@ -233,7 +233,7 @@ pub enum TaskBuilder = { pub fn task() -> TaskBuilder { TaskBuilder({ opts: default_task_opts(), - gen_body: |+body| move body, // Identity function + gen_body: |body| move body, // Identity function can_not_copy: None, mut consumed: false, }) @@ -410,7 +410,7 @@ impl TaskBuilder { * generator by applying the task body which results from the * existing body generator to the new body generator. */ - fn add_wrapper(wrapper: fn@(+v: fn~()) -> fn~()) -> TaskBuilder { + fn add_wrapper(wrapper: fn@(v: fn~()) -> fn~()) -> TaskBuilder { let prev_gen_body = self.gen_body; let notify_chan = if self.opts.notify_chan.is_none() { None @@ -442,7 +442,7 @@ impl TaskBuilder { * When spawning into a new scheduler, the number of threads requested * must be greater than zero. */ - fn spawn(+f: fn~()) { + fn spawn(f: fn~()) { let notify_chan = if self.opts.notify_chan.is_none() { None } else { @@ -460,7 +460,7 @@ impl TaskBuilder { spawn::spawn_raw(move opts, x.gen_body(move f)); } /// Runs a task, while transfering ownership of one argument to the child. - fn spawn_with(arg: A, +f: fn~(+v: A)) { + fn spawn_with(arg: A, f: fn~(v: A)) { let arg = ~mut Some(move arg); do self.spawn |move arg, move f| { f(option::swap_unwrap(arg)) @@ -478,7 +478,7 @@ impl TaskBuilder { * otherwise be required to establish communication from the parent * to the child. */ - fn spawn_listener(+f: fn~(comm::Port)) -> comm::Chan { + fn spawn_listener(f: fn~(comm::Port)) -> comm::Chan { let setup_po = comm::Port(); let setup_ch = comm::Chan(&setup_po); do self.spawn |move f| { @@ -494,7 +494,7 @@ impl TaskBuilder { * Runs a new task, setting up communication in both directions */ fn spawn_conversation - (+f: fn~(comm::Port, comm::Chan)) + (f: fn~(comm::Port, comm::Chan)) -> (comm::Port, comm::Chan) { let from_child = comm::Port(); let to_parent = comm::Chan(&from_child); @@ -517,7 +517,7 @@ impl TaskBuilder { * # Failure * Fails if a future_result was already set for this task. */ - fn try(+f: fn~() -> T) -> Result { + fn try(f: fn~() -> T) -> Result { let po = comm::Port(); let ch = comm::Chan(&po); let mut result = None; @@ -556,7 +556,7 @@ pub fn default_task_opts() -> TaskOpts { /* Spawn convenience functions */ -pub fn spawn(+f: fn~()) { +pub fn spawn(f: fn~()) { /*! * Creates and executes a new child task * @@ -569,7 +569,7 @@ pub fn spawn(+f: fn~()) { task().spawn(move f) } -pub fn spawn_unlinked(+f: fn~()) { +pub fn spawn_unlinked(f: fn~()) { /*! * Creates a child task unlinked from the current one. If either this * task or the child task fails, the other will not be killed. @@ -578,7 +578,7 @@ pub fn spawn_unlinked(+f: fn~()) { task().unlinked().spawn(move f) } -pub fn spawn_supervised(+f: fn~()) { +pub fn spawn_supervised(f: fn~()) { /*! * Creates a child task unlinked from the current one. If either this * task or the child task fails, the other will not be killed. @@ -587,7 +587,7 @@ pub fn spawn_supervised(+f: fn~()) { task().supervised().spawn(move f) } -pub fn spawn_with(+arg: A, +f: fn~(+v: A)) { +pub fn spawn_with(arg: A, f: fn~(v: A)) { /*! * Runs a task, while transfering ownership of one argument to the * child. @@ -601,7 +601,7 @@ pub fn spawn_with(+arg: A, +f: fn~(+v: A)) { task().spawn_with(move arg, move f) } -pub fn spawn_listener(+f: fn~(comm::Port)) -> comm::Chan { +pub fn spawn_listener(f: fn~(comm::Port)) -> comm::Chan { /*! * Runs a new task while providing a channel from the parent to the child * @@ -612,7 +612,7 @@ pub fn spawn_listener(+f: fn~(comm::Port)) -> comm::Chan { } pub fn spawn_conversation - (+f: fn~(comm::Port, comm::Chan)) + (f: fn~(comm::Port, comm::Chan)) -> (comm::Port, comm::Chan) { /*! * Runs a new task, setting up communication in both directions @@ -623,7 +623,7 @@ pub fn spawn_conversation task().spawn_conversation(move f) } -pub fn spawn_sched(mode: SchedMode, +f: fn~()) { +pub fn spawn_sched(mode: SchedMode, f: fn~()) { /*! * Creates a new scheduler and executes a task on it * @@ -640,7 +640,7 @@ pub fn spawn_sched(mode: SchedMode, +f: fn~()) { task().sched_mode(mode).spawn(move f) } -pub fn try(+f: fn~() -> T) -> Result { +pub fn try(f: fn~() -> T) -> Result { /*! * Execute a function in another task and return either the return value * of the function or result::err. @@ -1127,7 +1127,7 @@ fn test_spawn_sched_blocking() { } #[cfg(test)] -fn avoid_copying_the_body(spawnfn: fn(+v: fn~())) { +fn avoid_copying_the_body(spawnfn: fn(v: fn~())) { let p = comm::Port::(); let ch = comm::Chan(&p); @@ -1150,7 +1150,7 @@ fn test_avoid_copying_the_body_spawn() { #[test] fn test_avoid_copying_the_body_spawn_listener() { - do avoid_copying_the_body |+f| { + do avoid_copying_the_body |f| { spawn_listener(fn~(move f, _po: comm::Port) { f(); }); @@ -1168,7 +1168,7 @@ fn test_avoid_copying_the_body_task_spawn() { #[test] fn test_avoid_copying_the_body_spawn_listener_1() { - do avoid_copying_the_body |+f| { + do avoid_copying_the_body |f| { task().spawn_listener(fn~(move f, _po: comm::Port) { f(); }); diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 2db63d20f16..6eaace1fa1a 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -488,7 +488,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) } } -pub fn spawn_raw(opts: TaskOpts, +f: fn~()) { +pub fn spawn_raw(opts: TaskOpts, f: fn~()) { let (child_tg, ancestors, is_main) = gen_child_taskgroup(opts.linked, opts.supervised); @@ -533,7 +533,7 @@ pub fn spawn_raw(opts: TaskOpts, +f: fn~()) { fn make_child_wrapper(child: *rust_task, child_arc: TaskGroupArc, ancestors: AncestorList, is_main: bool, notify_chan: Option>, - +f: fn~()) -> fn~() { + f: fn~()) -> fn~() { let child_data = ~mut Some((move child_arc, move ancestors)); return fn~(move notify_chan, move child_data, move f) { // Agh. Get move-mode items into the closure. FIXME (#2829) 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 { - 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: CVec, ofs: uint) -> T { * * Fails if `ofs` is greater or equal to the length of the vector */ -pub fn set(t: CVec, ofs: uint, +v: T) { +pub fn set(t: CVec, 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 { } impl DuplexStream : Channel { - 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(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/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 { - 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: S, v: int) { + fn serialize_1(s: &S, v: int) { s.emit_i64(v as i64); } - fn serialize_0(&&s: S, v: Option) { + fn serialize_0(s: &S, v: Option) { 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: S) -> int { + fn deserialize_1(s: &S) -> int { s.read_i64() as int } - fn deserialize_0(&&s: S) -> Option { + fn deserialize_0(s: &S) -> Option { 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 { - 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 { pub fn init() -> Treemap { @Empty } /// Insert a value into the map -pub fn insert(m: Treemap, +k: K, +v: V) +pub fn insert(m: Treemap, k: K, v: V) -> Treemap { @match m { @Empty => Node(@k, @v, @Empty, @Empty), @@ -41,7 +41,7 @@ pub fn insert(m: Treemap, +k: K, +v: V) } /// Find a value based on the key -pub fn find(m: Treemap, +k: K) -> Option { +pub fn find(m: Treemap, k: K) -> Option { 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 { +fn find_opt(opts: &[Opt], nm: Name) -> Option { vec::position(opts, |opt| opt.name == nm) } @@ -214,7 +213,7 @@ pub type Result = result::Result; */ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result unsafe { let n_opts = vec::len::(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 { + fn parse_ident(ident: &str, value: Json) -> Result { 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(ls: @List, f: fn((&T)) -> bool) -> Option { } /// Returns true if a list contains an element with the given value -pub fn has(ls: @List, +elt: T) -> bool { +pub fn has(ls: @List, elt: T) -> bool { for each(ls) |e| { if *e == elt { return true; } } @@ -114,7 +114,7 @@ pub pure fn append(l: @List, m: @List) -> @List { /* /// Push one element into the front of a list, returning a new list /// THIS VERSION DOESN'T ACTUALLY WORK -pure fn push(ll: &mut @list, +vv: T) { +pure fn push(ll: &mut @list, 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 { * * 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 { 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 T: ops::Index { - pure fn index(+k: K) -> V { + pure fn index(k: K) -> V { unsafe { self.get(k) } @@ -459,7 +458,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)) 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>) -> + 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)); @@ -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>), - +new_connect_cb: fn~(TcpNewConnection, + on_establish_cb: fn~(comm::Chan>), + new_connect_cb: fn~(TcpNewConnection, comm::Chan>)) -> 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>), - +on_connect_cb: fn~(*uv::ll::uv_tcp_t)) + on_establish_cb: fn~(comm::Chan>), + 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::>(); @@ -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, +host: ~str, - +port: Option<~str>, +path: ~str, +query: Query, - +fragment: Option<~str>) -> Url { +pub 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, 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 parallel version of map. -pub fn map(xs: &[A], +f: fn~((&A)) -> B) -> ~[B] { +pub fn map(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(xs: &[A], +f: fn~((&A)) -> B) -> ~[B] { /// A parallel version of mapi. pub fn mapi(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( } /// Returns true if the function holds for all elements in the vector. -pub fn alli(xs: &[A], +f: fn~(uint, (&A)) -> bool) -> bool { +pub fn alli(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(xs: &[A], +f: fn~(uint, (&A)) -> bool) -> bool { } /// Returns true if the function holds for any elements in the vector. -pub fn any(xs: &[A], +f: fn~(&(A)) -> bool) -> bool { +pub fn any(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 SmallIntMap: map::Map { 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) { @@ -131,7 +131,7 @@ impl SmallIntMap: map::Map { } impl SmallIntMap: ops::Index { - 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 = { pub fn TreeMap() -> TreeMap { @mut None } /// Insert a value into the map -pub fn insert(m: &mut TreeEdge, +k: K, +v: V) { +pub fn insert(m: &mut TreeEdge, k: K, v: V) { match copy *m { None => { *m = Some(@TreeNode({key: k, @@ -48,7 +48,7 @@ pub fn insert(m: &mut TreeEdge, +k: K, +v: V) { } /// Find a value based on the key -pub fn find(m: &const TreeEdge, +k: K) +pub fn find(m: &const TreeEdge, k: K) -> Option { 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) unsafe { let test_loop = loop_new(); diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index bfe0f4dd0e6..4da9992b0dd 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -48,7 +48,6 @@ trait ext_ctxt_ast_builder { fn ty_param(id: ast::ident, +bounds: ~[ast::ty_param_bound]) -> ast::ty_param; fn arg(name: ident, ty: @ast::ty) -> ast::arg; - fn arg_mode(name: ident, ty: @ast::ty, mode: ast::rmode) -> ast::arg; fn expr_block(e: @ast::expr) -> ast::blk; fn fn_decl(+inputs: ~[ast::arg], output: @ast::ty) -> ast::fn_decl; fn item(name: ident, span: span, +node: ast::item_) -> @ast::item; @@ -177,13 +176,6 @@ impl ext_ctxt: ext_ctxt_ast_builder { id: self.next_id()} } - fn arg_mode(name: ident, ty: @ast::ty, mode: ast::rmode) -> ast::arg { - {mode: ast::expl(mode), - ty: ty, - ident: name, - id: self.next_id()} - } - fn block(+stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk { let blk = {view_items: ~[], stmts: stmts, diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 9c10d228a23..874ea01e9b0 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -47,16 +47,15 @@ impl message: gen_send { let arg_names = tys.mapi(|i, _ty| cx.ident_of(~"x_"+i.to_str())); let args_ast = (arg_names, tys).map( - |n, t| cx.arg_mode(*n, *t, ast::by_copy) + |n, t| cx.arg(*n, *t) ); let pipe_ty = cx.ty_path_ast_builder( path(~[this.data_name()], span) .add_tys(cx.ty_vars(this.ty_params))); let args_ast = vec::append( - ~[cx.arg_mode(cx.ident_of(~"pipe"), - pipe_ty, - ast::by_copy)], + ~[cx.arg(cx.ident_of(~"pipe"), + pipe_ty)], args_ast); let mut body = ~"{\n"; @@ -129,15 +128,14 @@ impl message: gen_send { let arg_names = tys.mapi(|i, _ty| (~"x_" + i.to_str())); let args_ast = (arg_names, tys).map( - |n, t| cx.arg_mode(cx.ident_of(*n), *t, ast::by_copy) + |n, t| cx.arg(cx.ident_of(*n), *t) ); let args_ast = vec::append( - ~[cx.arg_mode(cx.ident_of(~"pipe"), + ~[cx.arg(cx.ident_of(~"pipe"), cx.ty_path_ast_builder( path(~[this.data_name()], span) - .add_tys(cx.ty_vars(this.ty_params))), - ast::by_copy)], + .add_tys(cx.ty_vars(this.ty_params))))], args_ast); let message_args = if arg_names.len() == 0 { diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs index c2bca3fc6be..c60904419d5 100644 --- a/src/rustc/driver/rustc.rs +++ b/src/rustc/driver/rustc.rs @@ -22,15 +22,15 @@ use syntax::diagnostic; use rustc::driver::session; use rustc::middle::lint; -fn version(argv0: ~str) { +fn version(argv0: &str) { let mut vers = ~"unknown version"; let env_vers = env!("CFG_VERSION"); - if str::len(env_vers) != 0u { vers = env_vers; } + if env_vers.len() != 0 { vers = env_vers; } io::println(fmt!("%s %s", argv0, vers)); io::println(fmt!("host: %s", host_triple())); } -fn usage(argv0: ~str) { +fn usage(argv0: &str) { io::println(fmt!("Usage: %s [options] \n", argv0) + ~" Options: @@ -86,7 +86,7 @@ fn describe_warnings() { let lint_dict = lint::get_lint_dict(); let mut max_key = 0; for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); } - fn padded(max: uint, s: ~str) -> ~str { + fn padded(max: uint, s: &str) -> ~str { str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s } io::println(fmt!("\nAvailable lint checks:\n")); @@ -117,14 +117,14 @@ fn describe_debug_flags() { } } -fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) { +fn run_compiler(args: &~[~str], demitter: diagnostic::emitter) { // Don't display log spew by default. Can override with RUST_LOG. logging::console_off(); - let mut args = args; + let mut args = *args; let binary = args.shift(); - if vec::len(args) == 0u { usage(binary); return; } + if args.is_empty() { usage(binary); return; } let matches = match getopts::getopts(args, opts()) { @@ -278,9 +278,9 @@ fn monitor(+f: fn~(diagnostic::emitter)) { } fn main() { - let args = os::args(); - do monitor |demitter| { - run_compiler(args, demitter); + let mut args = os::args(); + do monitor |move args, demitter| { + run_compiler(&args, demitter); } } diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index 168e4b8b1f1..97b031c6024 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -10,8 +10,6 @@ // xfail-pretty -#[legacy_modes]; - extern mod std; use option = option; @@ -70,18 +68,18 @@ fn map(f: fn~() -> word_reader, emit: map_reduce::putter<~str, int>) { let f = f(); loop { match f.read_word() { - Some(w) => { emit(w, 1); } + Some(w) => { emit(&w, 1); } None => { break; } } } } -fn reduce(&&word: ~str, get: map_reduce::getter) { +fn reduce(word: &~str, get: map_reduce::getter) { let mut count = 0; loop { match get() { Some(_) => { count += 1; } None => { break; } } } - io::println(fmt!("%s\t%?", word, count)); + io::println(fmt!("%s\t%?", *word, count)); } struct box { @@ -116,13 +114,13 @@ mod map_reduce { export reducer; export map_reduce; - type putter = fn(K, V); + type putter = fn(&K, V); type mapper = fn~(K1, putter); type getter = fn() -> Option; - type reducer = fn~(K, getter); + type reducer = fn~(&K, getter); enum ctrl_proto { find_reducer(K, Chan>>), @@ -145,9 +143,9 @@ mod map_reduce { fn start_mappers( - map: mapper, + map: &mapper, &ctrls: ~[ctrl_proto::server::open], - inputs: ~[K1]) + inputs: &~[K1]) -> ~[joinable_task] { let mut tasks = ~[]; @@ -155,7 +153,8 @@ mod map_reduce { let (ctrl, ctrl_server) = ctrl_proto::init(); let ctrl = box(ctrl); let i = copy *i; - tasks.push(spawn_joinable(|move i| map_task(map, ctrl, i))); + let m = copy *map; + tasks.push(spawn_joinable(|move i| map_task(m, &ctrl, i))); ctrls.push(ctrl_server); } return tasks; @@ -163,20 +162,22 @@ mod map_reduce { fn map_task( map: mapper, - ctrl: box>, + ctrl: &box>, input: K1) { // log(error, "map_task " + input); - let intermediates = map::HashMap(); + let intermediates: HashMap>> + = map::HashMap(); - do map(input) |key, val| { + do map(input) |key: &K2, val| { let mut c = None; - let found = intermediates.find(key); + let found: Option>> + = intermediates.find(*key); match found { Some(_c) => { c = Some(_c); } None => { do ctrl.swap |ctrl| { - let ctrl = ctrl_proto::client::find_reducer(ctrl, key); + let ctrl = ctrl_proto::client::find_reducer(ctrl, *key); match pipes::recv(ctrl) { ctrl_proto::reducer(c_, ctrl) => { c = Some(c_); @@ -184,7 +185,7 @@ mod map_reduce { } } } - intermediates.insert(key, c.get()); + intermediates.insert(*key, c.get()); send(c.get(), addref); } } @@ -200,7 +201,7 @@ mod map_reduce { } fn reduce_task( - reduce: reducer, + reduce: ~reducer, key: K, out: Chan>>) { @@ -231,7 +232,7 @@ mod map_reduce { return None; } - reduce(key, || get(p, ref_count, is_done) ); + (*reduce)(&key, || get(p, ref_count, is_done) ); } fn map_reduce( @@ -245,7 +246,7 @@ mod map_reduce { // to do the rest. let reducers = map::HashMap(); - let mut tasks = start_mappers(map, ctrl, inputs); + let mut tasks = start_mappers(&map, ctrl, &inputs); let mut num_mappers = vec::len(inputs) as int; while num_mappers > 0 { @@ -270,7 +271,7 @@ mod map_reduce { let p = Port(); let ch = Chan(&p); let r = reduce, kk = k; - tasks.push(spawn_joinable(|| reduce_task(r, kk, ch) )); + tasks.push(spawn_joinable(|| reduce_task(~r, kk, ch) )); c = recv(p); reducers.insert(k, c); }