diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 6936de2bccb..7d410c0337a 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -1,7 +1,7 @@ //! Managed vectors // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use cast::transmute; @@ -48,7 +48,7 @@ pub pure fn capacity(v: @[const T]) -> uint { */ #[inline(always)] pub pure fn build_sized(size: uint, - builder: &fn(push: pure fn(+v: A))) -> @[A] { + builder: &fn(push: pure fn(v: A))) -> @[A] { let mut vec: @[const A] = @[]; unsafe { raw::reserve(&mut vec, size); } builder(|+x| unsafe { raw::push(&mut vec, move x) }); @@ -66,7 +66,7 @@ pub pure fn build_sized(size: uint, * onto the vector being constructed. */ #[inline(always)] -pub pure fn build(builder: &fn(push: pure fn(+v: A))) -> @[A] { +pub pure fn build(builder: &fn(push: pure fn(v: A))) -> @[A] { build_sized(4, builder) } @@ -83,8 +83,8 @@ pub pure fn build(builder: &fn(push: pure fn(+v: A))) -> @[A] { * onto the vector being constructed. */ #[inline(always)] -pub pure fn build_sized_opt(+size: Option, - builder: &fn(push: pure fn(+v: A))) -> @[A] { +pub pure fn build_sized_opt(size: Option, + builder: &fn(push: pure fn(v: A))) -> @[A] { build_sized(size.get_default(4), builder) } @@ -126,7 +126,7 @@ pub pure fn from_fn(n_elts: uint, op: iter::InitOp) -> @[T] { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value `t`. */ -pub pure fn from_elem(n_elts: uint, +t: T) -> @[T] { +pub pure fn from_elem(n_elts: uint, t: T) -> @[T] { do build_sized(n_elts) |push| { let mut i: uint = 0u; while i < n_elts { push(copy t); i += 1u; } @@ -166,7 +166,7 @@ pub mod raw { } #[inline(always)] - pub unsafe fn push(v: &mut @[const T], +initval: T) { + pub unsafe fn push(v: &mut @[const T], initval: T) { let repr: **VecRepr = ::cast::reinterpret_cast(&v); let fill = (**repr).unboxed.fill; if (**repr).unboxed.alloc > fill { @@ -178,7 +178,7 @@ pub mod raw { } // This doesn't bother to make sure we have space. #[inline(always)] // really pretty please - pub unsafe fn push_fast(v: &mut @[const T], +initval: T) { + pub unsafe fn push_fast(v: &mut @[const T], initval: T) { let repr: **VecRepr = ::cast::reinterpret_cast(&v); let fill = (**repr).unboxed.fill; (**repr).unboxed.fill += sys::size_of::(); @@ -187,7 +187,7 @@ pub mod raw { rusti::move_val_init(*p, move initval); } - pub unsafe fn push_slow(v: &mut @[const T], +initval: T) { + pub unsafe fn push_slow(v: &mut @[const T], initval: T) { reserve_at_least(v, v.len() + 1u); push_fast(v, move initval); } diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs index 21f5861b89e..f4f0d7b6104 100644 --- a/src/libcore/cast.rs +++ b/src/libcore/cast.rs @@ -21,7 +21,7 @@ pub unsafe fn reinterpret_cast(src: &T) -> U { * reinterpret_cast on managed pointer types. */ #[inline(always)] -pub unsafe fn forget(+thing: T) { rusti::forget(move thing); } +pub unsafe fn forget(thing: T) { rusti::forget(move thing); } /** * Force-increment the reference count on a shared box. If used @@ -29,7 +29,7 @@ pub unsafe fn forget(+thing: T) { rusti::forget(move thing); } * and/or reinterpret_cast when such calls would otherwise scramble a box's * reference count */ -pub unsafe fn bump_box_refcount(+t: @T) { forget(move t); } +pub unsafe fn bump_box_refcount(t: @T) { forget(move t); } /** * Transform a value of one type into a value of another type. @@ -40,7 +40,7 @@ pub unsafe fn bump_box_refcount(+t: @T) { forget(move t); } * assert transmute("L") == ~[76u8, 0u8]; */ #[inline(always)] -pub unsafe fn transmute(+thing: L) -> G { +pub unsafe fn transmute(thing: L) -> G { let newthing: G = reinterpret_cast(&thing); forget(move thing); move newthing @@ -48,33 +48,33 @@ pub unsafe fn transmute(+thing: L) -> G { /// Coerce an immutable reference to be mutable. #[inline(always)] -pub unsafe fn transmute_mut(+ptr: &a/T) -> &a/mut T { transmute(move ptr) } +pub unsafe fn transmute_mut(ptr: &a/T) -> &a/mut T { transmute(move ptr) } /// Coerce a mutable reference to be immutable. #[inline(always)] -pub unsafe fn transmute_immut(+ptr: &a/mut T) -> &a/T { +pub unsafe fn transmute_immut(ptr: &a/mut T) -> &a/T { transmute(move ptr) } /// Coerce a borrowed pointer to have an arbitrary associated region. #[inline(always)] -pub unsafe fn transmute_region(+ptr: &a/T) -> &b/T { transmute(move ptr) } +pub unsafe fn transmute_region(ptr: &a/T) -> &b/T { transmute(move ptr) } /// Coerce an immutable reference to be mutable. #[inline(always)] -pub unsafe fn transmute_mut_unsafe(+ptr: *const T) -> *mut T { +pub unsafe fn transmute_mut_unsafe(ptr: *const T) -> *mut T { transmute(ptr) } /// Coerce an immutable reference to be mutable. #[inline(always)] -pub unsafe fn transmute_immut_unsafe(+ptr: *const T) -> *T { +pub unsafe fn transmute_immut_unsafe(ptr: *const T) -> *T { transmute(ptr) } /// Coerce a borrowed mutable pointer to have an arbitrary associated region. #[inline(always)] -pub unsafe fn transmute_mut_region(+ptr: &a/mut T) -> &b/mut T { +pub unsafe fn transmute_mut_region(ptr: &a/mut T) -> &b/mut T { transmute(move ptr) } diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index ff9f9498a98..64c38d13e49 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -32,8 +32,8 @@ will once again be the preferred module for intertask communication. */ -// NB: transitionary, de-mode-ing. -#[warn(deprecated_mode)]; +// NB: transitionary, de-mode-ing +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use either::Either; @@ -75,7 +75,7 @@ pub fn Port() -> Port { impl Port { fn chan() -> Chan { Chan(self) } - fn send(+v: T) { self.chan().send(move v) } + fn send(v: T) { self.chan().send(move v) } fn recv() -> T { recv(self) } fn peek() -> bool { peek(self) } @@ -84,7 +84,7 @@ impl Port { impl Chan { fn chan() -> Chan { self } - fn send(+v: T) { send(self, move v) } + fn send(v: T) { send(self, move v) } fn recv() -> T { recv_chan(self) } fn peek() -> bool { peek_chan(self) } @@ -174,7 +174,7 @@ pub fn Chan(&&p: Port) -> Chan { * Sends data over a channel. The sent data is moved into the channel, * whereupon the caller loses access to it. */ -pub fn send(ch: Chan, +data: T) { +pub fn send(ch: Chan, data: T) { let Chan_(p) = ch; let data_ptr = ptr::addr_of(&data) as *(); let res = rustrt::rust_port_id_send(p, data_ptr); diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 4e08dd4c2f3..17ddd6ea73b 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -9,7 +9,7 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate. */ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; type DListLink = Option>; @@ -80,7 +80,7 @@ impl DListNode { } /// Creates a new dlist node with the given data. -pure fn new_dlist_node(+data: T) -> DListNode { +pure fn new_dlist_node(data: T) -> DListNode { DListNode(@{data: move data, mut linked: false, mut prev: None, mut next: None}) } @@ -91,13 +91,13 @@ pure fn DList() -> DList { } /// Creates a new dlist with a single element -pub pure fn from_elem(+data: T) -> DList { +pub pure fn from_elem(data: T) -> DList { let list = DList(); unsafe { list.push(move data); } list } -pub fn from_vec(+vec: &[T]) -> DList { +pub fn from_vec(vec: &[T]) -> DList { do vec::foldl(DList(), vec) |list,data| { list.push(*data); // Iterating left-to-right -- add newly to the tail. list @@ -115,7 +115,7 @@ fn concat(lists: DList>) -> DList { } priv impl DList { - pure fn new_link(+data: T) -> DListLink { + pure fn new_link(data: T) -> DListLink { Some(DListNode(@{data: move data, mut linked: true, mut prev: None, mut next: None})) } @@ -142,7 +142,7 @@ priv impl DList { // Link two nodes together. If either of them are 'none', also sets // the head and/or tail pointers appropriately. #[inline(always)] - fn link(+before: DListLink, +after: DListLink) { + fn link(before: DListLink, after: DListLink) { match before { Some(neighbour) => neighbour.next = after, None => self.hd = after @@ -163,12 +163,12 @@ priv impl DList { self.size -= 1; } - fn add_head(+nobe: DListLink) { + fn add_head(nobe: DListLink) { self.link(nobe, self.hd); // Might set tail too. self.hd = nobe; self.size += 1; } - fn add_tail(+nobe: DListLink) { + fn add_tail(nobe: DListLink) { self.link(self.tl, nobe); // Might set head too. self.tl = nobe; self.size += 1; @@ -198,27 +198,27 @@ impl DList { pure fn is_not_empty() -> bool { self.len() != 0 } /// Add data to the head of the list. O(1). - fn push_head(+data: T) { + fn push_head(data: T) { self.add_head(self.new_link(move data)); } /** * Add data to the head of the list, and get the new containing * node. O(1). */ - fn push_head_n(+data: T) -> DListNode { + fn push_head_n(data: T) -> DListNode { let mut nobe = self.new_link(move data); self.add_head(nobe); option::get(&nobe) } /// Add data to the tail of the list. O(1). - fn push(+data: T) { + fn push(data: T) { self.add_tail(self.new_link(move data)); } /** * Add data to the tail of the list, and get the new containing * node. O(1). */ - fn push_n(+data: T) -> DListNode { + fn push_n(data: T) -> DListNode { let mut nobe = self.new_link(move data); self.add_tail(nobe); option::get(&nobe) @@ -227,7 +227,7 @@ impl DList { * Insert data into the middle of the list, left of the given node. * O(1). */ - fn insert_before(+data: T, neighbour: DListNode) { + fn insert_before(data: T, neighbour: DListNode) { self.insert_left(self.new_link(move data), neighbour); } /** @@ -242,7 +242,7 @@ impl DList { * Insert data in the middle of the list, left of the given node, * and get its containing node. O(1). */ - fn insert_before_n(+data: T, neighbour: DListNode) -> DListNode { + fn insert_before_n(data: T, neighbour: DListNode) -> DListNode { let mut nobe = self.new_link(move data); self.insert_left(nobe, neighbour); option::get(&nobe) @@ -251,7 +251,7 @@ impl DList { * Insert data into the middle of the list, right of the given node. * O(1). */ - fn insert_after(+data: T, neighbour: DListNode) { + fn insert_after(data: T, neighbour: DListNode) { self.insert_right(neighbour, self.new_link(move data)); } /** @@ -266,7 +266,7 @@ impl DList { * Insert data in the middle of the list, right of the given node, * and get its containing node. O(1). */ - fn insert_after_n(+data: T, neighbour: DListNode) -> DListNode { + fn insert_after_n(data: T, neighbour: DListNode) -> DListNode { let mut nobe = self.new_link(move data); self.insert_right(neighbour, nobe); option::get(&nobe) diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 3ce5a7153fd..a2a70908797 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -10,7 +10,7 @@ Note that recursive use is not permitted. */ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use cast::reinterpret_cast; @@ -61,17 +61,17 @@ pub fn DVec() -> DVec { } /// Creates a new dvec with a single element -pub fn from_elem(+e: A) -> DVec { +pub fn from_elem(e: A) -> DVec { DVec_({mut data: ~[move e]}) } /// Creates a new dvec with the contents of a vector -pub fn from_vec(+v: ~[A]) -> DVec { +pub fn from_vec(v: ~[A]) -> DVec { DVec_({mut data: move v}) } /// Consumes the vector and returns its contents -pub fn unwrap(+d: DVec) -> ~[A] { +pub fn unwrap(d: DVec) -> ~[A] { let DVec_({data: v}) <- d; move v } @@ -87,7 +87,7 @@ priv impl DVec { } #[inline(always)] - fn check_out(f: &fn(+v: ~[A]) -> B) -> B { + fn check_out(f: &fn(v: ~[A]) -> B) -> B { unsafe { let mut data = cast::reinterpret_cast(&null::<()>()); data <-> self.data; @@ -98,7 +98,7 @@ priv impl DVec { } #[inline(always)] - fn give_back(+data: ~[A]) { + fn give_back(data: ~[A]) { unsafe { self.data = move data; } @@ -120,7 +120,7 @@ impl DVec { * and return a new vector to replace it with. */ #[inline(always)] - fn swap(f: &fn(+v: ~[A]) -> ~[A]) { + fn swap(f: &fn(v: ~[A]) -> ~[A]) { self.check_out(|v| self.give_back(f(move v))) } @@ -130,7 +130,7 @@ impl DVec { * and return a new vector to replace it with. */ #[inline(always)] - fn swap_mut(f: &fn(+v: ~[mut A]) -> ~[mut A]) { + fn swap_mut(f: &fn(v: ~[mut A]) -> ~[mut A]) { do self.swap |v| { vec::from_mut(f(vec::to_mut(move v))) } @@ -148,7 +148,7 @@ impl DVec { } /// Overwrite the current contents - fn set(+w: ~[A]) { + fn set(w: ~[A]) { self.check_not_borrowed(); self.data <- w; } @@ -164,7 +164,7 @@ impl DVec { } /// Insert a single item at the front of the list - fn unshift(+t: A) { + fn unshift(t: A) { unsafe { let mut data = cast::reinterpret_cast(&null::<()>()); data <-> self.data; @@ -178,7 +178,7 @@ impl DVec { } /// Append a single item to the end of the list - fn push(+t: A) { + fn push(t: A) { self.check_not_borrowed(); self.data.push(move t); } @@ -295,7 +295,7 @@ impl DVec { } /// Overwrites the contents of the element at `idx` with `a` - fn set_elt(idx: uint, +a: A) { + fn set_elt(idx: uint, a: A) { self.check_not_borrowed(); self.data[idx] = a; } @@ -305,7 +305,7 @@ impl DVec { * growing the vector if necessary. New elements will be initialized * with `initval` */ - fn grow_set_elt(idx: uint, initval: &A, +val: A) { + fn grow_set_elt(idx: uint, initval: &A, val: A) { do self.swap |v| { let mut v = move v; v.grow_set(idx, initval, val); @@ -354,7 +354,7 @@ impl DVec { } impl DVec: Index { - pure fn index(+idx: uint) -> A { + pure fn index(idx: uint) -> A { self.get_elt(idx) } } diff --git a/src/libcore/either.rs b/src/libcore/either.rs index dd3bcdfdf88..c64cd25e481 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; //! A type that represents one of two alternatives @@ -114,7 +114,8 @@ pub pure fn is_right(eith: &Either) -> bool { match *eith { Right(_) => true, _ => false } } -pub pure fn unwrap_left(+eith: Either) -> T { +// tjc: fix the next two after a snapshot +pub pure fn unwrap_left(eith: Either) -> T { //! Retrieves the value in the left branch. Fails if the either is Right. match move eith { @@ -122,7 +123,7 @@ pub pure fn unwrap_left(+eith: Either) -> T { } } -pub pure fn unwrap_right(+eith: Either) -> U { +pub pure fn unwrap_right(eith: Either) -> U { //! Retrieves the value in the right branch. Fails if the either is Left. match move eith { diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index 25f92e61726..e10ff4bac71 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -87,7 +87,7 @@ mod ct { let mut pieces: ~[Piece] = ~[]; let lim = str::len(s); let mut buf = ~""; - fn flush_buf(+buf: ~str, pieces: &mut ~[Piece]) -> ~str { + fn flush_buf(buf: ~str, pieces: &mut ~[Piece]) -> ~str { if buf.len() > 0 { let piece = PieceString(move buf); pieces.push(move piece); @@ -323,7 +323,7 @@ mod rt { let mut s = str::from_char(c); return unsafe { pad(cv, s, PadNozero) }; } - pure fn conv_str(cv: Conv, +s: &str) -> ~str { + pure fn conv_str(cv: Conv, s: &str) -> ~str { // For strings, precision is the maximum characters // displayed let mut unpadded = match cv.precision { @@ -405,7 +405,7 @@ mod rt { pure fn ne(other: &PadMode) -> bool { !self.eq(other) } } - fn pad(cv: Conv, +s: ~str, mode: PadMode) -> ~str { + fn pad(cv: Conv, s: ~str, mode: PadMode) -> ~str { let mut s = move s; // sadtimes let uwidth : uint = match cv.width { CountImplied => return s, @@ -518,7 +518,7 @@ mod rt2 { let mut s = str::from_char(c); return unsafe { pad(cv, s, PadNozero) }; } - pure fn conv_str(cv: Conv, +s: &str) -> ~str { + pure fn conv_str(cv: Conv, s: &str) -> ~str { // For strings, precision is the maximum characters // displayed let mut unpadded = match cv.precision { @@ -600,7 +600,7 @@ mod rt2 { pure fn ne(other: &PadMode) -> bool { !self.eq(other) } } - fn pad(cv: Conv, +s: ~str, mode: PadMode) -> ~str { + fn pad(cv: Conv, s: ~str, mode: PadMode) -> ~str { let mut s = move s; // sadtimes let uwidth : uint = match cv.width { CountImplied => return s, diff --git a/src/libcore/future.rs b/src/libcore/future.rs index db311ea3e82..11b6a2c0135 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; /*! @@ -55,7 +55,7 @@ impl Future { } } -pub fn from_value(+val: A) -> Future { +pub fn from_value(val: A) -> Future { /*! * Create a future from a value * @@ -66,7 +66,7 @@ pub fn from_value(+val: A) -> Future { Future {state: Forced(~(move val))} } -pub fn from_port(+port: future_pipe::client::waiting) -> +pub fn from_port(port: future_pipe::client::waiting) -> Future { /*! * Create a future from a port diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index ddd26205000..6942d38d5d3 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use T = inst::T; @@ -231,7 +231,7 @@ fn test_to_str() { #[test] fn test_interfaces() { - fn test(+ten: U) { + fn test(ten: U) { assert (ten.to_int() == 10); let two: U = from_int(2); diff --git a/src/libcore/io.rs b/src/libcore/io.rs index f8f644a17ab..2efc96933da 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -813,7 +813,7 @@ pub mod fsync { } } - pub fn Res(+arg: Arg) -> Res{ + pub fn Res(arg: Arg) -> Res{ Res { arg: move arg } @@ -822,17 +822,17 @@ pub mod fsync { pub type Arg = { val: t, opt_level: Option, - fsync_fn: fn@(+f: t, Level) -> int + fsync_fn: fn@(f: t, Level) -> int }; // fsync file after executing blk // FIXME (#2004) find better way to create resources within lifetime of // outer res pub fn FILE_res_sync(file: &FILERes, opt_level: Option, - blk: fn(+v: Res<*libc::FILE>)) { + blk: fn(v: Res<*libc::FILE>)) { blk(move Res({ val: file.f, opt_level: opt_level, - fsync_fn: fn@(+file: *libc::FILE, l: Level) -> int { + fsync_fn: fn@(file: *libc::FILE, l: Level) -> int { return os::fsync_fd(libc::fileno(file), l) as int; } })); @@ -840,10 +840,10 @@ pub mod fsync { // fsync fd after executing blk pub fn fd_res_sync(fd: &FdRes, opt_level: Option, - blk: fn(+v: Res)) { + blk: fn(v: Res)) { blk(move Res({ val: fd.fd, opt_level: opt_level, - fsync_fn: fn@(+fd: fd_t, l: Level) -> int { + fsync_fn: fn@(fd: fd_t, l: Level) -> int { return os::fsync_fd(fd, l) as int; } })); @@ -853,11 +853,11 @@ pub mod fsync { pub trait FSyncable { fn fsync(l: Level) -> int; } // Call o.fsync after executing blk - pub fn obj_sync(+o: FSyncable, opt_level: Option, - blk: fn(+v: Res)) { + pub fn obj_sync(o: FSyncable, opt_level: Option, + blk: fn(v: Res)) { blk(Res({ val: o, opt_level: opt_level, - fsync_fn: fn@(+o: FSyncable, l: Level) -> int { + fsync_fn: fn@(o: FSyncable, l: Level) -> int { return o.fsync(l); } })); diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index a2fb4698d7c..09bfe2eff36 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -16,7 +16,7 @@ impl IMPL_T: iter::ExtendedIter { pure fn eachi(blk: fn(uint, v: &A) -> bool) { iter::eachi(&self, blk) } pure fn all(blk: fn(&A) -> bool) -> bool { iter::all(&self, blk) } pure fn any(blk: fn(&A) -> bool) -> bool { iter::any(&self, blk) } - pure fn foldl(+b0: B, blk: fn(&B, &A) -> B) -> B { + pure fn foldl(b0: B, blk: fn(&B, &A) -> B) -> B { iter::foldl(&self, move b0, blk) } pure fn position(f: fn(&A) -> bool) -> Option { @@ -30,20 +30,20 @@ impl IMPL_T: iter::EqIter { } impl IMPL_T: iter::CopyableIter { - pure fn filter_to_vec(pred: fn(+a: A) -> bool) -> ~[A] { + pure fn filter_to_vec(pred: fn(a: A) -> bool) -> ~[A] { iter::filter_to_vec(&self, pred) } - pure fn map_to_vec(op: fn(+v: A) -> B) -> ~[B] { + pure fn map_to_vec(op: fn(v: A) -> B) -> ~[B] { iter::map_to_vec(&self, op) } pure fn to_vec() -> ~[A] { iter::to_vec(&self) } - pure fn flat_map_to_vec>(op: fn(+a: A) -> IB) + pure fn flat_map_to_vec>(op: fn(a: A) -> IB) -> ~[B] { iter::flat_map_to_vec(&self, op) } - pure fn find(p: fn(+a: A) -> bool) -> Option { iter::find(&self, p) } + pure fn find(p: fn(a: A) -> bool) -> Option { iter::find(&self, p) } } impl IMPL_T: iter::CopyableOrderedIter { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 5271555d299..bf3e91f7071 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -18,7 +18,7 @@ pub trait ExtendedIter { pure fn eachi(blk: fn(uint, v: &A) -> bool); pure fn all(blk: fn(&A) -> bool) -> bool; pure fn any(blk: fn(&A) -> bool) -> bool; - pure fn foldl(+b0: B, blk: fn(&B, &A) -> B) -> B; + pure fn foldl(b0: B, blk: fn(&B, &A) -> B) -> B; pure fn position(f: fn(&A) -> bool) -> Option; } @@ -36,10 +36,10 @@ pub trait TimesIx{ } pub trait CopyableIter { - pure fn filter_to_vec(pred: fn(+a: A) -> bool) -> ~[A]; - pure fn map_to_vec(op: fn(+v: A) -> B) -> ~[B]; + pure fn filter_to_vec(pred: fn(a: A) -> bool) -> ~[A]; + pure fn map_to_vec(op: fn(v: A) -> B) -> ~[B]; pure fn to_vec() -> ~[A]; - pure fn find(p: fn(+a: A) -> bool) -> Option; + pure fn find(p: fn(a: A) -> bool) -> Option; } pub trait CopyableOrderedIter { @@ -64,7 +64,7 @@ pub trait Buildable { * onto the sequence being constructed. */ static pure fn build_sized(size: uint, - builder: fn(push: pure fn(+v: A))) -> self; + builder: fn(push: pure fn(v: A))) -> self; } pub pure fn eachi>(self: &IA, @@ -93,7 +93,7 @@ pub pure fn any>(self: &IA, } pub pure fn filter_to_vec>( - self: &IA, prd: fn(+a: A) -> bool) -> ~[A] { + self: &IA, prd: fn(a: A) -> bool) -> ~[A] { do vec::build_sized_opt(self.size_hint()) |push| { for self.each |a| { if prd(*a) { push(*a); } @@ -102,7 +102,7 @@ pub pure fn filter_to_vec>( } pub pure fn map_to_vec>(self: &IA, - op: fn(+v: A) -> B) + op: fn(v: A) -> B) -> ~[B] { do vec::build_sized_opt(self.size_hint()) |push| { for self.each |a| { @@ -112,8 +112,7 @@ pub pure fn map_to_vec>(self: &IA, } pub pure fn flat_map_to_vec,IB:BaseIter>( - self: &IA, op: fn(+a: A) -> IB) -> ~[B] { - + self: &IA, op: fn(a: A) -> IB) -> ~[B] { do vec::build |push| { for self.each |a| { for op(*a).each |b| { @@ -123,7 +122,7 @@ pub pure fn flat_map_to_vec,IB:BaseIter>( } } -pub pure fn foldl>(self: &IA, +b0: B, +pub pure fn foldl>(self: &IA, b0: B, blk: fn(&B, &A) -> B) -> B { let mut b <- b0; @@ -206,7 +205,7 @@ pub pure fn max>(self: &IA) -> A { } pub pure fn find>(self: &IA, - p: fn(+a: A) -> bool) -> Option { + p: fn(a: A) -> bool) -> Option { for self.each |i| { if p(*i) { return Some(*i) } } @@ -226,7 +225,7 @@ pub pure fn find>(self: &IA, * onto the sequence being constructed. */ #[inline(always)] -pub pure fn build>(builder: fn(push: pure fn(+v: A))) +pub pure fn build>(builder: fn(push: pure fn(v: A))) -> B { build_sized(4, builder) } @@ -247,7 +246,7 @@ pub pure fn build>(builder: fn(push: pure fn(+v: A))) #[inline(always)] pub pure fn build_sized_opt>( size: Option, - builder: fn(push: pure fn(+v: A))) -> B { + builder: fn(push: pure fn(v: A))) -> B { build_sized(size.get_default(4), builder) } @@ -285,7 +284,7 @@ pub pure fn from_fn>(n_elts: uint, * to the value `t`. */ pub pure fn from_elem>(n_elts: uint, - +t: T) -> BT { + t: T) -> BT { do build_sized(n_elts) |push| { let mut i: uint = 0; while i < n_elts { push(t); i += 1; } diff --git a/src/libcore/mutable.rs b/src/libcore/mutable.rs index a1f65117ecf..5948c630cd8 100644 --- a/src/libcore/mutable.rs +++ b/src/libcore/mutable.rs @@ -8,8 +8,7 @@ dynamic checks: your program will fail if you attempt to perform mutation when the data structure should be immutable. */ - -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use util::with; @@ -24,11 +23,11 @@ struct Data { pub type Mut = Data; -pub fn Mut(+t: T) -> Mut { +pub fn Mut(t: T) -> Mut { Data {value: t, mode: ReadOnly} } -pub fn unwrap(+m: Mut) -> T { +pub fn unwrap(m: Mut) -> T { // Borrowck should prevent us from calling unwrap while the value // is in use, as that would be a move from a borrowed value. assert (m.mode as uint) == (ReadOnly as uint); diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 994e010e452..038c117b8be 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -77,6 +77,6 @@ pub trait Shr { #[lang="index"] pub trait Index { - pure fn index(+index: Index) -> Result; + pure fn index(index: Index) -> Result; } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 87d6aeefbc3..6bd326186cb 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -49,7 +49,7 @@ pub pure fn get_ref(opt: &r/Option) -> &r/T { } } -pub pure fn expect(opt: &Option, +reason: ~str) -> T { +pub pure fn expect(opt: &Option, reason: ~str) -> T { /*! * Gets the value out of an option, printing a specified message on * failure @@ -67,8 +67,8 @@ pub pure fn map(opt: &Option, f: fn(x: &T) -> U) -> Option { match *opt { Some(ref x) => Some(f(x)), None => None } } -pub pure fn map_consume(+opt: Option, - f: fn(+v: T) -> U) -> Option { +pub pure fn map_consume(opt: Option, + f: fn(v: T) -> U) -> Option { /*! * As `map`, but consumes the option and gives `f` ownership to avoid * copying. @@ -76,8 +76,8 @@ pub pure fn map_consume(+opt: Option, if opt.is_some() { Some(f(option::unwrap(move opt))) } else { None } } -pub pure fn chain(+opt: Option, - f: fn(+t: T) -> Option) -> Option { +pub pure fn chain(opt: Option, + f: fn(t: T) -> Option) -> Option { /*! * Update an optional value by optionally running its content through a * function that returns an option. @@ -101,7 +101,7 @@ pub pure fn chain_ref(opt: &Option, match *opt { Some(ref x) => f(x), None => None } } -pub pure fn or(+opta: Option, +optb: Option) -> Option { +pub pure fn or(opta: Option, optb: Option) -> Option { /*! * Returns the leftmost some() value, or none if both are none. */ @@ -112,7 +112,7 @@ pub pure fn or(+opta: Option, +optb: Option) -> Option { } #[inline(always)] -pub pure fn while_some(+x: Option, blk: fn(+v: T) -> Option) { +pub pure fn while_some(x: Option, blk: fn(v: T) -> Option) { //! Applies a function zero or more times until the result is none. let mut opt <- x; @@ -133,13 +133,13 @@ pub pure fn is_some(opt: &Option) -> bool { !is_none(opt) } -pub pure fn get_default(opt: &Option, +def: T) -> T { +pub pure fn get_default(opt: &Option, def: T) -> T { //! Returns the contained value or a default match *opt { Some(copy x) => x, None => def } } -pub pure fn map_default(opt: &Option, +def: U, +pub pure fn map_default(opt: &Option, def: U, f: fn(x: &T) -> U) -> U { //! Applies a function to the contained value or returns a default @@ -151,10 +151,8 @@ pub pure fn iter(opt: &Option, f: fn(x: &T)) { match *opt { None => (), Some(ref t) => f(t) } } -// tjc: shouldn't this be - instead of +? -// then could get rid of some superfluous moves #[inline(always)] -pub pure fn unwrap(+opt: Option) -> T { +pub pure fn unwrap(opt: Option) -> T { /*! * Moves a value out of an option type and returns it. * @@ -174,7 +172,7 @@ pub fn swap_unwrap(opt: &mut Option) -> T { unwrap(util::replace(opt, None)) } -pub pure fn unwrap_expect(+opt: Option, reason: &str) -> T { +pub pure fn unwrap_expect(opt: Option, reason: &str) -> T { //! As unwrap, but with a specified failure message. if opt.is_none() { fail reason.to_unique(); } unwrap(move opt) @@ -197,7 +195,7 @@ impl &Option { chain_ref(self, f) } /// Applies a function to the contained value or returns a default - pure fn map_default(+def: U, f: fn(x: &T) -> U) -> U + pure fn map_default(def: U, f: fn(x: &T) -> U) -> U { map_default(self, move def, f) } /// Performs an operation on the contained value by reference pure fn iter(f: fn(x: &T)) { iter(self, f) } @@ -216,7 +214,7 @@ impl Option { * Fails if the value equals `none` */ pure fn get() -> T { get(&self) } - pure fn get_default(+def: T) -> T { get_default(&self, def) } + pure fn get_default(def: T) -> T { get_default(&self, def) } /** * Gets the value out of an option, printing a specified message on * failure @@ -225,9 +223,9 @@ impl Option { * * Fails if the value equals `none` */ - pure fn expect(+reason: ~str) -> T { expect(&self, reason) } + pure fn expect(reason: ~str) -> T { expect(&self, reason) } /// Applies a function zero or more times until the result is none. - pure fn while_some(blk: fn(+v: T) -> Option) { while_some(self, blk) } + pure fn while_some(blk: fn(v: T) -> Option) { while_some(self, blk) } } impl Option : Eq { diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 1cf4fbab6c9..f178502f6a0 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid #[forbid(deprecated_pattern)]; /*! @@ -768,7 +768,7 @@ struct OverriddenArgs { val: ~[~str] } -fn overridden_arg_key(+_v: @OverriddenArgs) {} +fn overridden_arg_key(_v: @OverriddenArgs) {} pub fn args() -> ~[~str] { unsafe { @@ -779,7 +779,7 @@ pub fn args() -> ~[~str] { } } -pub fn set_args(+new_args: ~[~str]) { +pub fn set_args(new_args: ~[~str]) { unsafe { let overridden_args = @OverriddenArgs { val: copy new_args }; task::local_data::local_data_set(overridden_arg_key, overridden_args); diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 4d446df9cd5..e34c0db35e9 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -73,7 +73,7 @@ bounded and unbounded protocols allows for less code duplication. */ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use cmp::Eq; @@ -169,7 +169,7 @@ impl PacketHeader { reinterpret_cast(&self.buffer) } - fn set_buffer(+b: ~Buffer) unsafe { + fn set_buffer(b: ~Buffer) unsafe { self.buffer = reinterpret_cast(&b); } } @@ -227,7 +227,7 @@ pub fn packet() -> *Packet { #[doc(hidden)] pub fn entangle_buffer( - +buffer: ~Buffer, + buffer: ~Buffer, init: fn(*libc::c_void, x: &T) -> *Packet) -> (SendPacketBuffered, RecvPacketBuffered) { @@ -239,12 +239,12 @@ pub fn entangle_buffer( #[abi = "rust-intrinsic"] #[doc(hidden)] extern mod rusti { - fn atomic_xchg(dst: &mut int, +src: int) -> int; - fn atomic_xchg_acq(dst: &mut int, +src: int) -> int; - fn atomic_xchg_rel(dst: &mut int, +src: int) -> int; + fn atomic_xchg(dst: &mut int, src: int) -> int; + fn atomic_xchg_acq(dst: &mut int, src: int) -> int; + fn atomic_xchg_rel(dst: &mut int, src: int) -> int; - fn atomic_xadd_acq(dst: &mut int, +src: int) -> int; - fn atomic_xsub_rel(dst: &mut int, +src: int) -> int; + fn atomic_xadd_acq(dst: &mut int, src: int) -> int; + fn atomic_xsub_rel(dst: &mut int, src: int) -> int; } // If I call the rusti versions directly from a polymorphic function, @@ -265,7 +265,7 @@ pub fn atomic_sub_rel(dst: &mut int, src: int) -> int { } #[doc(hidden)] -pub fn swap_task(+dst: &mut *rust_task, src: *rust_task) -> *rust_task { +pub fn swap_task(dst: &mut *rust_task, src: *rust_task) -> *rust_task { // It might be worth making both acquire and release versions of // this. unsafe { @@ -304,14 +304,14 @@ fn wait_event(this: *rust_task) -> *libc::c_void { } #[doc(hidden)] -fn swap_state_acq(+dst: &mut State, src: State) -> State { +fn swap_state_acq(dst: &mut State, src: State) -> State { unsafe { transmute(rusti::atomic_xchg_acq(transmute(move dst), src as int)) } } #[doc(hidden)] -fn swap_state_rel(+dst: &mut State, src: State) -> State { +fn swap_state_rel(dst: &mut State, src: State) -> State { unsafe { transmute(rusti::atomic_xchg_rel(transmute(move dst), src as int)) } @@ -343,7 +343,7 @@ struct BufferResource { } } -fn BufferResource(+b: ~Buffer) -> BufferResource { +fn BufferResource(b: ~Buffer) -> BufferResource { //let p = ptr::addr_of(*b); //error!("take %?", p); atomic_add_acq(&mut b.header.ref_count, 1); @@ -354,8 +354,8 @@ fn BufferResource(+b: ~Buffer) -> BufferResource { } #[doc(hidden)] -pub fn send(+p: SendPacketBuffered, - +payload: T) -> bool { +pub fn send(p: SendPacketBuffered, + payload: T) -> bool { let header = p.header(); let p_ = p.unwrap(); let p = unsafe { &*p_ }; @@ -398,7 +398,7 @@ pub fn send(+p: SendPacketBuffered, Fails if the sender closes the connection. */ -pub fn recv(+p: RecvPacketBuffered) -> T { +pub fn recv(p: RecvPacketBuffered) -> T { option::unwrap_expect(try_recv(move p), "connection closed") } @@ -408,7 +408,7 @@ Returns `none` if the sender has closed the connection without sending a message, or `Some(T)` if a message was received. */ -pub fn try_recv(+p: RecvPacketBuffered) +pub fn try_recv(p: RecvPacketBuffered) -> Option { let p_ = p.unwrap(); @@ -655,8 +655,8 @@ this case, `select2` may return either `left` or `right`. */ pub fn select2( - +a: RecvPacketBuffered, - +b: RecvPacketBuffered) + a: RecvPacketBuffered, + b: RecvPacketBuffered) -> Either<(Option, RecvPacketBuffered), (RecvPacketBuffered, Option)> { @@ -697,7 +697,7 @@ pub fn select2i(a: &A, b: &B) -> list of the remaining endpoints. */ -pub fn select(+endpoints: ~[RecvPacketBuffered]) +pub fn select(endpoints: ~[RecvPacketBuffered]) -> (uint, Option, ~[RecvPacketBuffered]) { let ready = wait_many(endpoints.map(|p| p.header())); @@ -859,7 +859,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(); @@ -883,7 +883,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(); @@ -914,10 +914,10 @@ pub trait Channel { // built in send kind. /// Sends a message. - fn send(+x: T); + fn send(x: T); /// Sends a message, or report if the receiver has closed the connection. - fn try_send(+x: T) -> bool; + fn try_send(x: T) -> bool; } /// A trait for things that can receive multiple messages. @@ -966,14 +966,14 @@ pub fn stream() -> (Chan, Port) { } impl Chan: Channel { - fn send(+x: T) { + fn send(x: T) { let mut endp = None; endp <-> self.endp; self.endp = Some( streamp::client::data(unwrap(move endp), move x)) } - fn try_send(+x: T) -> bool { + fn try_send(x: T) -> bool { let mut endp = None; endp <-> self.endp; match move streamp::client::try_data(unwrap(move endp), move x) { @@ -1041,7 +1041,7 @@ pub fn PortSet() -> PortSet{ impl PortSet : Recv { - fn add(+port: pipes::Port) { + fn add(port: pipes::Port) { self.ports.push(move port) } @@ -1091,7 +1091,7 @@ impl PortSet : Recv { pub type SharedChan = private::Exclusive>; impl SharedChan: Channel { - fn send(+x: T) { + fn send(x: T) { let mut xx = Some(move x); do self.with_imm |chan| { let mut x = None; @@ -1100,7 +1100,7 @@ impl SharedChan: Channel { } } - fn try_send(+x: T) -> bool { + fn try_send(x: T) -> bool { let mut xx = Some(move x); do self.with_imm |chan| { let mut x = None; @@ -1111,7 +1111,7 @@ impl SharedChan: Channel { } /// Converts a `chan` into a `shared_chan`. -pub fn SharedChan(+c: Chan) -> SharedChan { +pub fn SharedChan(c: Chan) -> SharedChan { private::exclusive(move c) } @@ -1165,13 +1165,13 @@ pub fn oneshot() -> (ChanOne, PortOne) { * Receive a message from a oneshot pipe, failing if the connection was * closed. */ -pub fn recv_one(+port: PortOne) -> T { +pub fn recv_one(port: PortOne) -> T { let oneshot::send(message) = recv(move port); move message } /// Receive a message from a oneshot pipe unless the connection was closed. -pub fn try_recv_one (+port: PortOne) -> Option { +pub fn try_recv_one (port: PortOne) -> Option { let message = try_recv(move port); if message.is_none() { None } @@ -1182,7 +1182,7 @@ pub fn try_recv_one (+port: PortOne) -> Option { } /// Send a message on a oneshot pipe, failing if the connection was closed. -pub fn send_one(+chan: ChanOne, +data: T) { +pub fn send_one(chan: ChanOne, data: T) { oneshot::client::send(move chan, move data); } @@ -1190,7 +1190,7 @@ pub fn send_one(+chan: ChanOne, +data: T) { * Send a message on a oneshot pipe, or return false if the connection was * closed. */ -pub fn try_send_one(+chan: ChanOne, +data: T) +pub fn try_send_one(chan: ChanOne, data: T) -> bool { oneshot::client::try_send(move chan, move data).is_some() } @@ -1198,7 +1198,7 @@ pub fn try_send_one(+chan: ChanOne, +data: T) pub mod rt { // These are used to hide the option constructors from the // compiler because their names are changing - pub fn make_some(+val: T) -> Option { Some(move val) } + pub fn make_some(val: T) -> Option { Some(move val) } pub fn make_none() -> Option { None } } diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 025a6f28976..c1b2b32edaf 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; #[doc(hidden)]; @@ -340,7 +340,7 @@ fn ArcDestruct(data: *libc::c_void) -> ArcDestruct { } } -pub unsafe fn unwrap_shared_mutable_state(+rc: SharedMutableState) +pub unsafe fn unwrap_shared_mutable_state(rc: SharedMutableState) -> T { struct DeathThroes { mut ptr: Option<~ArcData>, @@ -413,7 +413,7 @@ pub unsafe fn unwrap_shared_mutable_state(+rc: SharedMutableState) */ pub type SharedMutableState = ArcDestruct; -pub unsafe fn shared_mutable_state(+data: T) -> +pub unsafe fn shared_mutable_state(data: T) -> SharedMutableState { let data = ~ArcData { count: 1, unwrapper: 0, data: Some(move data) }; unsafe { @@ -502,7 +502,7 @@ struct ExData { lock: LittleLock, mut failed: bool, mut data: T, } */ pub struct Exclusive { x: SharedMutableState> } -pub fn exclusive(+user_data: T) -> Exclusive { +pub fn exclusive(user_data: T) -> Exclusive { let data = ExData { lock: LittleLock(), mut failed: false, mut data: user_data }; @@ -544,7 +544,7 @@ impl Exclusive { } // FIXME(#2585) make this a by-move method on the exclusive -pub fn unwrap_exclusive(+arc: Exclusive) -> T { +pub fn unwrap_exclusive(arc: Exclusive) -> T { let Exclusive { x: x } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; let ExData { data: data, _ } <- inner; diff --git a/src/libcore/reflect.rs b/src/libcore/reflect.rs index af6a3f9b478..41006e1dfb5 100644 --- a/src/libcore/reflect.rs +++ b/src/libcore/reflect.rs @@ -27,7 +27,7 @@ fn align(size: uint, align: uint) -> uint { struct MovePtrAdaptor { inner: V } -pub fn MovePtrAdaptor(+v: V) -> MovePtrAdaptor { +pub fn MovePtrAdaptor(v: V) -> MovePtrAdaptor { MovePtrAdaptor { inner: move v } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index e454c068d47..e61690d5b2c 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -1,7 +1,7 @@ //! A type representing either success or failure // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use cmp::Eq; @@ -102,7 +102,7 @@ pub pure fn to_either(res: &Result) * ok(parse_bytes(buf)) * } */ -pub fn chain(+res: Result, op: fn(+t: T) +pub fn chain(res: Result, op: fn(t: T) -> Result) -> Result { // XXX: Should be writable with move + match if res.is_ok() { @@ -121,8 +121,8 @@ pub fn chain(+res: Result, op: fn(+t: T) * successful result while handling an error. */ pub fn chain_err( - +res: Result, - op: fn(+t: V) -> Result) + res: Result, + op: fn(t: V) -> Result) -> Result { match move res { Ok(move t) => Ok(t), @@ -247,12 +247,12 @@ impl Result { } impl Result { - fn chain(op: fn(+t: T) -> Result) -> Result { + fn chain(op: fn(t: T) -> Result) -> Result { // XXX: Bad copy chain(copy self, op) } - fn chain_err(op: fn(+t: E) -> Result) -> Result { + fn chain_err(op: fn(t: E) -> Result) -> Result { // XXX: Bad copy chain_err(copy self, op) } @@ -348,7 +348,7 @@ pub fn iter_vec2(ss: &[S], ts: &[T], } /// Unwraps a result, assuming it is an `ok(T)` -pub fn unwrap(+res: Result) -> T { +pub fn unwrap(res: Result) -> T { match move res { Ok(move t) => move t, Err(_) => fail ~"unwrap called on an err result" @@ -356,7 +356,7 @@ pub fn unwrap(+res: Result) -> T { } /// Unwraps a result, assuming it is an `err(U)` -pub fn unwrap_err(+res: Result) -> U { +pub fn unwrap_err(res: Result) -> U { match move res { Err(move u) => move u, Ok(_) => fail ~"unwrap called on an ok result" @@ -389,7 +389,7 @@ mod tests { #[legacy_exports]; fn op1() -> result::Result { result::Ok(666) } - fn op2(+i: int) -> result::Result { + fn op2(i: int) -> result::Result { result::Ok(i as uint + 1u) } diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 40c2bc83351..f3e98f6ba82 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; //! Process spawning @@ -224,7 +224,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program { drop { destroy_repr(&self.r); } } - fn ProgRes(+r: ProgRepr) -> ProgRes { + fn ProgRes(r: ProgRepr) -> ProgRes { ProgRes { r: r } @@ -328,7 +328,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> return {status: status, out: move outs, err: move errs}; } -fn writeclose(fd: c_int, +s: ~str) { +fn writeclose(fd: c_int, s: ~str) { use io::WriterUtil; error!("writeclose %d, %s", fd as int, s); diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index 1b219e16e09..4a56ee5b896 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -15,7 +15,7 @@ use to_bytes::IterBytes; pub trait SendMap { // FIXME(#3148) ^^^^ once find_ref() works, we can drop V:copy - fn insert(&mut self, +k: K, +v: V) -> bool; + fn insert(&mut self, k: K, +v: V) -> bool; fn remove(&mut self, k: &K) -> bool; fn clear(&mut self); pure fn len(&const self) -> uint; @@ -161,7 +161,7 @@ pub mod linear { } } - fn insert_opt_bucket(&mut self, +bucket: Option>) { + fn insert_opt_bucket(&mut self, bucket: Option>) { match move bucket { Some(Bucket {hash: move hash, key: move key, @@ -175,7 +175,7 @@ pub mod linear { /// Inserts the key value pair into the buckets. /// Assumes that there will be a bucket. /// True if there was no previous entry with that key - fn insert_internal(&mut self, hash: uint, +k: K, +v: V) -> bool { + fn insert_internal(&mut self, hash: uint, k: K, v: V) -> bool { match self.bucket_for_key_with_hash(self.buckets, hash, &k) { TableFull => { fail ~"Internal logic error"; } FoundHole(idx) => { @@ -206,7 +206,7 @@ pub mod linear { } impl LinearMap { - fn insert(&mut self, +k: K, +v: V) -> bool { + fn insert(&mut self, k: K, v: V) -> bool { if self.size >= self.resize_at { // n.b.: We could also do this after searching, so // that we do not resize if this call to insert is diff --git a/src/libcore/stackwalk.rs b/src/libcore/stackwalk.rs index d0f8de136e2..09973148c8c 100644 --- a/src/libcore/stackwalk.rs +++ b/src/libcore/stackwalk.rs @@ -1,5 +1,7 @@ #[doc(hidden)]; // FIXME #3538 +#[legacy_modes]; // tjc: remove after snapshot + // NB: transitionary, de-mode-ing. // XXX: Can't do this because frame_address needs a deprecated mode. //#[forbid(deprecated_mode)]; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index e8a88f3bc1b..cf996a8b254 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -175,7 +175,7 @@ pub fn push_str(lhs: &const ~str, rhs: &str) { /// Concatenate two strings together #[inline(always)] -pub pure fn append(+lhs: ~str, rhs: &str) -> ~str { +pub pure fn append(lhs: ~str, rhs: &str) -> ~str { let mut v <- lhs; unsafe { push_str_no_overallocate(&mut v, rhs); diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 9f13a6c2207..12329616fbf 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -83,7 +83,7 @@ pub pure fn pref_align_of() -> uint { /// Returns the refcount of a shared box (as just before calling this) #[inline(always)] -pub pure fn refcount(+t: @T) -> uint { +pub pure fn refcount(t: @T) -> uint { unsafe { let ref_ptr: *uint = cast::reinterpret_cast(&t); *ref_ptr - 1 diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 912b7f712aa..5ca35a7f562 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -1,5 +1,5 @@ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; /*! @@ -232,7 +232,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, }) @@ -347,7 +347,7 @@ impl TaskBuilder { * # Failure * Fails if a future_result was already set for this task. */ - fn future_result(blk: fn(+v: future::Future)) -> TaskBuilder { + fn future_result(blk: fn(v: future::Future)) -> TaskBuilder { // FIXME (#1087, #1857): Once linked failure and notification are // handled in the library, I can imagine implementing this by just // registering an arbitrary number of task::on_exit handlers and @@ -459,9 +459,9 @@ 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|{ + do self.spawn |move arg, move f| { f(option::swap_unwrap(arg)) } } @@ -473,7 +473,7 @@ impl TaskBuilder { * child task, passes the port to child's body, and returns a channel * linked to the port to the parent. * - * This encapsulates Some boilerplate handshaking logic that would + * This encapsulates some boilerplate handshaking logic that would * otherwise be required to establish communication from the parent * to the child. */ @@ -1149,7 +1149,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(); }); @@ -1167,7 +1167,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/local_data.rs b/src/libcore/task/local_data.rs index eda76518001..2130354229a 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -37,7 +37,7 @@ use local_data_priv::{ * * These two cases aside, the interface is safe. */ -pub type LocalDataKey = &fn(+v: @T); +pub type LocalDataKey = &fn(v: @T); /** * Remove a task-local data value from the table, returning the @@ -62,7 +62,7 @@ pub unsafe fn local_data_get( * that value is overwritten (and its destructor is run). */ pub unsafe fn local_data_set( - key: LocalDataKey, +data: @T) { + key: LocalDataKey, data: @T) { local_set(rt::rust_get_task(), key, data) } @@ -79,7 +79,7 @@ pub unsafe fn local_data_modify( #[test] pub fn test_tls_multitask() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_set(my_key, @~"parent data"); do task::spawn unsafe { assert local_data_get(my_key).is_none(); // TLS shouldn't carry over. @@ -95,7 +95,7 @@ pub fn test_tls_multitask() unsafe { #[test] pub fn test_tls_overwrite() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_set(my_key, @~"first data"); local_data_set(my_key, @~"next data"); // Shouldn't leak. assert *(local_data_get(my_key).get()) == ~"next data"; @@ -103,7 +103,7 @@ pub fn test_tls_overwrite() unsafe { #[test] pub fn test_tls_pop() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_set(my_key, @~"weasel"); assert *(local_data_pop(my_key).get()) == ~"weasel"; // Pop must remove the data from the map. @@ -112,7 +112,7 @@ pub fn test_tls_pop() unsafe { #[test] pub fn test_tls_modify() unsafe { - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } local_data_modify(my_key, |data| { match data { Some(@ref val) => fail ~"unwelcome value: " + *val, @@ -136,7 +136,7 @@ pub fn test_tls_crust_automorestack_memorial_bug() unsafe { // jump over to the rust stack, which causes next_c_sp to get recorded as // Something within a rust stack segment. Then a subsequent upcall (esp. // for logging, think vsnprintf) would run on a stack smaller than 1 MB. - fn my_key(+_x: @~str) { } + fn my_key(_x: @~str) { } do task::spawn { unsafe { local_data_set(my_key, @~"hax"); } } @@ -144,9 +144,9 @@ pub fn test_tls_crust_automorestack_memorial_bug() unsafe { #[test] pub fn test_tls_multiple_types() unsafe { - fn str_key(+_x: @~str) { } - fn box_key(+_x: @@()) { } - fn int_key(+_x: @int) { } + fn str_key(_x: @~str) { } + fn box_key(_x: @@()) { } + fn int_key(_x: @int) { } do task::spawn unsafe { local_data_set(str_key, @~"string data"); local_data_set(box_key, @@()); @@ -156,9 +156,9 @@ pub fn test_tls_multiple_types() unsafe { #[test] pub fn test_tls_overwrite_multiple_types() { - fn str_key(+_x: @~str) { } - fn box_key(+_x: @@()) { } - fn int_key(+_x: @int) { } + fn str_key(_x: @~str) { } + fn box_key(_x: @@()) { } + fn int_key(_x: @int) { } do task::spawn unsafe { local_data_set(str_key, @~"string data"); local_data_set(int_key, @42); @@ -172,9 +172,9 @@ pub fn test_tls_overwrite_multiple_types() { #[should_fail] #[ignore(cfg(windows))] pub fn test_tls_cleanup_on_failure() unsafe { - fn str_key(+_x: @~str) { } - fn box_key(+_x: @@()) { } - fn int_key(+_x: @int) { } + fn str_key(_x: @~str) { } + fn box_key(_x: @@()) { } + fn int_key(_x: @int) { } local_data_set(str_key, @~"parent data"); local_data_set(box_key, @@()); do task::spawn unsafe { // spawn_linked diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 0d3007286c5..499dd073060 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -117,7 +117,7 @@ unsafe fn local_get( } unsafe fn local_set( - task: *rust_task, key: LocalDataKey, +data: @T) { + task: *rust_task, key: LocalDataKey, data: @T) { let map = get_task_local_map(task); // Store key+data as *voids. Data is invisibly referenced once; key isn't. diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 982679f9398..786255fe7fa 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -82,7 +82,7 @@ fn taskset_remove(tasks: &mut TaskSet, task: *rust_task) { let was_present = tasks.remove(&task); assert was_present; } -fn taskset_each(tasks: &TaskSet, blk: fn(+v: *rust_task) -> bool) { +fn taskset_each(tasks: &TaskSet, blk: fn(v: *rust_task) -> bool) { tasks.each_key(|k| blk(*k)) } @@ -303,8 +303,8 @@ struct TCB { } } -fn TCB(me: *rust_task, +tasks: TaskGroupArc, +ancestors: AncestorList, - is_main: bool, +notifier: Option) -> TCB { +fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList, + is_main: bool, notifier: Option) -> TCB { let notifier = move notifier; notifier.iter(|x| { x.failed = false; }); @@ -327,7 +327,7 @@ struct AutoNotify { } } -fn AutoNotify(+chan: Chan) -> AutoNotify { +fn AutoNotify(chan: Chan) -> AutoNotify { AutoNotify { notify_chan: chan, failed: true // Un-set above when taskgroup successfully made. @@ -377,13 +377,13 @@ fn kill_taskgroup(state: TaskGroupInner, me: *rust_task, is_main: bool) { // see 'None' if Somebody already failed and we got a kill signal.) if newstate.is_some() { let group = option::unwrap(move newstate); - for taskset_each(&group.members) |+sibling| { + for taskset_each(&group.members) |sibling| { // Skip self - killing ourself won't do much good. if sibling != me { rt::rust_task_kill_other(sibling); } } - for taskset_each(&group.descendants) |+child| { + for taskset_each(&group.descendants) |child| { assert child != me; rt::rust_task_kill_other(child); } @@ -486,7 +486,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) } } -fn spawn_raw(+opts: TaskOpts, +f: fn~()) { +fn spawn_raw(opts: TaskOpts, +f: fn~()) { let (child_tg, ancestors, is_main) = gen_child_taskgroup(opts.linked, opts.supervised); @@ -528,9 +528,9 @@ fn spawn_raw(+opts: TaskOpts, +f: fn~()) { // (3a) If any of those fails, it leaves all groups, and does nothing. // (3b) Otherwise it builds a task control structure and puts it in TLS, // (4) ...and runs the provided body function. - fn make_child_wrapper(child: *rust_task, +child_arc: TaskGroupArc, - +ancestors: AncestorList, is_main: bool, - +notify_chan: Option>, + fn make_child_wrapper(child: *rust_task, child_arc: TaskGroupArc, + ancestors: AncestorList, is_main: bool, + notify_chan: Option>, +f: fn~()) -> fn~() { let child_data = ~mut Some((move child_arc, move ancestors)); return fn~(move notify_chan, move child_data, move f) { diff --git a/src/libcore/util.rs b/src/libcore/util.rs index 9ba8b52f5da..aa1fe14ba88 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -5,25 +5,25 @@ Miscellaneous helpers for common patterns. */ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use cmp::Eq; /// The identity function. #[inline(always)] -pub pure fn id(+x: T) -> T { move x } +pub pure fn id(x: T) -> T { move x } /// Ignores a value. #[inline(always)] -pub pure fn ignore(+_x: T) { } +pub pure fn ignore(_x: T) { } /// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the /// original value of `*ptr`. #[inline(always)] pub fn with( ptr: &mut T, - +new_value: T, + new_value: T, op: &fn() -> R) -> R { // NDM: if swap operator were defined somewhat differently, @@ -50,7 +50,7 @@ pub fn swap(x: &mut T, y: &mut T) { * value, without deinitialising or copying either one. */ #[inline(always)] -pub fn replace(dest: &mut T, +src: T) -> T { +pub fn replace(dest: &mut T, src: T) -> T { let mut tmp <- src; swap(dest, &mut tmp); move tmp diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index ce82215a87c..0c822bd0a03 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -47,7 +47,7 @@ pub pure fn same_length(xs: &[const T], ys: &[const U]) -> bool { * * v - A vector * * n - The number of elements to reserve space for */ -pub fn reserve(+v: &mut ~[T], +n: uint) { +pub fn reserve(v: &mut ~[T], n: uint) { // Only make the (slow) call into the runtime if we have to if capacity(v) < n { unsafe { @@ -119,7 +119,7 @@ pub pure fn from_fn(n_elts: uint, op: iter::InitOp) -> ~[T] { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value `t`. */ -pub pure fn from_elem(n_elts: uint, +t: T) -> ~[T] { +pub pure fn from_elem(n_elts: uint, t: T) -> ~[T] { from_fn(n_elts, |_i| copy t) } @@ -148,9 +148,9 @@ pub pure fn with_capacity(capacity: uint) -> ~[T] { */ #[inline(always)] pub pure fn build_sized(size: uint, - builder: fn(push: pure fn(+v: A))) -> ~[A] { + builder: fn(push: pure fn(v: A))) -> ~[A] { let mut vec = with_capacity(size); - builder(|+x| unsafe { vec.push(move x) }); + builder(|x| unsafe { vec.push(move x) }); move vec } @@ -165,7 +165,7 @@ pub pure fn build_sized(size: uint, * onto the vector being constructed. */ #[inline(always)] -pub pure fn build(builder: fn(push: pure fn(+v: A))) -> ~[A] { +pub pure fn build(builder: fn(push: pure fn(v: A))) -> ~[A] { build_sized(4, builder) } @@ -183,17 +183,17 @@ pub pure fn build(builder: fn(push: pure fn(+v: A))) -> ~[A] { */ #[inline(always)] pub pure fn build_sized_opt(size: Option, - builder: fn(push: pure fn(+v: A))) -> ~[A] { + builder: fn(push: pure fn(v: A))) -> ~[A] { build_sized(size.get_default(4), builder) } /// Produces a mut vector from an immutable vector. -pub pure fn to_mut(+v: ~[T]) -> ~[mut T] { +pub pure fn to_mut(v: ~[T]) -> ~[mut T] { unsafe { ::cast::transmute(move v) } } /// Produces an immutable vector from a mut vector. -pub pure fn from_mut(+v: ~[mut T]) -> ~[T] { +pub pure fn from_mut(v: ~[mut T]) -> ~[T] { unsafe { ::cast::transmute(move v) } } @@ -412,13 +412,13 @@ pub fn shift(v: &mut ~[T]) -> T { } /// Prepend an element to the vector -pub fn unshift(v: &mut ~[T], +x: T) { +pub fn unshift(v: &mut ~[T], x: T) { let mut vv = ~[move x]; *v <-> vv; v.push_all_move(vv); } -pub fn consume(+v: ~[T], f: fn(uint, +v: T)) unsafe { +pub fn consume(v: ~[T], f: fn(uint, v: T)) unsafe { let mut v = move v; // FIXME(#3488) do as_imm_buf(v) |p, ln| { @@ -431,7 +431,7 @@ pub fn consume(+v: ~[T], f: fn(uint, +v: T)) unsafe { raw::set_len(&mut v, 0); } -pub fn consume_mut(+v: ~[mut T], f: fn(uint, +v: T)) { +pub fn consume_mut(v: ~[mut T], f: fn(uint, v: T)) { consume(vec::from_mut(v), f) } @@ -468,7 +468,7 @@ pub fn swap_remove(v: &mut ~[T], index: uint) -> T { /// Append an element to a vector #[inline(always)] -pub fn push(v: &mut ~[T], +initval: T) { +pub fn push(v: &mut ~[T], initval: T) { unsafe { let repr: **raw::VecRepr = ::cast::transmute(copy v); let fill = (**repr).unboxed.fill; @@ -483,7 +483,7 @@ pub fn push(v: &mut ~[T], +initval: T) { // This doesn't bother to make sure we have space. #[inline(always)] // really pretty please -unsafe fn push_fast(+v: &mut ~[T], +initval: T) { +unsafe fn push_fast(v: &mut ~[T], initval: T) { let repr: **raw::VecRepr = ::cast::transmute(v); let fill = (**repr).unboxed.fill; (**repr).unboxed.fill += sys::size_of::(); @@ -493,13 +493,13 @@ unsafe fn push_fast(+v: &mut ~[T], +initval: T) { } #[inline(never)] -fn push_slow(+v: &mut ~[T], +initval: T) { +fn push_slow(v: &mut ~[T], initval: T) { reserve_at_least(v, v.len() + 1u); unsafe { push_fast(v, move initval) } } #[inline(always)] -pub fn push_all(+v: &mut ~[T], rhs: &[const T]) { +pub fn push_all(v: &mut ~[T], rhs: &[const T]) { reserve(v, v.len() + rhs.len()); for uint::range(0u, rhs.len()) |i| { @@ -508,7 +508,7 @@ pub fn push_all(+v: &mut ~[T], rhs: &[const T]) { } #[inline(always)] -pub fn push_all_move(v: &mut ~[T], +rhs: ~[T]) { +pub fn push_all_move(v: &mut ~[T], rhs: ~[T]) { let mut rhs = move rhs; // FIXME(#3488) reserve(v, v.len() + rhs.len()); unsafe { @@ -573,7 +573,7 @@ pub fn dedup(v: &mut ~[T]) unsafe { // Appending #[inline(always)] -pub pure fn append(+lhs: ~[T], rhs: &[const T]) -> ~[T] { +pub pure fn append(lhs: ~[T], rhs: &[const T]) -> ~[T] { let mut v <- lhs; unsafe { v.push_all(rhs); @@ -582,14 +582,14 @@ pub pure fn append(+lhs: ~[T], rhs: &[const T]) -> ~[T] { } #[inline(always)] -pub pure fn append_one(+lhs: ~[T], +x: T) -> ~[T] { +pub pure fn append_one(lhs: ~[T], x: T) -> ~[T] { let mut v <- lhs; unsafe { v.push(move x); } move v } #[inline(always)] -pure fn append_mut(+lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] { +pure fn append_mut(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] { to_mut(append(from_mut(lhs), rhs)) } @@ -642,7 +642,7 @@ pub fn grow_fn(v: &mut ~[T], n: uint, op: iter::InitOp) { * of the vector, expands the vector by replicating `initval` to fill the * intervening space. */ -pub fn grow_set(v: &mut ~[T], index: uint, initval: &T, +val: T) { +pub fn grow_set(v: &mut ~[T], index: uint, initval: &T, val: T) { let l = v.len(); if index >= l { grow(v, index - l + 1u, initval); } v[index] = move val; @@ -661,7 +661,7 @@ pub pure fn map(v: &[T], f: fn(t: &T) -> U) -> ~[U] { move result } -pub fn map_consume(+v: ~[T], f: fn(+v: T) -> U) -> ~[U] { +pub fn map_consume(v: ~[T], f: fn(v: T) -> U) -> ~[U] { let mut result = ~[]; do consume(move v) |_i, x| { result.push(f(move x)); @@ -758,7 +758,7 @@ pub pure fn connect(v: &[~[T]], sep: &T) -> ~[T] { } /// Reduce a vector from left to right -pub pure fn foldl(+z: T, v: &[U], p: fn(+t: T, u: &U) -> T) -> T { +pub pure fn foldl(z: T, v: &[U], p: fn(t: T, u: &U) -> T) -> T { let mut accum = z; for each(v) |elt| { // it should be possible to move accum in, but the liveness analysis @@ -769,7 +769,7 @@ pub pure fn foldl(+z: T, v: &[U], p: fn(+t: T, u: &U) -> T) -> T { } /// Reduce a vector from right to left -pub pure fn foldr(v: &[T], +z: U, p: fn(t: &T, +u: U) -> U) -> U { +pub pure fn foldr(v: &[T], z: U, p: fn(t: &T, u: U) -> U) -> U { let mut accum = z; for rev_each(v) |elt| { accum = p(elt, accum); @@ -992,7 +992,7 @@ pure fn unzip_slice(v: &[(T, U)]) -> (~[T], ~[U]) { * and the i-th element of the second vector contains the second element * of the i-th tuple of the input vector. */ -pub pure fn unzip(+v: ~[(T, U)]) -> (~[T], ~[U]) { +pub pure fn unzip(v: ~[(T, U)]) -> (~[T], ~[U]) { let mut ts = ~[], us = ~[]; unsafe { do consume(move v) |_i, p| { @@ -1023,7 +1023,7 @@ pub pure fn zip_slice(v: &[const T], u: &[const U]) * Returns a vector of tuples, where the i-th tuple contains contains the * i-th elements from each of the input vectors. */ -pub pure fn zip(+v: ~[T], +u: ~[U]) -> ~[(T, U)] { +pub pure fn zip(v: ~[T], u: ~[U]) -> ~[(T, U)] { let mut v = move v, u = move u; // FIXME(#3488) let mut i = len(v); assert i == len(u); @@ -1190,7 +1190,7 @@ pub fn each2(v1: &[U], v2: &[T], f: fn(u: &U, t: &T) -> bool) { * The total number of permutations produced is `len(v)!`. If `v` contains * repeated elements, then some permutations are repeated. */ -pure fn each_permutation(+v: &[T], put: fn(ts: &[T]) -> bool) { +pure fn each_permutation(v: &[T], put: fn(ts: &[T]) -> bool) { let ln = len(v); if ln <= 1 { put(v); @@ -1435,7 +1435,7 @@ impl &[const T]: CopyableVector { pub trait ImmutableVector { pure fn view(start: uint, end: uint) -> &self/[T]; - pure fn foldr(+z: U, p: fn(t: &T, +u: U) -> U) -> U; + pure fn foldr(z: U, p: fn(t: &T, u: U) -> U) -> U; pure fn map(f: fn(t: &T) -> U) -> ~[U]; pure fn mapi(f: fn(uint, t: &T) -> U) -> ~[U]; fn map_r(f: fn(x: &T) -> U) -> ~[U]; @@ -1459,7 +1459,7 @@ impl &[T]: ImmutableVector { } /// Reduce a vector from right to left #[inline] - pure fn foldr(+z: U, p: fn(t: &T, +u: U) -> U) -> U { + pure fn foldr(z: U, p: fn(t: &T, u: U) -> U) -> U { foldr(self, z, p) } /// Apply a function to each element of a vector and return the results @@ -1582,11 +1582,11 @@ impl &[T]: ImmutableCopyableVector { } pub trait MutableVector { - fn push(&mut self, +t: T); - fn push_all_move(&mut self, +rhs: ~[T]); + fn push(&mut self, t: T); + fn push_all_move(&mut self, rhs: ~[T]); fn pop(&mut self) -> T; fn shift(&mut self) -> T; - fn unshift(&mut self, +x: T); + fn unshift(&mut self, x: T); fn swap_remove(&mut self, index: uint) -> T; fn truncate(&mut self, newlen: uint); } @@ -1595,7 +1595,7 @@ pub trait MutableCopyableVector { fn push_all(&mut self, rhs: &[const T]); fn grow(&mut self, n: uint, initval: &T); fn grow_fn(&mut self, n: uint, op: iter::InitOp); - fn grow_set(&mut self, index: uint, initval: &T, +val: T); + fn grow_set(&mut self, index: uint, initval: &T, val: T); } trait MutableEqVector { @@ -1603,11 +1603,11 @@ trait MutableEqVector { } impl ~[T]: MutableVector { - fn push(&mut self, +t: T) { + fn push(&mut self, t: T) { push(self, move t); } - fn push_all_move(&mut self, +rhs: ~[T]) { + fn push_all_move(&mut self, rhs: ~[T]) { push_all_move(self, move rhs); } @@ -1619,7 +1619,7 @@ impl ~[T]: MutableVector { shift(self) } - fn unshift(&mut self, +x: T) { + fn unshift(&mut self, x: T) { unshift(self, x) } @@ -1645,7 +1645,7 @@ impl ~[T]: MutableCopyableVector { grow_fn(self, n, op); } - fn grow_set(&mut self, index: uint, initval: &T, +val: T) { + fn grow_set(&mut self, index: uint, initval: &T, val: T) { grow_set(self, index, initval, val); } } @@ -1717,21 +1717,21 @@ pub mod raw { * would also make any pointers to it invalid. */ #[inline(always)] - pub unsafe fn to_ptr(+v: &[T]) -> *T { + pub unsafe fn to_ptr(v: &[T]) -> *T { let repr: **SliceRepr = ::cast::transmute(&v); return ::cast::reinterpret_cast(&addr_of(&((**repr).data))); } /** see `to_ptr()` */ #[inline(always)] - pub unsafe fn to_const_ptr(+v: &[const T]) -> *const T { + pub unsafe fn to_const_ptr(v: &[const T]) -> *const T { let repr: **SliceRepr = ::cast::transmute(&v); return ::cast::reinterpret_cast(&addr_of(&((**repr).data))); } /** see `to_ptr()` */ #[inline(always)] - pub unsafe fn to_mut_ptr(+v: &[mut T]) -> *mut T { + pub unsafe fn to_mut_ptr(v: &[mut T]) -> *mut T { let repr: **SliceRepr = ::cast::transmute(&v); return ::cast::reinterpret_cast(&addr_of(&((**repr).data))); } @@ -1764,7 +1764,7 @@ pub mod raw { * is newly allocated. */ #[inline(always)] - pub unsafe fn init_elem(v: &[mut T], i: uint, +val: T) { + pub unsafe fn init_elem(v: &[mut T], i: uint, val: T) { let mut box = Some(move val); do as_mut_buf(v) |p, _len| { let mut box2 = None; @@ -1896,7 +1896,7 @@ impl &[A]: iter::ExtendedIter { } pub pure fn all(blk: fn(&A) -> bool) -> bool { iter::all(&self, blk) } pub pure fn any(blk: fn(&A) -> bool) -> bool { iter::any(&self, blk) } - pub pure fn foldl(+b0: B, blk: fn(&B, &A) -> B) -> B { + pub pure fn foldl(b0: B, blk: fn(&B, &A) -> B) -> B { iter::foldl(&self, move b0, blk) } pub pure fn position(f: fn(&A) -> bool) -> Option { @@ -1910,10 +1910,10 @@ impl &[A]: iter::EqIter { } impl &[A]: iter::CopyableIter { - pure fn filter_to_vec(pred: fn(+a: A) -> bool) -> ~[A] { + pure fn filter_to_vec(pred: fn(a: A) -> bool) -> ~[A] { iter::filter_to_vec(&self, pred) } - pure fn map_to_vec(op: fn(+v: A) -> B) -> ~[B] { + pure fn map_to_vec(op: fn(v: A) -> B) -> ~[B] { iter::map_to_vec(&self, op) } pure fn to_vec() -> ~[A] { iter::to_vec(&self) } @@ -1923,7 +1923,7 @@ impl &[A]: iter::CopyableIter { // iter::flat_map_to_vec(self, op) // } - pub pure fn find(p: fn(+a: A) -> bool) -> Option { + pub pure fn find(p: fn(a: A) -> bool) -> Option { iter::find(&self, p) } } @@ -1951,7 +1951,7 @@ mod tests { return if *n % 2u == 1u { Some(*n * *n) } else { None }; } - fn add(+x: uint, y: &uint) -> uint { return x + *y; } + fn add(x: uint, y: &uint) -> uint { return x + *y; } #[test] fn test_unsafe_ptrs() { @@ -2193,7 +2193,7 @@ mod tests { #[test] fn test_dedup() { - fn case(+a: ~[uint], +b: ~[uint]) { + fn case(a: ~[uint], b: ~[uint]) { let mut v = a; v.dedup(); assert(v == b); @@ -2323,7 +2323,7 @@ mod tests { #[test] fn test_foldl2() { - fn sub(+a: int, b: &int) -> int { + fn sub(a: int, b: &int) -> int { a - *b } let mut v = ~[1, 2, 3, 4]; @@ -2333,7 +2333,7 @@ mod tests { #[test] fn test_foldr() { - fn sub(a: &int, +b: int) -> int { + fn sub(a: &int, b: int) -> int { *a - b } let mut v = ~[1, 2, 3, 4]; diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index a04eadb7732..67bbff7fb6a 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -232,7 +232,7 @@ type Result = result::Result; */ 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/net_tcp.rs b/src/libstd/net_tcp.rs index aedd53d41cc..59cb0d36f77 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -763,7 +763,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); @@ -799,13 +799,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 } @@ -827,7 +827,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 } diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 00226c4e81e..920751d690f 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -735,7 +735,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/rope.rs b/src/libstd/rope.rs index 647560099e9..d14a4854555 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -379,7 +379,7 @@ Section: Iterating * `true` If execution proceeded correctly, `false` if it was interrupted, * that is if `it` returned `false` at any point. */ -pub fn loop_chars(rope: Rope, it: fn(char) -> bool) -> bool { +pub fn loop_chars(rope: Rope, it: fn(+c: char) -> bool) -> bool { match (rope) { node::Empty => return true, node::Content(x) => return node::loop_chars(x, it) @@ -1037,7 +1037,7 @@ mod node { return result; } - pub fn loop_chars(node: @Node, it: fn(char) -> bool) -> bool { + pub fn loop_chars(node: @Node, it: fn(+c: char) -> bool) -> bool { return loop_leaves(node,|leaf| { str::all_between(*leaf.content, leaf.byte_offset, diff --git a/src/libstd/std.rc b/src/libstd/std.rc index aa26c4af29c..95af018e35a 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -18,6 +18,9 @@ not required in or otherwise suitable for the core library. #[no_core]; +// tjc: Added legacy_modes back in because it still uses + mode. +// Remove once + mode gets expunged from std. +#[legacy_modes]; #[legacy_exports]; #[allow(vecs_implicitly_copyable)]; diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs index ebdc66156e3..0f31f2056a1 100644 --- a/src/rustc/middle/lint.rs +++ b/src/rustc/middle/lint.rs @@ -683,8 +683,12 @@ fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl, mode_to_str(arg_ast.mode)); match arg_ast.mode { ast::expl(ast::by_copy) => { - // This should warn, but we can't yet - // since it's still used. -- tjc + if !tcx.legacy_modes { + tcx.sess.span_lint( + deprecated_mode, id, id, span, + fmt!("argument %d uses by-copy mode", + counter)); + } } ast::expl(_) => { diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index a34fcc89c04..f35a3ce735f 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -251,7 +251,7 @@ fn pbfs(&&graph: arc::ARC, key: node_id) -> bfs_result { colors = do par::mapi_factory(*color_vec) { let colors = arc::clone(&color); let graph = arc::clone(&graph); - fn~(+i: uint, +c: color) -> color { + fn~(i: uint, c: color) -> color { let c : color = c; let colors = arc::get(&colors); let graph = arc::get(&graph);