diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-09-07 14:52:28 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-07 18:10:11 -0700 |
| commit | 3bd1f32cd945fab63777b71ef76f23d758e2904c (patch) | |
| tree | 8035a0aa8bf9fa926484604074427146ec295b1d | |
| parent | 07fe5611ade0e02109a5fa72881c6cd43bacbb29 (diff) | |
| download | rust-3bd1f32cd945fab63777b71ef76f23d758e2904c.tar.gz rust-3bd1f32cd945fab63777b71ef76f23d758e2904c.zip | |
Convert all kind bounds to camel case. Remove send, owned keywords.
167 files changed, 613 insertions, 622 deletions
diff --git a/doc/rust.md b/doc/rust.md index d16c2a6c072..eeedc7473a0 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -449,7 +449,7 @@ Two examples of paths with type arguments: ~~~~ # use std::map; # fn f() { -# fn id<T:copy>(t: T) -> T { t } +# fn id<T:Copy>(t: T) -> T { t } type t = map::hashmap<int,~str>; // Type arguments used in a type expression let x = id::<int>(10); // Type arguments used in a call expression # } @@ -1056,7 +1056,7 @@ An example of a pure function that uses an unchecked block: ~~~~ # use std::list::*; -fn pure_foldl<T, U: copy>(ls: List<T>, u: U, f: fn(&&T, &&U) -> U) -> U { +fn pure_foldl<T, U: Copy>(ls: List<T>, u: U, f: fn(&&T, &&U) -> U) -> U { match ls { Nil => u, Cons(hd, tl) => f(hd, pure_foldl(*tl, f(hd, u), f)) @@ -1110,7 +1110,7 @@ type can always be moved, but they can only be copied when the parameter is given a [`copy` bound](#type-kinds). ~~~~ -fn id<T: copy>(x: T) -> T { x } +fn id<T: Copy>(x: T) -> T { x } ~~~~ Similarly, [trait](#traits) bounds can be specified for type @@ -2638,7 +2638,7 @@ Every struct item defines a type. Within the body of an item that has type parameter declarations, the names of its type parameters are types: ~~~~~~~ -fn map<A: copy, B: copy>(f: fn(A) -> B, xs: ~[A]) -> ~[B] { +fn map<A: Copy, B: Copy>(f: fn(A) -> B, xs: ~[A]) -> ~[B] { if xs.len() == 0 { return ~[]; } let first: B = f(xs[0]); let rest: ~[B] = map(f, xs.slice(1, xs.len())); @@ -2706,7 +2706,7 @@ Putting `x` into a shared box involves copying, and the `T` parameter is assumed to be noncopyable. To change that, a bound is declared: ~~~~ -fn box<T: copy>(x: T) -> @T { @x } +fn box<T: Copy>(x: T) -> @T { @x } ~~~~ Calling this second version of `box` on a noncopyable type is not diff --git a/doc/tutorial.md b/doc/tutorial.md index 8234a8f7518..25531e59759 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1583,20 +1583,20 @@ unless you explicitly declare that type parameter to have copyable // This does not compile fn head_bad<T>(v: ~[T]) -> T { v[0] } // This does -fn head<T: copy>(v: ~[T]) -> T { v[0] } +fn head<T: Copy>(v: ~[T]) -> T { v[0] } ~~~~ When instantiating a generic function, you can only instantiate it with types that fit its kinds. So you could not apply `head` to a resource type. Rust has several kinds that can be used as type bounds: -* `copy` - Copyable types. All types are copyable unless they +* `Copy` - Copyable types. All types are copyable unless they are classes with destructors or otherwise contain classes with destructors. -* `send` - Sendable types. All types are sendable unless they +* `Send` - Sendable types. All types are sendable unless they contain shared boxes, closures, or other local-heap-allocated types. -* `const` - Constant types. These are types that do not contain +* `Const` - Constant types. These are types that do not contain mutable fields nor shared boxes. > ***Note:*** Rust type kinds are syntactically very similar to @@ -2002,7 +2002,7 @@ and one for values. This means that this code is valid: ~~~~ mod buffalo { type buffalo = int; - fn buffalo<buffalo: copy>(buffalo: buffalo) -> buffalo { buffalo } + fn buffalo<buffalo>(+buffalo: buffalo) -> buffalo { buffalo } } fn main() { let buffalo: buffalo::buffalo = 1; diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs index 0f9df3c98e4..c4dd4bcf4bc 100644 --- a/src/fuzzer/fuzzer.rs +++ b/src/fuzzer/fuzzer.rs @@ -239,7 +239,7 @@ fn check_variants_of_ast(crate: ast::crate, codemap: codemap::codemap, pprust::ty_to_str, replace_ty_in_crate, cx); } -fn check_variants_T<T: copy>( +fn check_variants_T<T: Copy>( crate: ast::crate, codemap: codemap::codemap, filename: &Path, diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 4cf0b8f332d..717993e78c1 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -89,7 +89,7 @@ pure fn build_sized_opt<A>(size: Option<uint>, // Appending #[inline(always)] -pure fn append<T: copy>(lhs: @[T], rhs: &[const T]) -> @[T] { +pure fn append<T: Copy>(lhs: @[T], rhs: &[const T]) -> @[T] { do build_sized(lhs.len() + rhs.len()) |push| { for vec::each(lhs) |x| { push(x); } for uint::range(0, rhs.len()) |i| { push(rhs[i]); } @@ -125,7 +125,7 @@ pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value `t`. */ -pure fn from_elem<T: copy>(n_elts: uint, t: T) -> @[T] { +pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] { do build_sized(n_elts) |push| { let mut i: uint = 0u; while i < n_elts { push(t); i += 1u; } @@ -133,7 +133,7 @@ pure fn from_elem<T: copy>(n_elts: uint, t: T) -> @[T] { } #[cfg(notest)] -impl<T: copy> @[T]: Add<&[const T],@[T]> { +impl<T: Copy> @[T]: Add<&[const T],@[T]> { #[inline(always)] pure fn add(rhs: &[const T]) -> @[T] { append(self, rhs) diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index f9d68975944..177ecdca9a2 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -48,7 +48,7 @@ export listen; * transmitted. If a port value is copied, both copies refer to the same * port. Ports may be associated with multiple `chan`s. */ -enum Port<T: send> { +enum Port<T: Send> { Port_(@PortPtr<T>) } @@ -64,16 +64,16 @@ enum Port<T: send> { * data will be silently dropped. Channels may be duplicated and * themselves transmitted over other channels. */ -enum Chan<T: send> { +enum Chan<T: Send> { Chan_(port_id) } /// Constructs a port -fn Port<T: send>() -> Port<T> { +fn Port<T: Send>() -> Port<T> { Port_(@PortPtr(rustrt::new_port(sys::size_of::<T>() as size_t))) } -impl<T: send> Port<T> { +impl<T: Send> Port<T> { fn chan() -> Chan<T> { Chan(self) } fn send(+v: T) { self.chan().send(v) } @@ -82,7 +82,7 @@ impl<T: send> Port<T> { } -impl<T: send> Chan<T> { +impl<T: Send> Chan<T> { fn chan() -> Chan<T> { self } fn send(+v: T) { send(self, v) } @@ -92,12 +92,12 @@ impl<T: send> Chan<T> { } /// Open a new receiving channel for the duration of a function -fn listen<T: send, U>(f: fn(Chan<T>) -> U) -> U { +fn listen<T: Send, U>(f: fn(Chan<T>) -> U) -> U { let po = Port(); f(po.chan()) } -struct PortPtr<T:send> { +struct PortPtr<T:Send> { po: *rust_port, drop unsafe { do task::unkillable { @@ -121,7 +121,7 @@ struct PortPtr<T:send> { } } -fn PortPtr<T: send>(po: *rust_port) -> PortPtr<T> { +fn PortPtr<T: Send>(po: *rust_port) -> PortPtr<T> { PortPtr { po: po } @@ -135,7 +135,7 @@ fn PortPtr<T: send>(po: *rust_port) -> PortPtr<T> { * Fails if the port is detached or dead. Fails if the port * is owned by a different task. */ -fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U { +fn as_raw_port<T: Send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U { struct PortRef { p: *rust_port, @@ -167,7 +167,7 @@ fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U { * Constructs a channel. The channel is bound to the port used to * construct it. */ -fn Chan<T: send>(p: Port<T>) -> Chan<T> { +fn Chan<T: Send>(p: Port<T>) -> Chan<T> { Chan_(rustrt::get_port_id((**p).po)) } @@ -175,7 +175,7 @@ fn Chan<T: send>(p: Port<T>) -> Chan<T> { * Sends data over a channel. The sent data is moved into the channel, * whereupon the caller loses access to it. */ -fn send<T: send>(ch: Chan<T>, +data: T) { +fn send<T: Send>(ch: Chan<T>, +data: T) { let Chan_(p) = ch; let data_ptr = ptr::addr_of(data) as *(); let res = rustrt::rust_port_id_send(p, data_ptr); @@ -190,22 +190,22 @@ fn send<T: send>(ch: Chan<T>, +data: T) { * Receive from a port. If no data is available on the port then the * task will block until data becomes available. */ -fn recv<T: send>(p: Port<T>) -> T { recv_((**p).po) } +fn recv<T: Send>(p: Port<T>) -> T { recv_((**p).po) } /// Returns true if there are messages available -fn peek<T: send>(p: Port<T>) -> bool { peek_((**p).po) } +fn peek<T: Send>(p: Port<T>) -> bool { peek_((**p).po) } #[doc(hidden)] -fn recv_chan<T: send>(ch: comm::Chan<T>) -> T { +fn recv_chan<T: Send>(ch: comm::Chan<T>) -> T { as_raw_port(ch, |x|recv_(x)) } -fn peek_chan<T: send>(ch: comm::Chan<T>) -> bool { +fn peek_chan<T: Send>(ch: comm::Chan<T>) -> bool { as_raw_port(ch, |x|peek_(x)) } /// Receive on a raw port pointer -fn recv_<T: send>(p: *rust_port) -> T { +fn recv_<T: Send>(p: *rust_port) -> T { let yield = 0u; let yieldp = ptr::addr_of(yield); let mut res; @@ -231,7 +231,7 @@ fn peek_(p: *rust_port) -> bool { } /// Receive on one of two ports -fn select2<A: send, B: send>(p_a: Port<A>, p_b: Port<B>) +fn select2<A: Send, B: Send>(p_a: Port<A>, p_b: Port<B>) -> Either<A, B> { let ports = ~[(**p_a).po, (**p_b).po]; let yield = 0u, yieldp = ptr::addr_of(yield); diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index 1c56587434b..a1973c1d6ef 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -96,7 +96,7 @@ pure fn from_elem<T>(+data: T) -> DList<T> { list } -fn from_vec<T: copy>(+vec: &[T]) -> DList<T> { +fn from_vec<T: Copy>(+vec: &[T]) -> DList<T> { do vec::foldl(DList(), vec) |list,data| { list.push(data); // Iterating left-to-right -- add newly to the tail. list @@ -417,7 +417,7 @@ impl<T> DList<T> { } } -impl<T: copy> DList<T> { +impl<T: Copy> DList<T> { /// Remove data from the head of the list. O(1). fn pop() -> Option<T> { self.pop_n().map (|nobe| nobe.data) } /// Remove data from the tail of the list. O(1). diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 153fa69d4b8..41f88b72ca1 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -210,7 +210,7 @@ impl<A> DVec<A> { } } -impl<A: copy> DVec<A> { +impl<A: Copy> DVec<A> { /** * Append all elements of a vector to the end of the list * @@ -327,7 +327,7 @@ impl<A: copy> DVec<A> { } } -impl<A:copy> DVec<A>: Index<uint,A> { +impl<A:Copy> DVec<A>: Index<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 00706280ebc..bd68fab3b8e 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -29,7 +29,7 @@ fn either<T, U, V>(f_left: fn((&T)) -> V, } } -fn lefts<T: copy, U>(eithers: &[Either<T, U>]) -> ~[T] { +fn lefts<T: Copy, U>(eithers: &[Either<T, U>]) -> ~[T] { //! Extracts from a vector of either all the left values let mut result: ~[T] = ~[]; @@ -42,7 +42,7 @@ fn lefts<T: copy, U>(eithers: &[Either<T, U>]) -> ~[T] { return result; } -fn rights<T, U: copy>(eithers: &[Either<T, U>]) -> ~[U] { +fn rights<T, U: Copy>(eithers: &[Either<T, U>]) -> ~[U] { //! Extracts from a vector of either all the right values let mut result: ~[U] = ~[]; @@ -55,7 +55,7 @@ fn rights<T, U: copy>(eithers: &[Either<T, U>]) -> ~[U] { return result; } -fn partition<T: copy, U: copy>(eithers: &[Either<T, U>]) +fn partition<T: Copy, U: Copy>(eithers: &[Either<T, U>]) -> {lefts: ~[T], rights: ~[U]} { /*! * Extracts from a vector of either all the left values and right values @@ -75,7 +75,7 @@ fn partition<T: copy, U: copy>(eithers: &[Either<T, U>]) return {lefts: lefts, rights: rights}; } -pure fn flip<T: copy, U: copy>(eith: &Either<T, U>) -> Either<U, T> { +pure fn flip<T: Copy, U: Copy>(eith: &Either<T, U>) -> Either<U, T> { //! Flips between left and right of a given either match *eith { @@ -84,7 +84,7 @@ pure fn flip<T: copy, U: copy>(eith: &Either<T, U>) -> Either<U, T> { } } -pure fn to_result<T: copy, U: copy>(eith: &Either<T, U>) -> Result<U, T> { +pure fn to_result<T: Copy, U: Copy>(eith: &Either<T, U>) -> Result<U, T> { /*! * Converts either::t to a result::t * diff --git a/src/libcore/future.rs b/src/libcore/future.rs index cd0d2b25e95..141fafcf7d7 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -43,7 +43,7 @@ priv enum FutureState<A> { } /// Methods on the `future` type -impl<A:copy> Future<A> { +impl<A:Copy> Future<A> { fn get() -> A { //! Get the value of the future @@ -74,7 +74,7 @@ fn from_value<A>(+val: A) -> Future<A> { Future {state: Forced(val)} } -fn from_port<A:send>(+port: future_pipe::client::waiting<A>) -> Future<A> { +fn from_port<A:Send>(+port: future_pipe::client::waiting<A>) -> Future<A> { /*! * Create a future from a port * @@ -105,7 +105,7 @@ fn from_fn<A>(+f: @fn() -> A) -> Future<A> { Future {state: Pending(f)} } -fn spawn<A:send>(+blk: fn~() -> A) -> Future<A> { +fn spawn<A:Send>(+blk: fn~() -> A) -> Future<A> { /*! * Create a future from a unique closure. * @@ -156,7 +156,7 @@ fn get_ref<A>(future: &r/Future<A>) -> &r/A { } } -fn get<A:copy>(future: &Future<A>) -> A { +fn get<A:Copy>(future: &Future<A>) -> A { //! Get the value of the future *get_ref(future) @@ -169,7 +169,7 @@ fn with<A,B>(future: &Future<A>, blk: fn((&A)) -> B) -> B { } proto! future_pipe ( - waiting:recv<T:send> { + waiting:recv<T:Send> { completed(T) -> ! } ) diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index b3f31211340..d9e5f3a0aee 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -28,7 +28,7 @@ impl<A: Eq> IMPL_T<A>: iter::EqIter<A> { } } -impl<A: copy> IMPL_T<A>: iter::CopyableIter<A> { +impl<A: Copy> IMPL_T<A>: iter::CopyableIter<A> { pure fn filter_to_vec(pred: fn(A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } @@ -45,7 +45,7 @@ impl<A: copy> IMPL_T<A>: iter::CopyableIter<A> { pure fn find(p: fn(A) -> bool) -> Option<A> { iter::find(self, p) } } -impl<A: copy Ord> IMPL_T<A>: iter::CopyableOrderedIter<A> { +impl<A: Copy Ord> IMPL_T<A>: iter::CopyableOrderedIter<A> { pure fn min() -> A { iter::min(self) } pure fn max() -> A { iter::max(self) } } diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index e21c9b3c1bb..30bd66bf9f8 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -28,14 +28,14 @@ trait TimesIx{ pure fn timesi(it: fn(uint) -> bool); } -trait CopyableIter<A:copy> { +trait CopyableIter<A:Copy> { pure fn filter_to_vec(pred: fn(A) -> bool) -> ~[A]; pure fn map_to_vec<B>(op: fn(A) -> B) -> ~[B]; pure fn to_vec() -> ~[A]; pure fn find(p: fn(A) -> bool) -> Option<A>; } -trait CopyableOrderedIter<A:copy Ord> { +trait CopyableOrderedIter<A:Copy Ord> { pure fn min() -> A; pure fn max() -> A; } @@ -82,7 +82,7 @@ pure fn any<A,IA:BaseIter<A>>(self: IA, blk: fn(A) -> bool) -> bool { return false; } -pure fn filter_to_vec<A:copy,IA:BaseIter<A>>(self: IA, +pure fn filter_to_vec<A:Copy,IA:BaseIter<A>>(self: IA, prd: fn(A) -> bool) -> ~[A] { do vec::build_sized_opt(self.size_hint()) |push| { for self.each |a| { @@ -91,7 +91,7 @@ pure fn filter_to_vec<A:copy,IA:BaseIter<A>>(self: IA, } } -pure fn map_to_vec<A:copy,B,IA:BaseIter<A>>(self: IA, op: fn(A) -> B) +pure fn map_to_vec<A:Copy,B,IA:BaseIter<A>>(self: IA, op: fn(A) -> B) -> ~[B] { do vec::build_sized_opt(self.size_hint()) |push| { for self.each |a| { @@ -100,7 +100,7 @@ pure fn map_to_vec<A:copy,B,IA:BaseIter<A>>(self: IA, op: fn(A) -> B) } } -pure fn flat_map_to_vec<A:copy,B:copy,IA:BaseIter<A>,IB:BaseIter<B>>( +pure fn flat_map_to_vec<A:Copy,B:Copy,IA:BaseIter<A>,IB:BaseIter<B>>( self: IA, op: fn(A) -> IB) -> ~[B] { do vec::build |push| { @@ -120,7 +120,7 @@ pure fn foldl<A,B,IA:BaseIter<A>>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B { return b; } -pure fn to_vec<A:copy,IA:BaseIter<A>>(self: IA) -> ~[A] { +pure fn to_vec<A:Copy,IA:BaseIter<A>>(self: IA) -> ~[A] { foldl::<A,~[A],IA>(self, ~[], |r, a| vec::append(copy r, ~[a])) } @@ -163,7 +163,7 @@ pure fn repeat(times: uint, blk: fn() -> bool) { } } -pure fn min<A:copy Ord,IA:BaseIter<A>>(self: IA) -> A { +pure fn min<A:Copy Ord,IA:BaseIter<A>>(self: IA) -> A { match do foldl::<A,Option<A>,IA>(self, None) |a, b| { match a { Some(a_) if a_ < b => { @@ -179,7 +179,7 @@ pure fn min<A:copy Ord,IA:BaseIter<A>>(self: IA) -> A { } } -pure fn max<A:copy,IA:BaseIter<A>>(self: IA) -> A { +pure fn max<A:Copy,IA:BaseIter<A>>(self: IA) -> A { match do foldl::<A,Option<A>,IA>(self, None) |a, b| { match a { Some(a_) if a_ > b => { @@ -195,7 +195,7 @@ pure fn max<A:copy,IA:BaseIter<A>>(self: IA) -> A { } } -pure fn find<A: copy,IA:BaseIter<A>>(self: IA, +pure fn find<A: Copy,IA:BaseIter<A>>(self: IA, p: fn(A) -> bool) -> Option<A> { for self.each |i| { if p(i) { return Some(i) } @@ -271,7 +271,7 @@ pure fn from_fn<T,BT: Buildable<T>>(n_elts: uint, op: InitOp<T>) -> BT { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value `t`. */ -pure fn from_elem<T: copy,BT: Buildable<T>>(n_elts: uint, t: T) -> BT { +pure fn from_elem<T: Copy,BT: Buildable<T>>(n_elts: uint, t: T) -> BT { do build_sized(n_elts) |push| { let mut i: uint = 0u; while i < n_elts { push(t); i += 1u; } @@ -280,7 +280,7 @@ pure fn from_elem<T: copy,BT: Buildable<T>>(n_elts: uint, t: T) -> BT { /// Appending two generic sequences #[inline(always)] -pure fn append<T: copy,IT: BaseIter<T>,BT: Buildable<T>>( +pure fn append<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>( lhs: IT, rhs: IT) -> BT { let size_opt = lhs.size_hint().chain( |sz1| rhs.size_hint().map(|sz2| sz1+sz2)); @@ -293,7 +293,7 @@ pure fn append<T: copy,IT: BaseIter<T>,BT: Buildable<T>>( /// Copies a generic sequence, possibly converting it to a different /// type of sequence. #[inline(always)] -pure fn copy_seq<T: copy,IT: BaseIter<T>,BT: Buildable<T>>( +pure fn copy_seq<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>( v: IT) -> BT { do build_sized_opt(v.size_hint()) |push| { for v.each |x| { push(x); } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 5b7aee4d74c..980f1899566 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -16,7 +16,7 @@ enum Option<T> { Some(T), } -pure fn get<T: copy>(opt: Option<T>) -> T { +pure fn get<T: Copy>(opt: Option<T>) -> T { /*! * Gets the value out of an option * @@ -45,7 +45,7 @@ pure fn get_ref<T>(opt: &r/Option<T>) -> &r/T { } } -pure fn expect<T: copy>(opt: Option<T>, reason: ~str) -> T { +pure fn expect<T: Copy>(opt: Option<T>, reason: ~str) -> T { /*! * Gets the value out of an option, printing a specified message on * failure @@ -128,7 +128,7 @@ pure fn is_some<T>(opt: Option<T>) -> bool { !is_none(opt) } -pure fn get_default<T: copy>(opt: Option<T>, def: T) -> T { +pure fn get_default<T: Copy>(opt: Option<T>, def: T) -> T { //! Returns the contained value or a default match opt { Some(x) => x, None => def } @@ -226,7 +226,7 @@ impl<T> &Option<T> { pure fn get_ref() -> &self/T { get_ref(self) } } -impl<T: copy> Option<T> { +impl<T: Copy> Option<T> { /** * Gets the value out of an option * diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index da4b1b04673..27baf3d931e 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -152,7 +152,7 @@ fn buffer_header() -> BufferHeader { BufferHeader() } // This is for protocols to associate extra data to thread around. #[doc(hidden)] -type Buffer<T: send> = { +type Buffer<T: Send> = { header: BufferHeader, data: T, }; @@ -191,7 +191,7 @@ struct PacketHeader { reinterpret_cast(&self.buffer) } - fn set_buffer<T: send>(b: ~Buffer<T>) unsafe { + fn set_buffer<T: Send>(b: ~Buffer<T>) unsafe { self.buffer = reinterpret_cast(&b); } } @@ -205,7 +205,7 @@ fn PacketHeader() -> PacketHeader { } #[doc(hidden)] -type Packet<T: send> = { +type Packet<T: Send> = { header: PacketHeader, mut payload: Option<T>, }; @@ -213,7 +213,7 @@ type Packet<T: send> = { // XXX remove me #[cfg(stage0)] #[allow(non_camel_case_types)] -type packet<T: send> = Packet<T>; +type packet<T: Send> = Packet<T>; #[doc(hidden)] trait HasBuffer { @@ -221,7 +221,7 @@ trait HasBuffer { fn set_buffer_(b: *libc::c_void); } -impl<T: send> Packet<T>: HasBuffer { +impl<T: Send> Packet<T>: HasBuffer { fn set_buffer_(b: *libc::c_void) { self.header.buffer = b; } @@ -235,14 +235,14 @@ trait has_buffer { } #[cfg(stage0)] // XXX remove me -impl<T: send> packet<T>: has_buffer { +impl<T: Send> packet<T>: has_buffer { fn set_buffer(b: *libc::c_void) { self.header.buffer = b; } } #[doc(hidden)] -fn mk_packet<T: send>() -> Packet<T> { +fn mk_packet<T: Send>() -> Packet<T> { { header: PacketHeader(), mut payload: None @@ -250,7 +250,7 @@ fn mk_packet<T: send>() -> Packet<T> { } #[doc(hidden)] -fn unibuffer<T: send>() -> ~Buffer<Packet<T>> { +fn unibuffer<T: Send>() -> ~Buffer<Packet<T>> { let b = ~{ header: BufferHeader(), data: { @@ -267,7 +267,7 @@ fn unibuffer<T: send>() -> ~Buffer<Packet<T>> { } #[doc(hidden)] -fn packet<T: send>() -> *Packet<T> { +fn packet<T: Send>() -> *Packet<T> { let b = unibuffer(); let p = ptr::addr_of(b.data); // We'll take over memory management from here. @@ -276,7 +276,7 @@ fn packet<T: send>() -> *Packet<T> { } #[doc(hidden)] -fn entangle_buffer<T: send, Tstart: send>( +fn entangle_buffer<T: Send, Tstart: Send>( +buffer: ~Buffer<T>, init: fn(*libc::c_void, x: &T) -> *Packet<Tstart>) -> (SendPacketBuffered<Tstart, T>, RecvPacketBuffered<Tstart, T>) @@ -368,12 +368,12 @@ fn swap_state_rel(+dst: &mut State, src: State) -> State { } #[doc(hidden)] -unsafe fn get_buffer<T: send>(p: *PacketHeader) -> ~Buffer<T> { +unsafe fn get_buffer<T: Send>(p: *PacketHeader) -> ~Buffer<T> { transmute((*p).buf_header()) } // This could probably be done with SharedMutableState to avoid move_it!(). -struct BufferResource<T: send> { +struct BufferResource<T: Send> { buffer: ~Buffer<T>, drop unsafe { @@ -393,7 +393,7 @@ struct BufferResource<T: send> { } } -fn BufferResource<T: send>(+b: ~Buffer<T>) -> BufferResource<T> { +fn BufferResource<T: Send>(+b: ~Buffer<T>) -> BufferResource<T> { //let p = ptr::addr_of(*b); //error!("take %?", p); atomic_add_acq(&mut b.header.ref_count, 1); @@ -404,7 +404,7 @@ fn BufferResource<T: send>(+b: ~Buffer<T>) -> BufferResource<T> { } #[doc(hidden)] -fn send<T: send, Tbuffer: send>(+p: SendPacketBuffered<T, Tbuffer>, +fn send<T: Send, Tbuffer: Send>(+p: SendPacketBuffered<T, Tbuffer>, +payload: T) -> bool { let header = p.header(); let p_ = p.unwrap(); @@ -448,7 +448,7 @@ fn send<T: send, Tbuffer: send>(+p: SendPacketBuffered<T, Tbuffer>, Fails if the sender closes the connection. */ -fn recv<T: send, Tbuffer: send>(+p: RecvPacketBuffered<T, Tbuffer>) -> T { +fn recv<T: Send, Tbuffer: Send>(+p: RecvPacketBuffered<T, Tbuffer>) -> T { option::unwrap_expect(try_recv(p), "connection closed") } @@ -458,7 +458,7 @@ Returns `none` if the sender has closed the connection without sending a message, or `Some(T)` if a message was received. */ -fn try_recv<T: send, Tbuffer: send>(+p: RecvPacketBuffered<T, Tbuffer>) +fn try_recv<T: Send, Tbuffer: Send>(+p: RecvPacketBuffered<T, Tbuffer>) -> Option<T> { let p_ = p.unwrap(); @@ -552,7 +552,7 @@ fn try_recv<T: send, Tbuffer: send>(+p: RecvPacketBuffered<T, Tbuffer>) } /// Returns true if messages are available. -pure fn peek<T: send, Tb: send>(p: &RecvPacketBuffered<T, Tb>) -> bool { +pure fn peek<T: Send, Tb: Send>(p: &RecvPacketBuffered<T, Tb>) -> bool { match unsafe {(*p.header()).state} { Empty => false, Blocked => fail ~"peeking on blocked packet", @@ -560,14 +560,14 @@ pure fn peek<T: send, Tb: send>(p: &RecvPacketBuffered<T, Tb>) -> bool { } } -impl<T: send, Tb: send> RecvPacketBuffered<T, Tb> { +impl<T: Send, Tb: Send> RecvPacketBuffered<T, Tb> { pure fn peek() -> bool { peek(&self) } } #[doc(hidden)] -fn sender_terminate<T: send>(p: *Packet<T>) { +fn sender_terminate<T: Send>(p: *Packet<T>) { let p = unsafe { &*p }; match swap_state_rel(&mut p.header.state, Terminated) { Empty => { @@ -596,7 +596,7 @@ fn sender_terminate<T: send>(p: *Packet<T>) { } #[doc(hidden)] -fn receiver_terminate<T: send>(p: *Packet<T>) { +fn receiver_terminate<T: Send>(p: *Packet<T>) { let p = unsafe { &*p }; match swap_state_rel(&mut p.header.state, Terminated) { Empty => { @@ -704,7 +704,7 @@ Sometimes messages will be available on both endpoints at once. In this case, `select2` may return either `left` or `right`. */ -fn select2<A: send, Ab: send, B: send, Bb: send>( +fn select2<A: Send, Ab: Send, B: Send, Bb: Send>( +a: RecvPacketBuffered<A, Ab>, +b: RecvPacketBuffered<B, Bb>) -> Either<(Option<A>, RecvPacketBuffered<B, Bb>), @@ -746,7 +746,7 @@ fn select2i<A: Selectable, B: Selectable>(a: &A, b: &B) -> Either<(), ()> { list of the remaining endpoints. */ -fn select<T: send, Tb: send>(+endpoints: ~[RecvPacketBuffered<T, Tb>]) +fn select<T: Send, Tb: Send>(+endpoints: ~[RecvPacketBuffered<T, Tb>]) -> (uint, Option<T>, ~[RecvPacketBuffered<T, Tb>]) { let ready = wait_many(endpoints.map(|p| p.header())); @@ -760,25 +760,25 @@ fn select<T: send, Tb: send>(+endpoints: ~[RecvPacketBuffered<T, Tb>]) message. */ -type SendPacket<T: send> = SendPacketBuffered<T, Packet<T>>; +type SendPacket<T: Send> = SendPacketBuffered<T, Packet<T>>; #[doc(hidden)] -fn SendPacket<T: send>(p: *Packet<T>) -> SendPacket<T> { +fn SendPacket<T: Send>(p: *Packet<T>) -> SendPacket<T> { SendPacketBuffered(p) } // XXX remove me #[cfg(stage0)] #[allow(non_camel_case_types)] -type send_packet<T: send> = SendPacket<T>; +type send_packet<T: Send> = SendPacket<T>; // XXX remove me #[cfg(stage0)] -fn send_packet<T: send>(p: *packet<T>) -> SendPacket<T> { +fn send_packet<T: Send>(p: *packet<T>) -> SendPacket<T> { SendPacket(p) } -struct SendPacketBuffered<T: send, Tbuffer: send> { +struct SendPacketBuffered<T: Send, Tbuffer: Send> { mut p: Option<*Packet<T>>, mut buffer: Option<BufferResource<Tbuffer>>, drop { @@ -821,7 +821,7 @@ struct SendPacketBuffered<T: send, Tbuffer: send> { } } -fn SendPacketBuffered<T: send, Tbuffer: send>(p: *Packet<T>) +fn SendPacketBuffered<T: Send, Tbuffer: Send>(p: *Packet<T>) -> SendPacketBuffered<T, Tbuffer> { //debug!("take send %?", p); SendPacketBuffered { @@ -836,30 +836,30 @@ fn SendPacketBuffered<T: send, Tbuffer: send>(p: *Packet<T>) // XXX remove me #[cfg(stage0)] #[allow(non_camel_case_types)] -type send_packet_buffered<T: send, Tbuffer: send> = +type send_packet_buffered<T: Send, Tbuffer: Send> = SendPacketBuffered<T, Tbuffer>; /// Represents the receive end of a pipe. It can receive exactly one /// message. -type RecvPacket<T: send> = RecvPacketBuffered<T, Packet<T>>; +type RecvPacket<T: Send> = RecvPacketBuffered<T, Packet<T>>; #[doc(hidden)] -fn RecvPacket<T: send>(p: *Packet<T>) -> RecvPacket<T> { +fn RecvPacket<T: Send>(p: *Packet<T>) -> RecvPacket<T> { RecvPacketBuffered(p) } // XXX remove me #[cfg(stage0)] #[allow(non_camel_case_types)] -type recv_packet<T: send> = RecvPacket<T>; +type recv_packet<T: Send> = RecvPacket<T>; // XXX remove me #[cfg(stage0)] -fn recv_packet<T: send>(p: *packet<T>) -> RecvPacket<T> { +fn recv_packet<T: Send>(p: *packet<T>) -> RecvPacket<T> { RecvPacket(p) } -struct RecvPacketBuffered<T: send, Tbuffer: send> : Selectable { +struct RecvPacketBuffered<T: Send, Tbuffer: Send> : Selectable { mut p: Option<*Packet<T>>, mut buffer: Option<BufferResource<Tbuffer>>, drop { @@ -902,7 +902,7 @@ struct RecvPacketBuffered<T: send, Tbuffer: send> : Selectable { } } -fn RecvPacketBuffered<T: send, Tbuffer: send>(p: *Packet<T>) +fn RecvPacketBuffered<T: Send, Tbuffer: Send>(p: *Packet<T>) -> RecvPacketBuffered<T, Tbuffer> { //debug!("take recv %?", p); RecvPacketBuffered { @@ -917,11 +917,11 @@ fn RecvPacketBuffered<T: send, Tbuffer: send>(p: *Packet<T>) // XXX remove me #[cfg(stage0)] #[allow(non_camel_case_types)] -type recv_packet_buffered<T: send, Tbuffer: send> = +type recv_packet_buffered<T: Send, Tbuffer: Send> = RecvPacketBuffered<T, Tbuffer>; #[doc(hidden)] -fn entangle<T: send>() -> (SendPacket<T>, RecvPacket<T>) { +fn entangle<T: Send>() -> (SendPacket<T>, RecvPacket<T>) { let p = packet(); (SendPacket(p), RecvPacket(p)) } @@ -933,7 +933,7 @@ endpoint. The send endpoint is returned to the caller and the receive endpoint is passed to the new task. */ -fn spawn_service<T: send, Tb: send>( +fn spawn_service<T: Send, Tb: Send>( init: extern fn() -> (SendPacketBuffered<T, Tb>, RecvPacketBuffered<T, Tb>), +service: fn~(+RecvPacketBuffered<T, Tb>)) @@ -957,7 +957,7 @@ fn spawn_service<T: send, Tb: send>( receive state. */ -fn spawn_service_recv<T: send, Tb: send>( +fn spawn_service_recv<T: Send, Tb: Send>( init: extern fn() -> (RecvPacketBuffered<T, Tb>, SendPacketBuffered<T, Tb>), +service: fn~(+SendPacketBuffered<T, Tb>)) @@ -980,13 +980,13 @@ fn spawn_service_recv<T: send, Tb: send>( // Streams - Make pipes a little easier in general. proto! streamp ( - Open:send<T: send> { + Open:send<T: Send> { data(T) -> Open<T> } ) /// A trait for things that can send multiple messages. -trait Channel<T: send> { +trait Channel<T: Send> { // It'd be nice to call this send, but it'd conflict with the // built in send kind. @@ -998,7 +998,7 @@ trait Channel<T: send> { } /// A trait for things that can receive multiple messages. -trait Recv<T: send> { +trait Recv<T: Send> { /// Receives a message, or fails if the connection closes. fn recv() -> T; @@ -1016,18 +1016,18 @@ trait Recv<T: send> { } #[doc(hidden)] -type Chan_<T:send> = { mut endp: Option<streamp::client::Open<T>> }; +type Chan_<T:Send> = { mut endp: Option<streamp::client::Open<T>> }; /// An endpoint that can send many messages. -enum Chan<T:send> { +enum Chan<T:Send> { Chan_(Chan_<T>) } #[doc(hidden)] -type Port_<T:send> = { mut endp: Option<streamp::server::Open<T>> }; +type Port_<T:Send> = { mut endp: Option<streamp::server::Open<T>> }; /// An endpoint that can receive many messages. -enum Port<T:send> { +enum Port<T:Send> { Port_(Port_<T>) } @@ -1036,13 +1036,13 @@ enum Port<T:send> { These allow sending or receiving an unlimited number of messages. */ -fn stream<T:send>() -> (Chan<T>, Port<T>) { +fn stream<T:Send>() -> (Chan<T>, Port<T>) { let (c, s) = streamp::init(); (Chan_({ mut endp: Some(c) }), Port_({ mut endp: Some(s) })) } -impl<T: send> Chan<T>: Channel<T> { +impl<T: Send> Chan<T>: Channel<T> { fn send(+x: T) { let mut endp = None; endp <-> self.endp; @@ -1063,7 +1063,7 @@ impl<T: send> Chan<T>: Channel<T> { } } -impl<T: send> Port<T>: Recv<T> { +impl<T: Send> Port<T>: Recv<T> { fn recv() -> T { let mut endp = None; endp <-> self.endp; @@ -1097,7 +1097,7 @@ impl<T: send> Port<T>: Recv<T> { } /// Treat many ports as one. -struct PortSet<T: send> : Recv<T> { +struct PortSet<T: Send> : Recv<T> { mut ports: ~[pipes::Port<T>], fn add(+port: pipes::Port<T>) { @@ -1146,13 +1146,13 @@ struct PortSet<T: send> : Recv<T> { } } -fn PortSet<T: send>() -> PortSet<T>{ +fn PortSet<T: Send>() -> PortSet<T>{ PortSet { ports: ~[] } } -impl<T: send> Port<T>: Selectable { +impl<T: Send> Port<T>: Selectable { pure fn header() -> *PacketHeader unchecked { match self.endp { Some(endp) => endp.header(), @@ -1162,9 +1162,9 @@ impl<T: send> Port<T>: Selectable { } /// A channel that can be shared between many senders. -type SharedChan<T: send> = unsafe::Exclusive<Chan<T>>; +type SharedChan<T: Send> = unsafe::Exclusive<Chan<T>>; -impl<T: send> SharedChan<T>: Channel<T> { +impl<T: Send> SharedChan<T>: Channel<T> { fn send(+x: T) { let mut xx = Some(x); do self.with |chan| { @@ -1185,19 +1185,19 @@ impl<T: send> SharedChan<T>: Channel<T> { } /// Converts a `chan` into a `shared_chan`. -fn SharedChan<T:send>(+c: Chan<T>) -> SharedChan<T> { +fn SharedChan<T:Send>(+c: Chan<T>) -> SharedChan<T> { unsafe::exclusive(c) } /// Receive a message from one of two endpoints. -trait Select2<T: send, U: send> { +trait Select2<T: Send, U: Send> { /// Receive a message or return `none` if a connection closes. fn try_select() -> Either<Option<T>, Option<U>>; /// Receive a message or fail if a connection closes. fn select() -> Either<T, U>; } -impl<T: send, U: send, Left: Selectable Recv<T>, Right: Selectable Recv<U>> +impl<T: Send, U: Send, Left: Selectable Recv<T>, Right: Selectable Recv<U>> (Left, Right): Select2<T, U> { fn select() -> Either<T, U> { @@ -1220,18 +1220,18 @@ impl<T: send, U: send, Left: Selectable Recv<T>, Right: Selectable Recv<U>> } proto! oneshot ( - Oneshot:send<T:send> { + Oneshot:send<T:Send> { send(T) -> ! } ) /// The send end of a oneshot pipe. -type ChanOne<T: send> = oneshot::client::Oneshot<T>; +type ChanOne<T: Send> = oneshot::client::Oneshot<T>; /// The receive end of a oneshot pipe. -type PortOne<T: send> = oneshot::server::Oneshot<T>; +type PortOne<T: Send> = oneshot::server::Oneshot<T>; /// Initialiase a (send-endpoint, recv-endpoint) oneshot pipe pair. -fn oneshot<T: send>() -> (ChanOne<T>, PortOne<T>) { +fn oneshot<T: Send>() -> (ChanOne<T>, PortOne<T>) { oneshot::init() } @@ -1239,13 +1239,13 @@ fn oneshot<T: send>() -> (ChanOne<T>, PortOne<T>) { * Receive a message from a oneshot pipe, failing if the connection was * closed. */ -fn recv_one<T: send>(+port: PortOne<T>) -> T { +fn recv_one<T: Send>(+port: PortOne<T>) -> T { let oneshot::send(message) = recv(port); message } /// Receive a message from a oneshot pipe unless the connection was closed. -fn try_recv_one<T: send> (+port: PortOne<T>) -> Option<T> { +fn try_recv_one<T: Send> (+port: PortOne<T>) -> Option<T> { let message = try_recv(port); if message.is_none() { None } @@ -1256,7 +1256,7 @@ fn try_recv_one<T: send> (+port: PortOne<T>) -> Option<T> { } /// Send a message on a oneshot pipe, failing if the connection was closed. -fn send_one<T: send>(+chan: ChanOne<T>, +data: T) { +fn send_one<T: Send>(+chan: ChanOne<T>, +data: T) { oneshot::client::send(chan, data); } @@ -1264,7 +1264,7 @@ fn send_one<T: send>(+chan: ChanOne<T>, +data: T) { * Send a message on a oneshot pipe, or return false if the connection was * closed. */ -fn try_send_one<T: send>(+chan: ChanOne<T>, +data: T) +fn try_send_one<T: Send>(+chan: ChanOne<T>, +data: T) -> bool { oneshot::client::try_send(chan, data).is_some() } diff --git a/src/libcore/priv.rs b/src/libcore/priv.rs index 9330d376cad..046621897f8 100644 --- a/src/libcore/priv.rs +++ b/src/libcore/priv.rs @@ -27,7 +27,7 @@ type GlobalPtr = *libc::uintptr_t; * or, if no channel exists creates and installs a new channel and sets up a * new task to receive from it. */ -unsafe fn chan_from_global_ptr<T: send>( +unsafe fn chan_from_global_ptr<T: Send>( global: GlobalPtr, task_fn: fn() -> task::TaskBuilder, +f: fn~(comm::Port<T>) diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 35135b1fd23..77a5dbbc310 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -165,12 +165,12 @@ impl Rng { } /// Choose an item randomly, failing if values is empty - fn choose<T:copy>(values: &[T]) -> T { + fn choose<T:Copy>(values: &[T]) -> T { self.choose_option(values).get() } /// Choose Some(item) randomly, returning None if values is empty - fn choose_option<T:copy>(values: &[T]) -> Option<T> { + fn choose_option<T:Copy>(values: &[T]) -> Option<T> { if values.is_empty() { None } else { @@ -182,7 +182,7 @@ impl Rng { * Choose an item respecting the relative weights, failing if the sum of * the weights is 0 */ - fn choose_weighted<T: copy>(v : &[Weighted<T>]) -> T { + fn choose_weighted<T: Copy>(v : &[Weighted<T>]) -> T { self.choose_weighted_option(v).get() } @@ -190,7 +190,7 @@ impl Rng { * Choose Some(item) respecting the relative weights, returning none if * the sum of the weights is 0 */ - fn choose_weighted_option<T:copy>(v: &[Weighted<T>]) -> Option<T> { + fn choose_weighted_option<T:Copy>(v: &[Weighted<T>]) -> Option<T> { let mut total = 0u; for v.each |item| { total += item.weight; @@ -213,7 +213,7 @@ impl Rng { * Return a vec containing copies of the items, in order, where * the weight of the item determines how many copies there are */ - fn weighted_vec<T:copy>(v: &[Weighted<T>]) -> ~[T] { + fn weighted_vec<T:Copy>(v: &[Weighted<T>]) -> ~[T] { let mut r = ~[]; for v.each |item| { for uint::range(0u, item.weight) |_i| { @@ -224,7 +224,7 @@ impl Rng { } /// Shuffle a vec - fn shuffle<T:copy>(values: &[T]) -> ~[T] { + fn shuffle<T:Copy>(values: &[T]) -> ~[T] { let mut m = vec::from_slice(values); self.shuffle_mut(m); return m; diff --git a/src/libcore/result.rs b/src/libcore/result.rs index e4028a466e0..7f3f35acc90 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -18,7 +18,7 @@ enum Result<T, U> { * * If the result is an error */ -pure fn get<T: copy, U>(res: Result<T, U>) -> T { +pure fn get<T: Copy, U>(res: Result<T, U>) -> T { match res { Ok(t) => t, Err(the_err) => unchecked { @@ -50,7 +50,7 @@ pure fn get_ref<T, U>(res: &a/Result<T, U>) -> &a/T { * * If the result is not an error */ -pure fn get_err<T, U: copy>(res: Result<T, U>) -> U { +pure fn get_err<T, U: Copy>(res: Result<T, U>) -> U { match res { Err(u) => u, Ok(_) => fail ~"get_err called on ok result" @@ -76,7 +76,7 @@ pure fn is_err<T, U>(res: Result<T, U>) -> bool { * `ok` result variants are converted to `either::right` variants, `err` * result variants are converted to `either::left`. */ -pure fn to_either<T: copy, U: copy>(res: Result<U, T>) -> Either<T, U> { +pure fn to_either<T: Copy, U: Copy>(res: Result<U, T>) -> Either<T, U> { match res { Ok(res) => either::Right(res), Err(fail_) => either::Left(fail_) @@ -97,7 +97,7 @@ pure fn to_either<T: copy, U: copy>(res: Result<U, T>) -> Either<T, U> { * ok(parse_buf(buf)) * } */ -fn chain<T, U: copy, V: copy>(res: Result<T, V>, op: fn(T) -> Result<U, V>) +fn chain<T, U: Copy, V: Copy>(res: Result<T, V>, op: fn(T) -> Result<U, V>) -> Result<U, V> { match res { Ok(t) => op(t), @@ -113,7 +113,7 @@ fn chain<T, U: copy, V: copy>(res: Result<T, V>, op: fn(T) -> Result<U, V>) * immediately returned. This function can be used to pass through a * successful result while handling an error. */ -fn chain_err<T: copy, U: copy, V: copy>( +fn chain_err<T: Copy, U: Copy, V: Copy>( res: Result<T, V>, op: fn(V) -> Result<T, U>) -> Result<T, U> { @@ -173,7 +173,7 @@ fn iter_err<T, E>(res: Result<T, E>, f: fn(E)) { * parse_buf(buf) * } */ -fn map<T, E: copy, U: copy>(res: Result<T, E>, op: fn(T) -> U) +fn map<T, E: Copy, U: Copy>(res: Result<T, E>, op: fn(T) -> U) -> Result<U, E> { match res { Ok(t) => Ok(op(t)), @@ -189,7 +189,7 @@ fn map<T, E: copy, U: copy>(res: Result<T, E>, op: fn(T) -> U) * is immediately returned. This function can be used to pass through a * successful result while handling an error. */ -fn map_err<T: copy, E, F: copy>(res: Result<T, E>, op: fn(E) -> F) +fn map_err<T: Copy, E, F: Copy>(res: Result<T, E>, op: fn(E) -> F) -> Result<T, F> { match res { Ok(t) => Ok(t), @@ -217,10 +217,10 @@ impl<T, E> Result<T, E> { } } -impl<T: copy, E> Result<T, E> { +impl<T: Copy, E> Result<T, E> { fn get() -> T { get(self) } - fn map_err<F:copy>(op: fn(E) -> F) -> Result<T,F> { + fn map_err<F:Copy>(op: fn(E) -> F) -> Result<T,F> { match self { Ok(t) => Ok(t), Err(e) => Err(op(e)) @@ -228,10 +228,10 @@ impl<T: copy, E> Result<T, E> { } } -impl<T, E: copy> Result<T, E> { +impl<T, E: Copy> Result<T, E> { fn get_err() -> E { get_err(self) } - fn map<U:copy>(op: fn(T) -> U) -> Result<U,E> { + fn map<U:Copy>(op: fn(T) -> U) -> Result<U,E> { match self { Ok(t) => Ok(op(t)), Err(e) => Err(e) @@ -239,12 +239,12 @@ impl<T, E: copy> Result<T, E> { } } -impl<T: copy, E: copy> Result<T, E> { - fn chain<U:copy>(op: fn(T) -> Result<U,E>) -> Result<U,E> { +impl<T: Copy, E: Copy> Result<T, E> { + fn chain<U:Copy>(op: fn(T) -> Result<U,E>) -> Result<U,E> { chain(self, op) } - fn chain_err<F:copy>(op: fn(E) -> Result<T,F>) -> Result<T,F> { + fn chain_err<F:Copy>(op: fn(E) -> Result<T,F>) -> Result<T,F> { chain_err(self, op) } } @@ -266,7 +266,7 @@ impl<T: copy, E: copy> Result<T, E> { * assert incd == ~[2u, 3u, 4u]; * } */ -fn map_vec<T,U:copy,V:copy>( +fn map_vec<T,U:Copy,V:Copy>( ts: &[T], op: fn(T) -> Result<V,U>) -> Result<~[V],U> { let mut vs: ~[V] = ~[]; @@ -280,7 +280,7 @@ fn map_vec<T,U:copy,V:copy>( return Ok(vs); } -fn map_opt<T,U:copy,V:copy>( +fn map_opt<T,U:Copy,V:Copy>( o_t: Option<T>, op: fn(T) -> Result<V,U>) -> Result<Option<V>,U> { match o_t { @@ -301,7 +301,7 @@ fn map_opt<T,U:copy,V:copy>( * used in 'careful' code contexts where it is both appropriate and easy * to accommodate an error like the vectors being of different lengths. */ -fn map_vec2<S,T,U:copy,V:copy>(ss: &[S], ts: &[T], +fn map_vec2<S,T,U:Copy,V:Copy>(ss: &[S], ts: &[T], op: fn(S,T) -> Result<V,U>) -> Result<~[V],U> { assert vec::same_length(ss, ts); @@ -324,7 +324,7 @@ fn map_vec2<S,T,U:copy,V:copy>(ss: &[S], ts: &[T], * error. This could be implemented using `map2()` but it is more efficient * on its own as no result vector is built. */ -fn iter_vec2<S,T,U:copy>(ss: &[S], ts: &[T], +fn iter_vec2<S,T,U:Copy>(ss: &[S], ts: &[T], op: fn(S,T) -> Result<(),U>) -> Result<(),U> { assert vec::same_length(ss, ts); diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index 3eb8e581cbc..a292d011644 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -8,7 +8,7 @@ use cmp::Eq; use hash::Hash; use to_bytes::IterBytes; -trait SendMap<K:Eq Hash, V: copy> { +trait SendMap<K:Eq Hash, V: Copy> { // FIXME(#3148) ^^^^ once find_ref() works, we can drop V:copy fn insert(&mut self, +k: K, +v: V) -> bool; @@ -315,7 +315,7 @@ mod linear { } } - impl<K:Hash IterBytes Eq, V: copy> LinearMap<K,V> { + impl<K:Hash IterBytes Eq, V: Copy> LinearMap<K,V> { fn find(&const self, k: &K) -> Option<V> { match self.bucket_for_key(self.buckets, k) { FoundEntry(idx) => { @@ -342,17 +342,17 @@ mod linear { } - impl<K: Hash IterBytes Eq copy, V: copy> LinearMap<K,V> { + impl<K: Hash IterBytes Eq Copy, V: Copy> LinearMap<K,V> { fn each(&self, blk: fn(+K,+V) -> bool) { self.each_ref(|k,v| blk(copy *k, copy *v)); } } - impl<K: Hash IterBytes Eq copy, V> LinearMap<K,V> { + impl<K: Hash IterBytes Eq Copy, V> LinearMap<K,V> { fn each_key(&self, blk: fn(+K) -> bool) { self.each_key_ref(|k| blk(copy *k)); } } - impl<K: Hash IterBytes Eq, V: copy> LinearMap<K,V> { + impl<K: Hash IterBytes Eq, V: Copy> LinearMap<K,V> { fn each_value(&self, blk: fn(+V) -> bool) { self.each_value_ref(|v| blk(copy *v)); } diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 6db50291b95..32ce963ebbb 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -380,7 +380,7 @@ impl TaskBuilder { spawn_raw(x.opts, x.gen_body(f)); } /// Runs a task, while transfering ownership of one argument to the child. - fn spawn_with<A: send>(+arg: A, +f: fn~(+A)) { + fn spawn_with<A: Send>(+arg: A, +f: fn~(+A)) { let arg = ~mut Some(arg); do self.spawn { f(option::swap_unwrap(arg)) @@ -398,7 +398,7 @@ impl TaskBuilder { * otherwise be required to establish communication from the parent * to the child. */ - fn spawn_listener<A: send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> { + fn spawn_listener<A: Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> { let setup_po = comm::Port(); let setup_ch = comm::Chan(setup_po); do self.spawn { @@ -413,7 +413,7 @@ impl TaskBuilder { /** * Runs a new task, setting up communication in both directions */ - fn spawn_conversation<A: send, B: send> + fn spawn_conversation<A: Send, B: Send> (+f: fn~(comm::Port<A>, comm::Chan<B>)) -> (comm::Port<B>, comm::Chan<A>) { let from_child = comm::Port(); @@ -437,7 +437,7 @@ impl TaskBuilder { * # Failure * Fails if a future_result was already set for this task. */ - fn try<T: send>(+f: fn~() -> T) -> Result<T,()> { + fn try<T: Send>(+f: fn~() -> T) -> Result<T,()> { let po = comm::Port(); let ch = comm::Chan(po); let mut result = None; @@ -504,7 +504,7 @@ fn spawn_supervised(+f: fn~()) { task().supervised().spawn(f) } -fn spawn_with<A:send>(+arg: A, +f: fn~(+A)) { +fn spawn_with<A:Send>(+arg: A, +f: fn~(+A)) { /*! * Runs a task, while transfering ownership of one argument to the * child. @@ -518,7 +518,7 @@ fn spawn_with<A:send>(+arg: A, +f: fn~(+A)) { task().spawn_with(arg, f) } -fn spawn_listener<A:send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> { +fn spawn_listener<A:Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> { /*! * Runs a new task while providing a channel from the parent to the child * @@ -528,7 +528,7 @@ fn spawn_listener<A:send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> { task().spawn_listener(f) } -fn spawn_conversation<A: send, B: send> +fn spawn_conversation<A: Send, B: Send> (+f: fn~(comm::Port<A>, comm::Chan<B>)) -> (comm::Port<B>, comm::Chan<A>) { /*! @@ -557,7 +557,7 @@ fn spawn_sched(mode: SchedMode, +f: fn~()) { task().sched_mode(mode).spawn(f) } -fn try<T:send>(+f: fn~() -> T) -> Result<T,()> { +fn try<T:Send>(+f: fn~() -> T) -> Result<T,()> { /*! * Execute a function in another task and return either the return value * of the function or result::err. @@ -1314,10 +1314,10 @@ fn spawn_raw(+opts: TaskOpts, +f: fn~()) { * * These two cases aside, the interface is safe. */ -type LocalDataKey<T: owned> = &fn(+@T); +type LocalDataKey<T: Owned> = &fn(+@T); trait LocalData { } -impl<T: owned> @T: LocalData { } +impl<T: Owned> @T: LocalData { } impl LocalData: Eq { pure fn eq(&&other: LocalData) -> bool unsafe { @@ -1365,7 +1365,7 @@ unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap { } } -unsafe fn key_to_key_value<T: owned>( +unsafe fn key_to_key_value<T: Owned>( key: LocalDataKey<T>) -> *libc::c_void { // Keys are closures, which are (fnptr,envptr) pairs. Use fnptr. @@ -1375,7 +1375,7 @@ unsafe fn key_to_key_value<T: owned>( } // If returning Some(..), returns with @T with the map's reference. Careful! -unsafe fn local_data_lookup<T: owned>( +unsafe fn local_data_lookup<T: Owned>( map: TaskLocalMap, key: LocalDataKey<T>) -> Option<(uint, *libc::c_void)> { @@ -1393,7 +1393,7 @@ unsafe fn local_data_lookup<T: owned>( } } -unsafe fn local_get_helper<T: owned>( +unsafe fn local_get_helper<T: Owned>( task: *rust_task, key: LocalDataKey<T>, do_pop: bool) -> Option<@T> { @@ -1414,21 +1414,21 @@ unsafe fn local_get_helper<T: owned>( } } -unsafe fn local_pop<T: owned>( +unsafe fn local_pop<T: Owned>( task: *rust_task, key: LocalDataKey<T>) -> Option<@T> { local_get_helper(task, key, true) } -unsafe fn local_get<T: owned>( +unsafe fn local_get<T: Owned>( task: *rust_task, key: LocalDataKey<T>) -> Option<@T> { local_get_helper(task, key, false) } -unsafe fn local_set<T: owned>( +unsafe fn local_set<T: Owned>( task: *rust_task, key: LocalDataKey<T>, +data: @T) { let map = get_task_local_map(task); @@ -1460,7 +1460,7 @@ unsafe fn local_set<T: owned>( } } -unsafe fn local_modify<T: owned>( +unsafe fn local_modify<T: Owned>( task: *rust_task, key: LocalDataKey<T>, modify_fn: fn(Option<@T>) -> Option<@T>) { @@ -1476,7 +1476,7 @@ unsafe fn local_modify<T: owned>( * Remove a task-local data value from the table, returning the * reference that was originally created to insert it. */ -unsafe fn local_data_pop<T: owned>( +unsafe fn local_data_pop<T: Owned>( key: LocalDataKey<T>) -> Option<@T> { local_pop(rustrt::rust_get_task(), key) @@ -1485,7 +1485,7 @@ unsafe fn local_data_pop<T: owned>( * Retrieve a task-local data value. It will also be kept alive in the * table until explicitly removed. */ -unsafe fn local_data_get<T: owned>( +unsafe fn local_data_get<T: Owned>( key: LocalDataKey<T>) -> Option<@T> { local_get(rustrt::rust_get_task(), key) @@ -1494,7 +1494,7 @@ unsafe fn local_data_get<T: owned>( * Store a value in task-local data. If this key already has a value, * that value is overwritten (and its destructor is run). */ -unsafe fn local_data_set<T: owned>( +unsafe fn local_data_set<T: Owned>( key: LocalDataKey<T>, +data: @T) { local_set(rustrt::rust_get_task(), key, data) @@ -1503,7 +1503,7 @@ unsafe fn local_data_set<T: owned>( * Modify a task-local data value. If the function returns 'none', the * data is removed (and its reference dropped). */ -unsafe fn local_data_modify<T: owned>( +unsafe fn local_data_modify<T: Owned>( key: LocalDataKey<T>, modify_fn: fn(Option<@T>) -> Option<@T>) { diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 6303bbbf0e5..76d684a16cd 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -50,13 +50,13 @@ impl &str: ToStr { fn to_str() -> ~str { str::from_slice(self) } } -impl<A: ToStr copy, B: ToStr copy> (A, B): ToStr { +impl<A: ToStr Copy, B: ToStr Copy> (A, B): ToStr { fn to_str() -> ~str { let (a, b) = self; ~"(" + a.to_str() + ~", " + b.to_str() + ~")" } } -impl<A: ToStr copy, B: ToStr copy, C: ToStr copy> (A, B, C): ToStr { +impl<A: ToStr Copy, B: ToStr Copy, C: ToStr Copy> (A, B, C): ToStr { fn to_str() -> ~str { let (a, b, c) = self; ~"(" + a.to_str() + ~", " + b.to_str() + ~", " + c.to_str() + ~")" diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 2ab8af78b8a..4114adef8f0 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -12,7 +12,7 @@ trait TupleOps<T,U> { pure fn swap() -> (U, T); } -impl<T: copy, U: copy> (T, U): TupleOps<T,U> { +impl<T: Copy, U: Copy> (T, U): TupleOps<T,U> { /// Return the first element of self pure fn first() -> T { @@ -39,7 +39,7 @@ trait ExtendedTupleOps<A,B> { fn map<C>(f: fn(A, B) -> C) -> ~[C]; } -impl<A: copy, B: copy> (&[A], &[B]): ExtendedTupleOps<A,B> { +impl<A: Copy, B: Copy> (&[A], &[B]): ExtendedTupleOps<A,B> { fn zip() -> ~[(A, B)] { let (a, b) = self; @@ -52,7 +52,7 @@ impl<A: copy, B: copy> (&[A], &[B]): ExtendedTupleOps<A,B> { } } -impl<A: copy, B: copy> (~[A], ~[B]): ExtendedTupleOps<A,B> { +impl<A: Copy, B: Copy> (~[A], ~[B]): ExtendedTupleOps<A,B> { fn zip() -> ~[(A, B)] { // XXX: Bad copy diff --git a/src/libcore/unsafe.rs b/src/libcore/unsafe.rs index 2b57d694cbf..5539aa7d89e 100644 --- a/src/libcore/unsafe.rs +++ b/src/libcore/unsafe.rs @@ -137,7 +137,7 @@ fn ArcDestruct<T>(data: *libc::c_void) -> ArcDestruct<T> { } } -unsafe fn unwrap_shared_mutable_state<T: send>(+rc: SharedMutableState<T>) +unsafe fn unwrap_shared_mutable_state<T: Send>(+rc: SharedMutableState<T>) -> T { struct DeathThroes<T> { mut ptr: Option<~ArcData<T>>, @@ -207,9 +207,9 @@ unsafe fn unwrap_shared_mutable_state<T: send>(+rc: SharedMutableState<T>) * Data races between tasks can result in crashes and, with sufficient * cleverness, arbitrary type coercion. */ -type SharedMutableState<T: send> = ArcDestruct<T>; +type SharedMutableState<T: Send> = ArcDestruct<T>; -unsafe fn shared_mutable_state<T: send>(+data: T) -> SharedMutableState<T> { +unsafe fn shared_mutable_state<T: Send>(+data: T) -> SharedMutableState<T> { let data = ~ArcData { count: 1, unwrapper: 0, data: Some(data) }; unsafe { let ptr = unsafe::transmute(data); @@ -218,7 +218,7 @@ unsafe fn shared_mutable_state<T: send>(+data: T) -> SharedMutableState<T> { } #[inline(always)] -unsafe fn get_shared_mutable_state<T: send>(rc: &a/SharedMutableState<T>) +unsafe fn get_shared_mutable_state<T: Send>(rc: &a/SharedMutableState<T>) -> &a/mut T { unsafe { let ptr: ~ArcData<T> = unsafe::reinterpret_cast(&(*rc).data); @@ -230,7 +230,7 @@ unsafe fn get_shared_mutable_state<T: send>(rc: &a/SharedMutableState<T>) } } #[inline(always)] -unsafe fn get_shared_immutable_state<T: send>(rc: &a/SharedMutableState<T>) +unsafe fn get_shared_immutable_state<T: Send>(rc: &a/SharedMutableState<T>) -> &a/T { unsafe { let ptr: ~ArcData<T> = unsafe::reinterpret_cast(&(*rc).data); @@ -242,7 +242,7 @@ unsafe fn get_shared_immutable_state<T: send>(rc: &a/SharedMutableState<T>) } } -unsafe fn clone_shared_mutable_state<T: send>(rc: &SharedMutableState<T>) +unsafe fn clone_shared_mutable_state<T: Send>(rc: &SharedMutableState<T>) -> SharedMutableState<T> { unsafe { let ptr: ~ArcData<T> = unsafe::reinterpret_cast(&(*rc).data); @@ -312,20 +312,20 @@ impl LittleLock { } } -struct ExData<T: send> { lock: LittleLock, mut failed: bool, mut data: T, } +struct ExData<T: Send> { lock: LittleLock, mut failed: bool, mut data: T, } /** * An arc over mutable data that is protected by a lock. For library use only. */ -struct Exclusive<T: send> { x: SharedMutableState<ExData<T>> } +struct Exclusive<T: Send> { x: SharedMutableState<ExData<T>> } -fn exclusive<T:send >(+user_data: T) -> Exclusive<T> { +fn exclusive<T:Send >(+user_data: T) -> Exclusive<T> { let data = ExData { lock: LittleLock(), mut failed: false, mut data: user_data }; Exclusive { x: unsafe { shared_mutable_state(data) } } } -impl<T: send> Exclusive<T> { +impl<T: Send> Exclusive<T> { // Duplicate an exclusive ARC, as std::arc::clone. fn clone() -> Exclusive<T> { Exclusive { x: unsafe { clone_shared_mutable_state(&self.x) } } @@ -353,7 +353,7 @@ impl<T: send> Exclusive<T> { } // FIXME(#2585) make this a by-move method on the exclusive -fn unwrap_exclusive<T: send>(+arc: Exclusive<T>) -> T { +fn unwrap_exclusive<T: Send>(+arc: Exclusive<T>) -> T { let Exclusive { x: x } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let ExData { data: data, _ } = inner; diff --git a/src/libcore/util.rs b/src/libcore/util.rs index bb33bad1f85..e2128693ace 100644 --- a/src/libcore/util.rs +++ b/src/libcore/util.rs @@ -17,7 +17,7 @@ pure fn ignore<T>(+_x: T) { } /// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the /// original value of `*ptr`. #[inline(always)] -fn with<T: copy, R>( +fn with<T: Copy, R>( ptr: &mut T, +new_value: T, op: &fn() -> R) -> R diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 4dedde8e177..2ae6a7b2780 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -199,7 +199,7 @@ pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> ~[T] { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value `t`. */ -pure fn from_elem<T: copy>(n_elts: uint, t: T) -> ~[T] { +pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> ~[T] { let mut v = ~[]; unchecked{reserve(v, n_elts)} let mut i: uint = 0u; @@ -211,7 +211,7 @@ pure fn from_elem<T: copy>(n_elts: uint, t: T) -> ~[T] { } /// Creates a new unique vector with the same contents as the slice -pure fn from_slice<T: copy>(t: &[T]) -> ~[T] { +pure fn from_slice<T: Copy>(t: &[T]) -> ~[T] { from_fn(t.len(), |i| t[i]) } @@ -281,10 +281,10 @@ pure fn from_mut<T>(+v: ~[mut T]) -> ~[T] { // Accessors /// Returns the first element of a vector -pure fn head<T: copy>(v: &[const T]) -> T { v[0] } +pure fn head<T: Copy>(v: &[const T]) -> T { v[0] } /// Returns a vector containing all but the first element of a slice -pure fn tail<T: copy>(v: &[const T]) -> ~[T] { +pure fn tail<T: Copy>(v: &[const T]) -> ~[T] { return slice(v, 1u, len(v)); } @@ -292,18 +292,18 @@ pure fn tail<T: copy>(v: &[const T]) -> ~[T] { * Returns a vector containing all but the first `n` \ * elements of a slice */ -pure fn tailn<T: copy>(v: &[const T], n: uint) -> ~[T] { +pure fn tailn<T: Copy>(v: &[const T], n: uint) -> ~[T] { slice(v, n, len(v)) } /// Returns a vector containing all but the last element of a slice -pure fn init<T: copy>(v: &[const T]) -> ~[T] { +pure fn init<T: Copy>(v: &[const T]) -> ~[T] { assert len(v) != 0u; slice(v, 0u, len(v) - 1u) } /// Returns the last element of the slice `v`, failing if the slice is empty. -pure fn last<T: copy>(v: &[const T]) -> T { +pure fn last<T: Copy>(v: &[const T]) -> T { if len(v) == 0u { fail ~"last_unsafe: empty vector" } v[len(v) - 1u] } @@ -312,13 +312,13 @@ pure fn last<T: copy>(v: &[const T]) -> T { * Returns `Some(x)` where `x` is the last element of the slice `v`, * or `none` if the vector is empty. */ -pure fn last_opt<T: copy>(v: &[const T]) -> Option<T> { +pure fn last_opt<T: Copy>(v: &[const T]) -> Option<T> { if len(v) == 0u { return None; } Some(v[len(v) - 1u]) } /// Returns a copy of the elements from [`start`..`end`) from `v`. -pure fn slice<T: copy>(v: &[const T], start: uint, end: uint) -> ~[T] { +pure fn slice<T: Copy>(v: &[const T], start: uint, end: uint) -> ~[T] { assert (start <= end); assert (end <= len(v)); let mut result = ~[]; @@ -365,7 +365,7 @@ pure fn const_view<T>(v: &[const T], start: uint, end: uint) -> &[const T] { } /// Split the vector `v` by applying each element against the predicate `f`. -fn split<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] { +fn split<T: Copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0u) { return ~[] } @@ -388,7 +388,7 @@ fn split<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] { * Split the vector `v` by applying each element against the predicate `f` up * to `n` times. */ -fn splitn<T: copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] { +fn splitn<T: Copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0u) { return ~[] } @@ -414,7 +414,7 @@ fn splitn<T: copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] { * Reverse split the vector `v` by applying each element against the predicate * `f`. */ -fn rsplit<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] { +fn rsplit<T: Copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0u) { return ~[] } @@ -438,7 +438,7 @@ fn rsplit<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[~[T]] { * Reverse split the vector `v` by applying each element against the predicate * `f` up to `n times. */ -fn rsplitn<T: copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] { +fn rsplitn<T: Copy>(v: &[T], n: uint, f: fn(T) -> bool) -> ~[~[T]] { let ln = len(v); if (ln == 0u) { return ~[] } @@ -589,7 +589,7 @@ fn push_slow<T>(&v: ~[const T], +initval: T) { } #[inline(always)] -fn push_all<T: copy>(&v: ~[const T], rhs: &[const T]) { +fn push_all<T: Copy>(&v: ~[const T], rhs: &[const T]) { reserve(v, v.len() + rhs.len()); for uint::range(0u, rhs.len()) |i| { @@ -627,7 +627,7 @@ fn truncate<T>(&v: ~[const T], newlen: uint) { // Appending #[inline(always)] -pure fn append<T: copy>(+lhs: ~[T], rhs: &[const T]) -> ~[T] { +pure fn append<T: Copy>(+lhs: ~[T], rhs: &[const T]) -> ~[T] { let mut v <- lhs; unchecked { push_all(v, rhs); @@ -643,7 +643,7 @@ pure fn append_one<T>(+lhs: ~[T], +x: T) -> ~[T] { } #[inline(always)] -pure fn append_mut<T: copy>(lhs: &[mut T], rhs: &[const T]) -> ~[mut T] { +pure fn append_mut<T: Copy>(lhs: &[mut T], rhs: &[const T]) -> ~[mut T] { let mut v = ~[mut]; let mut i = 0u; while i < lhs.len() { @@ -671,7 +671,7 @@ pure fn append_mut<T: copy>(lhs: &[mut T], rhs: &[const T]) -> ~[mut T] { * * n - The number of elements to add * * initval - The value for the new elements */ -fn grow<T: copy>(&v: ~[const T], n: uint, initval: T) { +fn grow<T: Copy>(&v: ~[const T], n: uint, initval: T) { reserve_at_least(v, len(v) + n); let mut i: uint = 0u; @@ -705,7 +705,7 @@ fn grow_fn<T>(&v: ~[const T], n: uint, op: iter::InitOp<T>) { * of the vector, expands the vector by replicating `initval` to fill the * intervening space. */ -fn grow_set<T: copy>(&v: ~[mut T], index: uint, initval: T, val: T) { +fn grow_set<T: Copy>(&v: ~[mut T], index: uint, initval: T, val: T) { if index >= len(v) { grow(v, index - len(v) + 1u, initval); } v[index] = val; } @@ -747,7 +747,7 @@ pure fn flat_map<T, U>(v: &[T], f: fn(T) -> ~[U]) -> ~[U] { } /// Apply a function to each pair of elements and return the results -pure fn map2<T: copy, U: copy, V>(v0: &[T], v1: &[U], +pure fn map2<T: Copy, U: Copy, V>(v0: &[T], v1: &[U], f: fn(T, U) -> V) -> ~[V] { let v0_len = len(v0); if v0_len != len(v1) { fail; } @@ -766,7 +766,7 @@ pure fn map2<T: copy, U: copy, V>(v0: &[T], v1: &[U], * If function `f` returns `none` then that element is excluded from * the resulting vector. */ -pure fn filter_map<T, U: copy>(v: &[T], f: fn(T) -> Option<U>) +pure fn filter_map<T, U: Copy>(v: &[T], f: fn(T) -> Option<U>) -> ~[U] { let mut result = ~[]; for each(v) |elem| { @@ -785,7 +785,7 @@ pure fn filter_map<T, U: copy>(v: &[T], f: fn(T) -> Option<U>) * Apply function `f` to each element of `v` and return a vector containing * only those elements for which `f` returned true. */ -pure fn filter<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[T] { +pure fn filter<T: Copy>(v: &[T], f: fn(T) -> bool) -> ~[T] { let mut result = ~[]; for each(v) |elem| { if f(elem) { unsafe { push(result, elem); } } @@ -798,14 +798,14 @@ pure fn filter<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[T] { * * Flattens a vector of vectors of T into a single vector of T. */ -pure fn concat<T: copy>(v: &[~[T]]) -> ~[T] { +pure fn concat<T: Copy>(v: &[~[T]]) -> ~[T] { let mut r = ~[]; for each(v) |inner| { unsafe { push_all(r, inner); } } return r; } /// Concatenate a vector of vectors, placing a given separator between each -pure fn connect<T: copy>(v: &[~[T]], sep: T) -> ~[T] { +pure fn connect<T: Copy>(v: &[~[T]], sep: T) -> ~[T] { let mut r: ~[T] = ~[]; let mut first = true; for each(v) |inner| { @@ -816,7 +816,7 @@ pure fn connect<T: copy>(v: &[~[T]], sep: T) -> ~[T] { } /// Reduce a vector from left to right -pure fn foldl<T: copy, U>(z: T, v: &[U], p: fn(T, U) -> T) -> T { +pure fn foldl<T: Copy, U>(z: T, v: &[U], p: fn(T, U) -> T) -> T { let mut accum = z; do iter(v) |elt| { accum = p(accum, elt); @@ -825,7 +825,7 @@ pure fn foldl<T: copy, U>(z: T, v: &[U], p: fn(T, U) -> T) -> T { } /// Reduce a vector from right to left -pure fn foldr<T, U: copy>(v: &[T], z: U, p: fn(T, U) -> U) -> U { +pure fn foldr<T, U: Copy>(v: &[T], z: U, p: fn(T, U) -> U) -> U { let mut accum = z; do riter(v) |elt| { accum = p(elt, accum); @@ -914,7 +914,7 @@ pure fn count<T: Eq>(v: &[T], x: T) -> uint { * When function `f` returns true then an option containing the element * is returned. If `f` matches no elements then none is returned. */ -pure fn find<T: copy>(v: &[T], f: fn(T) -> bool) -> Option<T> { +pure fn find<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> { find_between(v, 0u, len(v), f) } @@ -925,7 +925,7 @@ pure fn find<T: copy>(v: &[T], f: fn(T) -> bool) -> Option<T> { * [`start`, `end`). When function `f` returns true then an option containing * the element is returned. If `f` matches no elements then none is returned. */ -pure fn find_between<T: copy>(v: &[T], start: uint, end: uint, +pure fn find_between<T: Copy>(v: &[T], start: uint, end: uint, f: fn(T) -> bool) -> Option<T> { option::map(position_between(v, start, end, f), |i| v[i]) } @@ -937,7 +937,7 @@ pure fn find_between<T: copy>(v: &[T], start: uint, end: uint, * `f` returns true then an option containing the element is returned. If `f` * matches no elements then none is returned. */ -pure fn rfind<T: copy>(v: &[T], f: fn(T) -> bool) -> Option<T> { +pure fn rfind<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> { rfind_between(v, 0u, len(v), f) } @@ -948,7 +948,7 @@ pure fn rfind<T: copy>(v: &[T], f: fn(T) -> bool) -> Option<T> { * [`start`, `end`). When function `f` returns true then an option containing * the element is returned. If `f` matches no elements then none is returned. */ -pure fn rfind_between<T: copy>(v: &[T], start: uint, end: uint, +pure fn rfind_between<T: Copy>(v: &[T], start: uint, end: uint, f: fn(T) -> bool) -> Option<T> { option::map(rposition_between(v, start, end, f), |i| v[i]) } @@ -1028,7 +1028,7 @@ pure fn rposition_between<T>(v: &[T], start: uint, end: uint, /** * Convert a vector of pairs into a pair of vectors, by reference. As unzip(). */ -pure fn unzip_slice<T: copy, U: copy>(v: &[(T, U)]) -> (~[T], ~[U]) { +pure fn unzip_slice<T: Copy, U: Copy>(v: &[(T, U)]) -> (~[T], ~[U]) { let mut as = ~[], bs = ~[]; for each(v) |p| { let (a, b) = p; @@ -1063,7 +1063,7 @@ pure fn unzip<T,U>(+v: ~[(T, U)]) -> (~[T], ~[U]) { /** * Convert two vectors to a vector of pairs, by reference. As zip(). */ -pure fn zip_slice<T: copy, U: copy>(v: &[const T], u: &[const U]) +pure fn zip_slice<T: Copy, U: Copy>(v: &[const T], u: &[const U]) -> ~[(T, U)] { let mut zipped = ~[]; let sz = len(v); @@ -1113,7 +1113,7 @@ fn reverse<T>(v: ~[mut T]) { /// Returns a vector with the order of elements reversed -pure fn reversed<T: copy>(v: &[const T]) -> ~[T] { +pure fn reversed<T: Copy>(v: &[const T]) -> ~[T] { let mut rs: ~[T] = ~[]; let mut i = len::<T>(v); if i == 0u { return rs; } else { i -= 1u; } @@ -1317,7 +1317,7 @@ pure fn riteri<T>(v: &[T], f: fn(uint, T)) { * The total number of permutations produced is `len(v)!`. If `v` contains * repeated elements, then some permutations are repeated. */ -pure fn permute<T: copy>(v: &[const T], put: fn(~[T])) { +pure fn permute<T: Copy>(v: &[const T], put: fn(~[T])) { let ln = len(v); if ln == 0u { put(~[]); @@ -1337,7 +1337,7 @@ pure fn permute<T: copy>(v: &[const T], put: fn(~[T])) { } } -pure fn windowed<TT: copy>(nn: uint, xx: &[TT]) -> ~[~[TT]] { +pure fn windowed<TT: Copy>(nn: uint, xx: &[TT]) -> ~[~[TT]] { let mut ww = ~[]; assert 1u <= nn; vec::iteri (xx, |ii, _x| { @@ -1480,14 +1480,14 @@ impl<T: Ord> @[T]: Ord { } #[cfg(notest)] -impl<T: copy> ~[T]: Add<&[const T],~[T]> { +impl<T: Copy> ~[T]: Add<&[const T],~[T]> { #[inline(always)] pure fn add(rhs: &[const T]) -> ~[T] { append(copy self, rhs) } } -impl<T: copy> ~[mut T]: Add<&[const T],~[mut T]> { +impl<T: Copy> ~[mut T]: Add<&[const T],~[mut T]> { #[inline(always)] pure fn add(rhs: &[const T]) -> ~[mut T] { append_mut(self, rhs) @@ -1522,7 +1522,7 @@ trait CopyableVector<T> { } /// Extension methods for vectors -impl<T: copy> &[const T]: CopyableVector<T> { +impl<T: Copy> &[const T]: CopyableVector<T> { /// Returns the first element of a vector #[inline] pure fn head() -> T { head(self) } @@ -1541,7 +1541,7 @@ impl<T: copy> &[const T]: CopyableVector<T> { } trait ImmutableVector<T> { - pure fn foldr<U: copy>(z: U, p: fn(T, U) -> U) -> U; + pure fn foldr<U: Copy>(z: U, p: fn(T, U) -> U) -> U; pure fn iter(f: fn(T)); pure fn iteri(f: fn(uint, T)); pure fn riter(f: fn(T)); @@ -1551,7 +1551,7 @@ trait ImmutableVector<T> { fn map_r<U>(f: fn(x: &T) -> U) -> ~[U]; pure fn alli(f: fn(uint, T) -> bool) -> bool; pure fn flat_map<U>(f: fn(T) -> ~[U]) -> ~[U]; - pure fn filter_map<U: copy>(f: fn(T) -> Option<U>) -> ~[U]; + pure fn filter_map<U: Copy>(f: fn(T) -> Option<U>) -> ~[U]; } trait ImmutableEqVector<T: Eq> { @@ -1565,7 +1565,7 @@ trait ImmutableEqVector<T: Eq> { impl<T> &[T]: ImmutableVector<T> { /// Reduce a vector from right to left #[inline] - pure fn foldr<U: copy>(z: U, p: fn(T, U) -> U) -> U { foldr(self, z, p) } + pure fn foldr<U: Copy>(z: U, p: fn(T, U) -> U) -> U { foldr(self, z, p) } /** * Iterates over a vector * @@ -1641,7 +1641,7 @@ impl<T> &[T]: ImmutableVector<T> { * the resulting vector. */ #[inline] - pure fn filter_map<U: copy>(f: fn(T) -> Option<U>) -> ~[U] { + pure fn filter_map<U: Copy>(f: fn(T) -> Option<U>) -> ~[U] { filter_map(self, f) } } @@ -1679,7 +1679,7 @@ trait ImmutableCopyableVector<T> { } /// Extension methods for vectors -impl<T: copy> &[T]: ImmutableCopyableVector<T> { +impl<T: Copy> &[T]: ImmutableCopyableVector<T> { /** * Construct a new vector from the elements of a vector for which some * predicate holds. @@ -1785,7 +1785,7 @@ mod unsafe { * Unchecked vector indexing. */ #[inline(always)] - unsafe fn get<T: copy>(v: &[const T], i: uint) -> T { + unsafe fn get<T: Copy>(v: &[const T], i: uint) -> T { as_buf(v, |p, _len| *ptr::offset(p, i)) } @@ -1938,7 +1938,7 @@ impl<A: Eq> &[A]: iter::EqIter<A> { } } -impl<A: copy> &[A]: iter::CopyableIter<A> { +impl<A: Copy> &[A]: iter::CopyableIter<A> { pure fn filter_to_vec(pred: fn(A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } @@ -1955,7 +1955,7 @@ impl<A: copy> &[A]: iter::CopyableIter<A> { pure fn find(p: fn(A) -> bool) -> Option<A> { iter::find(self, p) } } -impl<A: copy Ord> &[A]: iter::CopyableOrderedIter<A> { +impl<A: Copy Ord> &[A]: iter::CopyableOrderedIter<A> { pure fn min() -> A { iter::min(self) } pure fn max() -> A { iter::max(self) } } diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index b5af4af06c3..fb9a7e7e489 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -69,10 +69,10 @@ impl &Condvar { ****************************************************************************/ /// An atomically reference counted wrapper for shared immutable state. -struct ARC<T: const send> { x: SharedMutableState<T> } +struct ARC<T: Const Send> { x: SharedMutableState<T> } /// Create an atomically reference counted wrapper. -fn ARC<T: const send>(+data: T) -> ARC<T> { +fn ARC<T: Const Send>(+data: T) -> ARC<T> { ARC { x: unsafe { shared_mutable_state(data) } } } @@ -80,7 +80,7 @@ fn ARC<T: const send>(+data: T) -> ARC<T> { * Access the underlying data in an atomically reference counted * wrapper. */ -fn get<T: const send>(rc: &a/ARC<T>) -> &a/T { +fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T { unsafe { get_shared_immutable_state(&rc.x) } } @@ -91,7 +91,7 @@ fn get<T: const send>(rc: &a/ARC<T>) -> &a/T { * object. However, one of the `arc` objects can be sent to another task, * allowing them to share the underlying data. */ -fn clone<T: const send>(rc: &ARC<T>) -> ARC<T> { +fn clone<T: Const Send>(rc: &ARC<T>) -> ARC<T> { ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } } } @@ -104,7 +104,7 @@ fn clone<T: const send>(rc: &ARC<T>) -> ARC<T> { * unwrap from a task that holds another reference to the same ARC; it is * guaranteed to deadlock. */ -fn unwrap<T: const send>(+rc: ARC<T>) -> T { +fn unwrap<T: Const Send>(+rc: ARC<T>) -> T { let ARC { x: x } = rc; unsafe { unwrap_shared_mutable_state(x) } } @@ -114,19 +114,19 @@ fn unwrap<T: const send>(+rc: ARC<T>) -> T { ****************************************************************************/ #[doc(hidden)] -struct MutexARCInner<T: send> { lock: Mutex, failed: bool, data: T } +struct MutexARCInner<T: Send> { lock: Mutex, failed: bool, data: T } /// An ARC with mutable data protected by a blocking mutex. -struct MutexARC<T: send> { x: SharedMutableState<MutexARCInner<T>> } +struct MutexARC<T: Send> { x: SharedMutableState<MutexARCInner<T>> } /// Create a mutex-protected ARC with the supplied data. -fn MutexARC<T: send>(+user_data: T) -> MutexARC<T> { +fn MutexARC<T: Send>(+user_data: T) -> MutexARC<T> { mutex_arc_with_condvars(user_data, 1) } /** * Create a mutex-protected ARC with the supplied data and a specified number * of condvars (as sync::mutex_with_condvars). */ -fn mutex_arc_with_condvars<T: send>(+user_data: T, +fn mutex_arc_with_condvars<T: Send>(+user_data: T, num_condvars: uint) -> MutexARC<T> { let data = MutexARCInner { lock: mutex_with_condvars(num_condvars), @@ -134,7 +134,7 @@ fn mutex_arc_with_condvars<T: send>(+user_data: T, MutexARC { x: unsafe { shared_mutable_state(data) } } } -impl<T: send> &MutexARC<T> { +impl<T: Send> &MutexARC<T> { /// Duplicate a mutex-protected ARC, as arc::clone. fn clone() -> MutexARC<T> { // NB: Cloning the underlying mutex is not necessary. Its reference @@ -197,7 +197,7 @@ impl<T: send> &MutexARC<T> { * Will additionally fail if another task has failed while accessing the arc. */ // FIXME(#2585) make this a by-move method on the arc -fn unwrap_mutex_arc<T: send>(+arc: MutexARC<T>) -> T { +fn unwrap_mutex_arc<T: Send>(+arc: MutexARC<T>) -> T { let MutexARC { x: x } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let MutexARCInner { failed: failed, data: data, _ } = inner; @@ -240,27 +240,27 @@ fn PoisonOnFail(failed: &r/mut bool) -> PoisonOnFail/&r { ****************************************************************************/ #[doc(hidden)] -struct RWARCInner<T: const send> { lock: RWlock, failed: bool, data: T } +struct RWARCInner<T: Const Send> { lock: RWlock, failed: bool, data: T } /** * A dual-mode ARC protected by a reader-writer lock. The data can be accessed * mutably or immutably, and immutably-accessing tasks may run concurrently. * * Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested. */ -struct RWARC<T: const send> { +struct RWARC<T: Const Send> { x: SharedMutableState<RWARCInner<T>>, mut cant_nest: () } /// Create a reader/writer ARC with the supplied data. -fn RWARC<T: const send>(+user_data: T) -> RWARC<T> { +fn RWARC<T: Const Send>(+user_data: T) -> RWARC<T> { rw_arc_with_condvars(user_data, 1) } /** * Create a reader/writer ARC with the supplied data and a specified number * of condvars (as sync::rwlock_with_condvars). */ -fn rw_arc_with_condvars<T: const send>(+user_data: T, +fn rw_arc_with_condvars<T: Const Send>(+user_data: T, num_condvars: uint) -> RWARC<T> { let data = RWARCInner { lock: rwlock_with_condvars(num_condvars), @@ -268,7 +268,7 @@ fn rw_arc_with_condvars<T: const send>(+user_data: T, RWARC { x: unsafe { shared_mutable_state(data) }, cant_nest: () } } -impl<T: const send> &RWARC<T> { +impl<T: Const Send> &RWARC<T> { /// Duplicate a rwlock-protected ARC, as arc::clone. fn clone() -> RWARC<T> { RWARC { x: unsafe { clone_shared_mutable_state(&self.x) }, @@ -375,7 +375,7 @@ impl<T: const send> &RWARC<T> { * in write mode. */ // FIXME(#2585) make this a by-move method on the arc -fn unwrap_rw_arc<T: const send>(+arc: RWARC<T>) -> T { +fn unwrap_rw_arc<T: Const Send>(+arc: RWARC<T>) -> T { let RWARC { x: x, _ } = arc; let inner = unsafe { unwrap_shared_mutable_state(x) }; let RWARCInner { failed: failed, data: data, _ } = inner; @@ -389,19 +389,19 @@ fn unwrap_rw_arc<T: const send>(+arc: RWARC<T>) -> T { // lock it. This wraps the unsafety, with the justification that the 'lock' // field is never overwritten; only 'failed' and 'data'. #[doc(hidden)] -fn borrow_rwlock<T: const send>(state: &r/mut RWARCInner<T>) -> &r/RWlock { +fn borrow_rwlock<T: Const Send>(state: &r/mut RWARCInner<T>) -> &r/RWlock { unsafe { unsafe::transmute_immut(&mut state.lock) } } // FIXME (#3154) ice with struct/&<T> prevents these from being structs. /// The "write permission" token used for RWARC.write_downgrade(). -enum RWWriteMode<T: const send> = +enum RWWriteMode<T: Const Send> = (&mut T, sync::RWlockWriteMode, PoisonOnFail); /// The "read permission" token used for RWARC.write_downgrade(). -enum RWReadMode<T:const send> = (&T, sync::RWlockReadMode); +enum RWReadMode<T:Const Send> = (&T, sync::RWlockReadMode); -impl<T: const send> &RWWriteMode<T> { +impl<T: Const Send> &RWWriteMode<T> { /// Access the pre-downgrade RWARC in write mode. fn write<U>(blk: fn(x: &mut T) -> U) -> U { match *self { @@ -427,7 +427,7 @@ impl<T: const send> &RWWriteMode<T> { } } -impl<T: const send> &RWReadMode<T> { +impl<T: Const Send> &RWReadMode<T> { /// Access the post-downgrade rwlock in read mode. fn read<U>(blk: fn(x: &T) -> U) -> U { match *self { diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 5b0e9b0ffdd..53964fb0ddb 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -107,7 +107,7 @@ unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: fn@()) * * Fails if `ofs` is greater or equal to the length of the vector */ -fn get<T: copy>(t: CVec<T>, ofs: uint) -> T { +fn get<T: Copy>(t: CVec<T>, ofs: uint) -> T { assert ofs < len(t); return unsafe { *ptr::mut_offset((*t).base, ofs) }; } @@ -117,7 +117,7 @@ fn get<T: copy>(t: CVec<T>, ofs: uint) -> T { * * Fails if `ofs` is greater or equal to the length of the vector */ -fn set<T: copy>(t: CVec<T>, ofs: uint, v: T) { +fn set<T: Copy>(t: CVec<T>, ofs: uint, v: T) { assert ofs < len(t); unsafe { *ptr::mut_offset((*t).base, ofs) = v }; } diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index d286b496923..d78e11452bc 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -13,7 +13,7 @@ use pipes::{Channel, Recv, Chan, Port, Selectable}; export DuplexStream; /// An extension of `pipes::stream` that allows both sending and receiving. -struct DuplexStream<T: send, U: send> : Channel<T>, Recv<U>, Selectable { +struct DuplexStream<T: Send, U: Send> : Channel<T>, Recv<U>, Selectable { priv chan: Chan<T>, priv port: Port <U>, @@ -43,7 +43,7 @@ struct DuplexStream<T: send, U: send> : Channel<T>, Recv<U>, Selectable { } /// Creates a bidirectional stream. -fn DuplexStream<T: send, U: send>() +fn DuplexStream<T: Send, U: Send>() -> (DuplexStream<T, U>, DuplexStream<U, T>) { let (c2, p1) = pipes::stream(); diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 6cd229bc689..f9def4b2332 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -16,7 +16,7 @@ trait Deque<T> { // FIXME (#2343) eventually, a proper datatype plus an exported impl would // be preferrable. -fn create<T: copy>() -> Deque<T> { +fn create<T: Copy>() -> Deque<T> { type Cell<T> = Option<T>; let initial_capacity: uint = 32u; // 2^5 @@ -24,7 +24,7 @@ fn create<T: copy>() -> Deque<T> { * Grow is only called on full elts, so nelts is also len(elts), unlike * elsewhere. */ - fn grow<T: copy>(nelts: uint, lo: uint, -elts: ~[mut Cell<T>]) -> + fn grow<T: Copy>(nelts: uint, lo: uint, -elts: ~[mut Cell<T>]) -> ~[mut Cell<T>] { assert (nelts == vec::len(elts)); let mut rv = ~[mut]; @@ -40,7 +40,7 @@ fn create<T: copy>() -> Deque<T> { return rv; } - fn get<T: copy>(elts: DVec<Cell<T>>, i: uint) -> T { + fn get<T: Copy>(elts: DVec<Cell<T>>, i: uint) -> T { match elts.get_elt(i) { Some(t) => t, _ => fail } } @@ -49,7 +49,7 @@ fn create<T: copy>() -> Deque<T> { mut hi: uint, elts: DVec<Cell<T>>}; - impl <T: copy> Repr<T>: Deque<T> { + impl <T: Copy> Repr<T>: Deque<T> { fn size() -> uint { return self.nelts; } fn add_front(t: T) { let oldlo: uint = self.lo; @@ -193,7 +193,7 @@ mod tests { type EqFn<T> = fn@(T, T) -> bool; - fn test_parameterized<T: copy owned>( + fn test_parameterized<T: Copy Owned>( e: EqFn<T>, a: T, b: T, c: T, d: T) { let deq: deque::Deque<T> = deque::create::<T>(); diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index e7a92e5d8cc..3761b511402 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -33,7 +33,7 @@ enum TreeNode<K, V> { fn init<K, V>() -> Treemap<K, V> { @Empty } /// Insert a value into the map -fn insert<K: copy Eq Ord, V: copy>(m: Treemap<K, V>, +k: K, +v: V) +fn insert<K: Copy Eq Ord, V: Copy>(m: Treemap<K, V>, +k: K, +v: V) -> Treemap<K, V> { @match m { @Empty => Node(@k, @v, @Empty, @Empty), @@ -48,7 +48,7 @@ fn insert<K: copy Eq Ord, V: copy>(m: Treemap<K, V>, +k: K, +v: V) } /// Find a value based on the key -fn find<K: Eq Ord, V: copy>(m: Treemap<K, V>, +k: K) -> Option<V> { +fn find<K: Eq Ord, V: Copy>(m: Treemap<K, V>, +k: K) -> Option<V> { match *m { Empty => None, Node(@kk, @v, left, right) => { @@ -60,7 +60,7 @@ fn find<K: Eq Ord, V: copy>(m: Treemap<K, V>, +k: K) -> Option<V> { } /// Visit all pairs in the map in order. -fn traverse<K, V: copy>(m: Treemap<K, V>, f: fn(K, V)) { +fn traverse<K, V: Copy>(m: Treemap<K, V>, f: fn(K, V)) { match *m { Empty => (), /* diff --git a/src/libstd/json.rs b/src/libstd/json.rs index f2207f2a913..1adb41e8d10 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -720,7 +720,7 @@ impl <A: ToJson> ~[A]: ToJson { fn to_json() -> Json { List(@self.map(|elt| elt.to_json())) } } -impl <A: ToJson copy> hashmap<~str, A>: ToJson { +impl <A: ToJson Copy> hashmap<~str, A>: ToJson { fn to_json() -> Json { let d = map::str_hash(); for self.each() |key, value| { diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 71b820b4022..96d4e32d02b 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -13,7 +13,7 @@ enum List<T> { } /// Cregate a list from a vector -fn from_vec<T: copy>(v: &[T]) -> @List<T> { +fn from_vec<T: Copy>(v: &[T]) -> @List<T> { vec::foldr(v, @Nil::<T>, |h, t| @Cons(h, t)) } @@ -30,7 +30,7 @@ fn from_vec<T: copy>(v: &[T]) -> @List<T> { * * z - The initial value * * f - The function to apply */ -fn foldl<T: copy, U>(+z: T, ls: @List<U>, f: fn((&T), (&U)) -> T) -> T { +fn foldl<T: Copy, U>(+z: T, ls: @List<U>, f: fn((&T), (&U)) -> T) -> T { let mut accum: T = z; do iter(ls) |elt| { accum = f(&accum, &elt);} accum @@ -43,7 +43,7 @@ fn foldl<T: copy, U>(+z: T, ls: @List<U>, f: fn((&T), (&U)) -> T) -> T { * When function `f` returns true then an option containing the element * is returned. If `f` matches no elements then none is returned. */ -fn find<T: copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> { +fn find<T: Copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> { let mut ls = ls; loop { ls = match *ls { @@ -57,7 +57,7 @@ fn find<T: copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> { } /// Returns true if a list contains an element with the given value -fn has<T: copy Eq>(ls: @List<T>, +elt: T) -> bool { +fn has<T: Copy Eq>(ls: @List<T>, +elt: T) -> bool { for each(ls) |e| { if e == elt { return true; } } @@ -65,7 +65,7 @@ fn has<T: copy Eq>(ls: @List<T>, +elt: T) -> bool { } /// Returns true if the list is empty -pure fn is_empty<T: copy>(ls: @List<T>) -> bool { +pure fn is_empty<T: Copy>(ls: @List<T>) -> bool { match *ls { Nil => true, _ => false @@ -73,7 +73,7 @@ pure fn is_empty<T: copy>(ls: @List<T>) -> bool { } /// Returns true if the list is not empty -pure fn is_not_empty<T: copy>(ls: @List<T>) -> bool { +pure fn is_not_empty<T: Copy>(ls: @List<T>) -> bool { return !is_empty(ls); } @@ -85,7 +85,7 @@ fn len<T>(ls: @List<T>) -> uint { } /// Returns all but the first element of a list -pure fn tail<T: copy>(ls: @List<T>) -> @List<T> { +pure fn tail<T: Copy>(ls: @List<T>) -> @List<T> { match *ls { Cons(_, tl) => return tl, Nil => fail ~"list empty" @@ -93,7 +93,7 @@ pure fn tail<T: copy>(ls: @List<T>) -> @List<T> { } /// Returns the first element of a list -pure fn head<T: copy>(ls: @List<T>) -> T { +pure fn head<T: Copy>(ls: @List<T>) -> T { match *ls { Cons(hd, _) => hd, // makes me sad @@ -102,7 +102,7 @@ pure fn head<T: copy>(ls: @List<T>) -> T { } /// Appends one list to another -pure fn append<T: copy>(l: @List<T>, m: @List<T>) -> @List<T> { +pure fn append<T: Copy>(l: @List<T>, m: @List<T>) -> @List<T> { match *l { Nil => return m, Cons(x, xs) => { @@ -115,7 +115,7 @@ pure fn append<T: copy>(l: @List<T>, m: @List<T>) -> @List<T> { /* /// Push one element into the front of a list, returning a new list /// THIS VERSION DOESN'T ACTUALLY WORK -pure fn push<T: copy>(ll: &mut @list<T>, +vv: T) { +pure fn push<T: Copy>(ll: &mut @list<T>, +vv: T) { ll = &mut @cons(vv, *ll) } */ diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 603cff98721..5436ea1a803 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -24,7 +24,7 @@ type set<K:Eq IterBytes Hash> = hashmap<K, ()>; type hashmap<K:Eq IterBytes Hash, V> = chained::t<K, V>; -trait map<K:Eq IterBytes Hash copy, V: copy> { +trait map<K:Eq IterBytes Hash Copy, V: Copy> { /// Return the number of elements in the map pure fn size() -> uint; @@ -123,7 +123,7 @@ mod chained { found_after(@entry<K,V>, @entry<K,V>) } - priv impl<K:Eq IterBytes Hash, V: copy> t<K, V> { + priv impl<K:Eq IterBytes Hash, V: Copy> t<K, V> { pure fn search_rem(k: &K, h: uint, idx: uint, e_root: @entry<K,V>) -> search_result<K,V> { let mut e0 = e_root; @@ -207,7 +207,7 @@ mod chained { } } - impl<K:Eq IterBytes Hash copy, V: copy> t<K, V>: map<K, V> { + impl<K:Eq IterBytes Hash Copy, V: Copy> t<K, V>: map<K, V> { pure fn size() -> uint { self.count } fn contains_key(+k: K) -> bool { @@ -330,7 +330,7 @@ mod chained { } } - impl<K:Eq IterBytes Hash copy ToStr, V: ToStr copy> t<K, V>: ToStr { + impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> t<K, V>: ToStr { fn to_writer(wr: io::Writer) { if self.count == 0u { wr.write_str(~"{}"); @@ -356,7 +356,7 @@ mod chained { } } - impl<K:Eq IterBytes Hash copy, V: copy> t<K, V>: ops::Index<K, V> { + impl<K:Eq IterBytes Hash Copy, V: Copy> t<K, V>: ops::Index<K, V> { pure fn index(&&k: K) -> V { unchecked { self.get(k) @@ -368,7 +368,7 @@ mod chained { vec::to_mut(vec::from_elem(nchains, None)) } - fn mk<K:Eq IterBytes Hash, V: copy>() -> t<K,V> { + fn mk<K:Eq IterBytes Hash, V: Copy>() -> t<K,V> { let slf: t<K, V> = @hashmap_ {count: 0u, chains: chains(initial_capacity)}; slf @@ -380,48 +380,48 @@ Function: hashmap Construct a hashmap. */ -fn hashmap<K:Eq IterBytes Hash const, V: copy>() +fn hashmap<K:Eq IterBytes Hash Const, V: Copy>() -> hashmap<K, V> { chained::mk() } /// Construct a hashmap for string-slice keys -fn str_slice_hash<V: copy>() -> hashmap<&str, V> { +fn str_slice_hash<V: Copy>() -> hashmap<&str, V> { return hashmap(); } /// Construct a hashmap for string keys -fn str_hash<V: copy>() -> hashmap<~str, V> { +fn str_hash<V: Copy>() -> hashmap<~str, V> { return hashmap(); } /// Construct a hashmap for boxed string keys -fn box_str_hash<V: copy>() -> hashmap<@~str, V> { +fn box_str_hash<V: Copy>() -> hashmap<@~str, V> { hashmap() } /// Construct a hashmap for byte string keys -fn bytes_hash<V: copy>() -> hashmap<~[u8], V> { +fn bytes_hash<V: Copy>() -> hashmap<~[u8], V> { return hashmap(); } /// Construct a hashmap for int keys -fn int_hash<V: copy>() -> hashmap<int, V> { +fn int_hash<V: Copy>() -> hashmap<int, V> { return hashmap(); } /// Construct a hashmap for uint keys -fn uint_hash<V: copy>() -> hashmap<uint, V> { +fn uint_hash<V: Copy>() -> hashmap<uint, V> { return hashmap(); } /// Convenience function for adding keys to a hashmap with nil type keys -fn set_add<K:Eq IterBytes Hash const copy>(set: set<K>, +key: K) -> bool { +fn set_add<K:Eq IterBytes Hash Const Copy>(set: set<K>, +key: K) -> bool { set.insert(key, ()) } /// Convert a set into a vector. -fn vec_from_set<T:Eq IterBytes Hash copy>(s: set<T>) -> ~[T] { +fn vec_from_set<T:Eq IterBytes Hash Copy>(s: set<T>) -> ~[T] { let mut v = ~[]; vec::reserve(v, s.size()); do s.each_key() |k| { @@ -432,7 +432,7 @@ fn vec_from_set<T:Eq IterBytes Hash copy>(s: set<T>) -> ~[T] { } /// Construct a hashmap from a vector -fn hash_from_vec<K: Eq IterBytes Hash const copy, V: copy>( +fn hash_from_vec<K: Eq IterBytes Hash Const Copy, V: Copy>( items: &[(K, V)]) -> hashmap<K, V> { let map = hashmap(); do vec::iter(items) |item| { @@ -443,27 +443,27 @@ fn hash_from_vec<K: Eq IterBytes Hash const copy, V: copy>( } /// Construct a hashmap from a vector with string keys -fn hash_from_strs<V: copy>(items: &[(~str, V)]) -> hashmap<~str, V> { +fn hash_from_strs<V: Copy>(items: &[(~str, V)]) -> hashmap<~str, V> { hash_from_vec(items) } /// Construct a hashmap from a vector with byte keys -fn hash_from_bytes<V: copy>(items: &[(~[u8], V)]) -> hashmap<~[u8], V> { +fn hash_from_bytes<V: Copy>(items: &[(~[u8], V)]) -> hashmap<~[u8], V> { hash_from_vec(items) } /// Construct a hashmap from a vector with int keys -fn hash_from_ints<V: copy>(items: &[(int, V)]) -> hashmap<int, V> { +fn hash_from_ints<V: Copy>(items: &[(int, V)]) -> hashmap<int, V> { hash_from_vec(items) } /// Construct a hashmap from a vector with uint keys -fn hash_from_uints<V: copy>(items: &[(uint, V)]) -> hashmap<uint, V> { +fn hash_from_uints<V: Copy>(items: &[(uint, V)]) -> hashmap<uint, V> { hash_from_vec(items) } // XXX Transitional -impl<K: Eq IterBytes Hash copy, V: copy> Managed<LinearMap<K, V>>: +impl<K: Eq IterBytes Hash Copy, V: Copy> Managed<LinearMap<K, V>>: map<K, V> { pure fn size() -> uint { unchecked { diff --git a/src/libstd/par.rs b/src/libstd/par.rs index 1735765a474..d6e498c0a23 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -18,7 +18,7 @@ const min_granularity : uint = 1024u; * This is used to build most of the other parallel vector functions, * like map or alli. */ -fn map_slices<A: copy send, B: copy send>( +fn map_slices<A: Copy Send, B: Copy Send>( xs: &[A], f: fn() -> fn~(uint, v: &[A]) -> B) -> ~[B] { @@ -73,7 +73,7 @@ fn map_slices<A: copy send, B: copy send>( } /// A parallel version of map. -fn map<A: copy send, B: copy send>(xs: ~[A], f: fn~(A) -> B) -> ~[B] { +fn map<A: Copy Send, B: Copy Send>(xs: ~[A], f: fn~(A) -> B) -> ~[B] { vec::concat(map_slices(xs, || { fn~(_base: uint, slice : &[A], copy f) -> ~[B] { vec::map(slice, |x| f(x)) @@ -82,7 +82,7 @@ fn map<A: copy send, B: copy send>(xs: ~[A], f: fn~(A) -> B) -> ~[B] { } /// A parallel version of mapi. -fn mapi<A: copy send, B: copy send>(xs: ~[A], +fn mapi<A: Copy Send, B: Copy Send>(xs: ~[A], f: fn~(uint, A) -> B) -> ~[B] { let slices = map_slices(xs, || { fn~(base: uint, slice : &[A], copy f) -> ~[B] { @@ -103,7 +103,7 @@ fn mapi<A: copy send, B: copy send>(xs: ~[A], * In this case, f is a function that creates functions to run over the * inner elements. This is to skirt the need for copy constructors. */ -fn mapi_factory<A: copy send, B: copy send>( +fn mapi_factory<A: Copy Send, B: Copy Send>( xs: &[A], f: fn() -> fn~(uint, A) -> B) -> ~[B] { let slices = map_slices(xs, || { let f = f(); @@ -120,7 +120,7 @@ fn mapi_factory<A: copy send, B: copy send>( } /// Returns true if the function holds for all elements in the vector. -fn alli<A: copy send>(xs: ~[A], f: fn~(uint, A) -> bool) -> bool { +fn alli<A: Copy Send>(xs: ~[A], f: fn~(uint, A) -> bool) -> bool { do vec::all(map_slices(xs, || { fn~(base: uint, slice : &[A], copy f) -> bool { vec::alli(slice, |i, x| { @@ -131,7 +131,7 @@ fn alli<A: copy send>(xs: ~[A], f: fn~(uint, A) -> bool) -> bool { } /// Returns true if the function holds for any elements in the vector. -fn any<A: copy send>(xs: ~[A], f: fn~(A) -> bool) -> bool { +fn any<A: Copy Send>(xs: ~[A], f: fn~(A) -> bool) -> bool { do vec::any(map_slices(xs, || { fn~(_base : uint, slice: &[A], copy f) -> bool { vec::any(slice, |x| f(x)) diff --git a/src/libstd/serialization.rs b/src/libstd/serialization.rs index 411d18b72fc..743e2fc2bf1 100644 --- a/src/libstd/serialization.rs +++ b/src/libstd/serialization.rs @@ -93,7 +93,7 @@ fn emit_from_vec<S: serializer, T>(s: S, v: ~[T], f: fn(T)) { } } -fn read_to_vec<D: deserializer, T: copy>(d: D, f: fn() -> T) -> ~[T] { +fn read_to_vec<D: deserializer, T: Copy>(d: D, f: fn() -> T) -> ~[T] { do d.read_vec |len| { do vec::from_fn(len) |i| { d.read_vec_elt(i, || f()) @@ -112,11 +112,11 @@ impl<S: serializer> S: serializer_helpers { } trait deserializer_helpers { - fn read_to_vec<T: copy>(f: fn() -> T) -> ~[T]; + fn read_to_vec<T: Copy>(f: fn() -> T) -> ~[T]; } impl<D: deserializer> D: deserializer_helpers { - fn read_to_vec<T: copy>(f: fn() -> T) -> ~[T] { + fn read_to_vec<T: Copy>(f: fn() -> T) -> ~[T] { read_to_vec(self, f) } } @@ -256,7 +256,7 @@ fn serialize_Option<S: serializer,T>(s: S, v: Option<T>, st: fn(T)) { } } -fn deserialize_Option<D: deserializer,T: copy>(d: D, st: fn() -> T) +fn deserialize_Option<D: deserializer,T: Copy>(d: D, st: fn() -> T) -> Option<T> { do d.read_enum(~"option") { do d.read_enum_variant |i| { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 25cb53f7eaa..a65d41a2d32 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -12,14 +12,14 @@ use map::map; // FIXME (#2347): Should not be @; there's a bug somewhere in rustc that // requires this to be. -type SmallIntMap_<T: copy> = {v: DVec<Option<T>>}; +type SmallIntMap_<T: Copy> = {v: DVec<Option<T>>}; -enum SmallIntMap<T:copy> { +enum SmallIntMap<T:Copy> { SmallIntMap_(@SmallIntMap_<T>) } /// Create a smallintmap -fn mk<T: copy>() -> SmallIntMap<T> { +fn mk<T: Copy>() -> SmallIntMap<T> { let v = DVec(); return SmallIntMap_(@{v: v}); } @@ -29,7 +29,7 @@ fn mk<T: copy>() -> SmallIntMap<T> { * the specified key then the original value is replaced. */ #[inline(always)] -fn insert<T: copy>(self: SmallIntMap<T>, key: uint, +val: T) { +fn insert<T: Copy>(self: SmallIntMap<T>, key: uint, +val: T) { //io::println(fmt!("%?", key)); self.v.grow_set_elt(key, None, Some(val)); } @@ -38,7 +38,7 @@ fn insert<T: copy>(self: SmallIntMap<T>, key: uint, +val: T) { * Get the value for the specified key. If the key does not exist * in the map then returns none */ -pure fn find<T: copy>(self: SmallIntMap<T>, key: uint) -> Option<T> { +pure fn find<T: Copy>(self: SmallIntMap<T>, key: uint) -> Option<T> { if key < self.v.len() { return self.v.get_elt(key); } return None::<T>; } @@ -50,7 +50,7 @@ pure fn find<T: copy>(self: SmallIntMap<T>, key: uint) -> Option<T> { * * If the key does not exist in the map */ -pure fn get<T: copy>(self: SmallIntMap<T>, key: uint) -> T { +pure fn get<T: Copy>(self: SmallIntMap<T>, key: uint) -> T { match find(self, key) { None => { error!("smallintmap::get(): key not present"); @@ -61,12 +61,12 @@ pure fn get<T: copy>(self: SmallIntMap<T>, key: uint) -> T { } /// Returns true if the map contains a value for the specified key -fn contains_key<T: copy>(self: SmallIntMap<T>, key: uint) -> bool { +fn contains_key<T: Copy>(self: SmallIntMap<T>, key: uint) -> bool { return !option::is_none(find(self, key)); } /// Implements the map::map interface for smallintmap -impl<V: copy> SmallIntMap<V>: map::map<uint, V> { +impl<V: Copy> SmallIntMap<V>: map::map<uint, V> { pure fn size() -> uint { let mut sz = 0u; for self.v.each |item| { @@ -137,7 +137,7 @@ impl<V: copy> SmallIntMap<V>: map::map<uint, V> { } } -impl<V: copy> SmallIntMap<V>: ops::Index<uint, V> { +impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> { pure fn index(&&key: uint) -> V { unchecked { get(self, key) @@ -146,6 +146,6 @@ impl<V: copy> SmallIntMap<V>: ops::Index<uint, V> { } /// Cast the given smallintmap to a map::map -fn as_map<V: copy>(s: SmallIntMap<V>) -> map::map<uint, V> { +fn as_map<V: Copy>(s: SmallIntMap<V>) -> map::map<uint, V> { s as map::map::<uint, V> } diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 64ea19d35f9..488ae16c751 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -19,12 +19,12 @@ type Le<T> = pure fn(v1: &T, v2: &T) -> bool; * Has worst case O(n log n) performance, best case O(n), but * is not space efficient. This is a stable sort. */ -fn merge_sort<T: copy>(le: Le<T>, v: &[const T]) -> ~[T] { +fn merge_sort<T: Copy>(le: Le<T>, v: &[const T]) -> ~[T] { type Slice = (uint, uint); return merge_sort_(le, v, (0u, len(v))); - fn merge_sort_<T: copy>(le: Le<T>, v: &[const T], slice: Slice) + fn merge_sort_<T: Copy>(le: Le<T>, v: &[const T], slice: Slice) -> ~[T] { let begin = slice.first(); let end = slice.second(); @@ -39,7 +39,7 @@ fn merge_sort<T: copy>(le: Le<T>, v: &[const T]) -> ~[T] { return merge(le, merge_sort_(le, v, a), merge_sort_(le, v, b)); } - fn merge<T: copy>(le: Le<T>, a: &[T], b: &[T]) -> ~[T] { + fn merge<T: Copy>(le: Le<T>, a: &[T], b: &[T]) -> ~[T] { let mut rs = ~[]; vec::reserve(rs, len(a) + len(b)); let a_len = len(a); @@ -58,7 +58,7 @@ fn merge_sort<T: copy>(le: Le<T>, v: &[const T]) -> ~[T] { } } -fn part<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, +fn part<T: Copy>(compare_func: Le<T>, arr: &[mut T], left: uint, right: uint, pivot: uint) -> uint { let pivot_value = arr[pivot]; arr[pivot] <-> arr[right]; @@ -75,7 +75,7 @@ fn part<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, return storage_index; } -fn qsort<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, +fn qsort<T: Copy>(compare_func: Le<T>, arr: &[mut T], left: uint, right: uint) { if right > left { let pivot = (left + right) / 2u; @@ -94,12 +94,12 @@ fn qsort<T: copy>(compare_func: Le<T>, arr: &[mut T], left: uint, * Has worst case O(n^2) performance, average case O(n log n). * This is an unstable sort. */ -fn quick_sort<T: copy>(compare_func: Le<T>, arr: &[mut T]) { +fn quick_sort<T: Copy>(compare_func: Le<T>, arr: &[mut T]) { if len::<T>(arr) == 0u { return; } qsort::<T>(compare_func, arr, 0u, len::<T>(arr) - 1u); } -fn qsort3<T: copy Ord Eq>(arr: &[mut T], left: int, right: int) { +fn qsort3<T: Copy Ord Eq>(arr: &[mut T], left: int, right: int) { if right <= left { return; } let v: T = arr[right]; let mut i: int = left - 1; @@ -156,7 +156,7 @@ fn qsort3<T: copy Ord Eq>(arr: &[mut T], left: int, right: int) { * * This is an unstable sort. */ -fn quick_sort3<T: copy Ord Eq>(arr: &[mut T]) { +fn quick_sort3<T: Copy Ord Eq>(arr: &[mut T]) { if arr.len() <= 1 { return; } qsort3(arr, 0, (arr.len() - 1) as int); } @@ -165,7 +165,7 @@ trait Sort { fn qsort(self); } -impl<T: copy Ord Eq> &[mut T] : Sort { +impl<T: Copy Ord Eq> &[mut T] : Sort { fn qsort(self) { quick_sort3(self); } } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 45ab8d4c427..986a6e05225 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -70,10 +70,10 @@ struct SemInner<Q> { blocked: Q } #[doc(hidden)] -enum Sem<Q: send> = Exclusive<SemInner<Q>>; +enum Sem<Q: Send> = Exclusive<SemInner<Q>>; #[doc(hidden)] -fn new_sem<Q: send>(count: int, +q: Q) -> Sem<Q> { +fn new_sem<Q: Send>(count: int, +q: Q) -> Sem<Q> { Sem(exclusive(SemInner { mut count: count, waiters: new_waitqueue(), blocked: q })) } @@ -88,7 +88,7 @@ fn new_sem_and_signal(count: int, num_condvars: uint) } #[doc(hidden)] -impl<Q: send> &Sem<Q> { +impl<Q: Send> &Sem<Q> { fn acquire() { let mut waiter_nobe = None; unsafe { diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 25bc5e58c4e..bda489c3ba7 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -26,7 +26,7 @@ export delayed_send, sleep, recv_timeout; * * ch - a channel of type T to send a `val` on * * val - a value of type T to send over the provided `ch` */ -fn delayed_send<T: copy send>(iotask: IoTask, +fn delayed_send<T: Copy Send>(iotask: IoTask, msecs: uint, ch: comm::Chan<T>, +val: T) { unsafe { let timer_done_po = core::comm::Port::<()>(); @@ -102,7 +102,7 @@ fn sleep(iotask: IoTask, msecs: uint) { * on the provided port in the allotted timeout period, then the result will * be a `some(T)`. If not, then `none` will be returned. */ -fn recv_timeout<T: copy send>(iotask: IoTask, +fn recv_timeout<T: Copy Send>(iotask: IoTask, msecs: uint, wait_po: comm::Port<T>) -> Option<T> { let timeout_po = comm::Port::<()>(); diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 9d6c8dade61..a43821a0d37 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -32,7 +32,7 @@ enum TreeNode<K, V> = { fn TreeMap<K, V>() -> TreeMap<K, V> { @mut None } /// Insert a value into the map -fn insert<K: copy Eq Ord, V: copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { +fn insert<K: Copy Eq Ord, V: Copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { match copy *m { None => { *m = Some(@TreeNode({key: k, @@ -54,7 +54,7 @@ fn insert<K: copy Eq Ord, V: copy>(m: &mut TreeEdge<K, V>, +k: K, +v: V) { } /// Find a value based on the key -fn find<K: copy Eq Ord, V: copy>(m: &const TreeEdge<K, V>, +k: K) +fn find<K: Copy Eq Ord, V: Copy>(m: &const TreeEdge<K, V>, +k: K) -> Option<V> { match copy *m { None => None, @@ -73,7 +73,7 @@ fn find<K: copy Eq Ord, V: copy>(m: &const TreeEdge<K, V>, +k: K) } /// Visit all pairs in the map in order. -fn traverse<K, V: copy>(m: &const TreeEdge<K, V>, f: fn(K, V)) { +fn traverse<K, V: Copy>(m: &const TreeEdge<K, V>, f: fn(K, V)) { match copy *m { None => (), Some(node) => { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 97dcb922c43..474f0ede109 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -259,7 +259,7 @@ impl def_id : core::to_bytes::IterBytes { } } -fn new_def_hash<V: copy>() -> std::map::hashmap<ast::def_id, V> { +fn new_def_hash<V: Copy>() -> std::map::hashmap<ast::def_id, V> { return std::map::hashmap::<ast::def_id, V>(); } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 99296f72eb7..66553162b25 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -271,7 +271,7 @@ fn print_macro_backtrace(cm: codemap::codemap, sp: span) { } } -fn expect<T: copy>(diag: span_handler, +fn expect<T: Copy>(diag: span_handler, opt: Option<T>, msg: fn() -> ~str) -> T { match opt { Some(t) => t, diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index 32db095a1df..bb5af8402df 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -88,7 +88,7 @@ fn elts_to_ell(cx: ext_ctxt, elts: ~[@expr]) -> } } -fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> Option<U>, v: ~[T]) -> +fn option_flatten_map<T: Copy, U: Copy>(f: fn@(T) -> Option<U>, v: ~[T]) -> Option<~[U]> { let mut res = ~[]; for v.each |elem| { diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 6fc05e1f5bd..478288ba4cd 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -41,21 +41,21 @@ trait parser_common { fn check_restricted_keywords(); fn check_restricted_keywords_(w: ~str); fn expect_gt(); - fn parse_seq_to_before_gt<T: copy>(sep: Option<token::token>, + fn parse_seq_to_before_gt<T: Copy>(sep: Option<token::token>, f: fn(parser) -> T) -> ~[T]; - fn parse_seq_to_gt<T: copy>(sep: Option<token::token>, + fn parse_seq_to_gt<T: Copy>(sep: Option<token::token>, f: fn(parser) -> T) -> ~[T]; - fn parse_seq_lt_gt<T: copy>(sep: Option<token::token>, + fn parse_seq_lt_gt<T: Copy>(sep: Option<token::token>, f: fn(parser) -> T) -> spanned<~[T]>; - fn parse_seq_to_end<T: copy>(ket: token::token, sep: seq_sep, + fn parse_seq_to_end<T: Copy>(ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> ~[T]; - fn parse_seq_to_before_end<T: copy>(ket: token::token, sep: seq_sep, + fn parse_seq_to_before_end<T: Copy>(ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> ~[T]; - fn parse_unspanned_seq<T: copy>(bra: token::token, + fn parse_unspanned_seq<T: Copy>(bra: token::token, ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> ~[T]; - fn parse_seq<T: copy>(bra: token::token, ket: token::token, sep: seq_sep, + fn parse_seq<T: Copy>(bra: token::token, ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> spanned<~[T]>; } @@ -198,7 +198,7 @@ impl parser: parser_common { } } - fn parse_seq_to_before_gt<T: copy>(sep: Option<token::token>, + fn parse_seq_to_before_gt<T: Copy>(sep: Option<token::token>, f: fn(parser) -> T) -> ~[T] { let mut first = true; let mut v = ~[]; @@ -217,7 +217,7 @@ impl parser: parser_common { return v; } - fn parse_seq_to_gt<T: copy>(sep: Option<token::token>, + fn parse_seq_to_gt<T: Copy>(sep: Option<token::token>, f: fn(parser) -> T) -> ~[T] { let v = self.parse_seq_to_before_gt(sep, f); self.expect_gt(); @@ -225,7 +225,7 @@ impl parser: parser_common { return v; } - fn parse_seq_lt_gt<T: copy>(sep: Option<token::token>, + fn parse_seq_lt_gt<T: Copy>(sep: Option<token::token>, f: fn(parser) -> T) -> spanned<~[T]> { let lo = self.span.lo; self.expect(token::LT); @@ -235,7 +235,7 @@ impl parser: parser_common { return spanned(lo, hi, result); } - fn parse_seq_to_end<T: copy>(ket: token::token, sep: seq_sep, + fn parse_seq_to_end<T: Copy>(ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> ~[T] { let val = self.parse_seq_to_before_end(ket, sep, f); self.bump(); @@ -243,7 +243,7 @@ impl parser: parser_common { } - fn parse_seq_to_before_end<T: copy>(ket: token::token, sep: seq_sep, + fn parse_seq_to_before_end<T: Copy>(ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> ~[T] { let mut first: bool = true; let mut v: ~[T] = ~[]; @@ -261,7 +261,7 @@ impl parser: parser_common { return v; } - fn parse_unspanned_seq<T: copy>(bra: token::token, + fn parse_unspanned_seq<T: Copy>(bra: token::token, ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> ~[T] { @@ -273,7 +273,7 @@ impl parser: parser_common { // NB: Do not use this function unless you actually plan to place the // spanned list in the AST. - fn parse_seq<T: copy>(bra: token::token, ket: token::token, sep: seq_sep, + fn parse_seq<T: Copy>(bra: token::token, ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> spanned<~[T]> { let lo = self.span.lo; self.expect(bra); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 03a4c016b50..a38cc701dc3 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2278,15 +2278,7 @@ struct parser { let mut bounds = ~[]; if self.eat(token::COLON) { while is_ident(self.token) { - if self.eat_keyword(~"send") { - push(bounds, bound_send); } - else if self.eat_keyword(~"copy") { - push(bounds, bound_copy) } - else if self.eat_keyword(~"const") { - push(bounds, bound_const); - } else if self.eat_keyword(~"owned") { - push(bounds, bound_owned); - } else if is_ident(self.token) { + if is_ident(self.token) { // XXX: temporary until kinds become traits let maybe_bound = match self.token { token::IDENT(sid, _) => { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index c2099fa447f..cd7f75b15be 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -386,7 +386,7 @@ fn contextual_keyword_table() -> hashmap<~str, ()> { ~"else", ~"move", ~"priv", ~"pub", - ~"self", ~"send", ~"static", + ~"self", ~"static", ~"use" ]; for keys.each |word| { @@ -421,7 +421,6 @@ fn restricted_keyword_table() -> hashmap<~str, ()> { ~"if", ~"impl", ~"import", ~"let", ~"log", ~"loop", ~"match", ~"mod", ~"move", ~"mut", - ~"owned", ~"pure", ~"ref", ~"return", ~"struct", diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 3bf95983053..942963797cb 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1658,10 +1658,10 @@ fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) { for vec::each(*bounds) |bound| { nbsp(s); match bound { - ast::bound_copy => word(s.s, ~"copy"), - ast::bound_send => word(s.s, ~"send"), - ast::bound_const => word(s.s, ~"const"), - ast::bound_owned => word(s.s, ~"owned"), + ast::bound_copy => word(s.s, ~"Copy"), + ast::bound_send => word(s.s, ~"Send"), + ast::bound_const => word(s.s, ~"Const"), + ast::bound_owned => word(s.s, ~"Owned"), ast::bound_trait(t) => print_type(s, t) } } diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 59cdb6b98a7..ac2af21d087 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -8,18 +8,18 @@ use cmp::Eq; use hash::Hash; use to_bytes::IterBytes; -type hash_interner<T: const> = +type hash_interner<T: Const> = {map: hashmap<T, uint>, vect: DVec<T>}; -fn mk<T:Eq IterBytes Hash const copy>() -> interner<T> { +fn mk<T:Eq IterBytes Hash Const Copy>() -> interner<T> { let m = map::hashmap::<T, uint>(); let hi: hash_interner<T> = {map: m, vect: DVec()}; return hi as interner::<T>; } -fn mk_prefill<T:Eq IterBytes Hash const copy>(init: ~[T]) -> interner<T> { +fn mk_prefill<T:Eq IterBytes Hash Const Copy>(init: ~[T]) -> interner<T> { let rv = mk(); for init.each() |v| { rv.intern(v); } return rv; @@ -27,14 +27,14 @@ fn mk_prefill<T:Eq IterBytes Hash const copy>(init: ~[T]) -> interner<T> { /* when traits can extend traits, we should extend index<uint,T> to get [] */ -trait interner<T:Eq IterBytes Hash const copy> { +trait interner<T:Eq IterBytes Hash Const Copy> { fn intern(T) -> uint; fn gensym(T) -> uint; pure fn get(uint) -> T; fn len() -> uint; } -impl <T:Eq IterBytes Hash const copy> hash_interner<T>: interner<T> { +impl <T:Eq IterBytes Hash Const Copy> hash_interner<T>: interner<T> { fn intern(val: T) -> uint { match self.map.find(val) { Some(idx) => return idx, diff --git a/src/rustc/driver/session.rs b/src/rustc/driver/session.rs index 22946e556e8..0665c73137c 100644 --- a/src/rustc/driver/session.rs +++ b/src/rustc/driver/session.rs @@ -271,7 +271,7 @@ fn basic_options() -> @options { } // Seems out of place, but it uses session, so I'm putting it here -fn expect<T: copy>(sess: session, opt: Option<T>, msg: fn() -> ~str) -> T { +fn expect<T: Copy>(sess: session, opt: Option<T>, msg: fn() -> ~str) -> T { diagnostic::expect(sess.diagnostic(), opt, msg) } diff --git a/src/rustc/front/core_inject.rs b/src/rustc/front/core_inject.rs index 7bdd2f06485..f198a2ca79d 100644 --- a/src/rustc/front/core_inject.rs +++ b/src/rustc/front/core_inject.rs @@ -22,7 +22,7 @@ fn use_core(crate: @ast::crate) -> bool { fn inject_libcore_ref(sess: session, crate: @ast::crate) -> @ast::crate { - fn spanned<T: copy>(x: T) -> @ast::spanned<T> { + fn spanned<T: Copy>(x: T) -> @ast::spanned<T> { return @{node: x, span: dummy_sp()}; } diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index e5245febbe8..5ac62379e76 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -212,7 +212,7 @@ fn mk_test_module(cx: test_ctxt) -> @ast::item { return @item; } -fn nospan<T: copy>(t: T) -> ast::spanned<T> { +fn nospan<T: Copy>(t: T) -> ast::spanned<T> { return {node: t, span: dummy_sp()}; } diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 41db162b954..560dc384299 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -866,7 +866,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::Writer, // Path and definition ID indexing -fn create_index<T: copy>(index: ~[entry<T>], hash_fn: fn@(T) -> uint) -> +fn create_index<T: Copy>(index: ~[entry<T>], hash_fn: fn@(T) -> uint) -> ~[@~[entry<T>]] { let mut buckets: ~[@mut ~[entry<T>]] = ~[]; for uint::range(0u, 256u) |_i| { vec::push(buckets, @mut ~[]); }; diff --git a/src/rustc/metadata/filesearch.rs b/src/rustc/metadata/filesearch.rs index 26363806da0..0384225de12 100644 --- a/src/rustc/metadata/filesearch.rs +++ b/src/rustc/metadata/filesearch.rs @@ -67,7 +67,7 @@ fn mk_filesearch(maybe_sysroot: Option<Path>, target_triple: str::from_slice(target_triple)} as filesearch } -fn search<T: copy>(filesearch: filesearch, pick: pick<T>) -> Option<T> { +fn search<T: Copy>(filesearch: filesearch, pick: pick<T>) -> Option<T> { let mut rslt = None; for filesearch.lib_search_paths().each |lib_search_path| { debug!("searching %s", lib_search_path.to_str()); diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs index 70f12581245..1286a95aa02 100644 --- a/src/rustc/middle/borrowck.rs +++ b/src/rustc/middle/borrowck.rs @@ -396,7 +396,7 @@ type req_maps = { pure_map: hashmap<ast::node_id, bckerr> }; -fn save_and_restore<T:copy,U>(&save_and_restore_t: T, f: fn() -> U) -> U { +fn save_and_restore<T:Copy,U>(&save_and_restore_t: T, f: fn() -> U) -> U { let old_save_and_restore_t = save_and_restore_t; let u <- f(); save_and_restore_t = old_save_and_restore_t; diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 18bbb432e39..94786aa8a89 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -308,7 +308,7 @@ fn Atom(n: uint) -> Atom { } /// Creates a hash table of atoms. -fn atom_hashmap<V:copy>() -> hashmap<Atom,V> { +fn atom_hashmap<V:Copy>() -> hashmap<Atom,V> { hashmap::<Atom,V>() } diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs index 2e5b06f0a55..056d3598a32 100644 --- a/src/rustc/middle/trans/debuginfo.rs +++ b/src/rustc/middle/trans/debuginfo.rs @@ -129,7 +129,7 @@ enum debug_metadata { retval_metadata(@metadata<retval_md>), } -fn cast_safely<T: copy, U>(val: T) -> U unsafe { +fn cast_safely<T: Copy, U>(val: T) -> U unsafe { let val2 = val; return unsafe::transmute(val2); } @@ -147,7 +147,7 @@ fn md_from_metadata<T>(val: debug_metadata) -> T unsafe { } } -fn cached_metadata<T: copy>(cache: metadata_cache, mdtag: int, +fn cached_metadata<T: Copy>(cache: metadata_cache, mdtag: int, eq: fn(md: T) -> bool) -> Option<T> unsafe { if cache.contains_key(mdtag) { let items = cache.get(mdtag); diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index 6fee6f22fe0..d65b0e1978c 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -58,7 +58,7 @@ fn mk_nominal_id(tcx: ty::ctxt, did: ast::def_id, @{did: did, parent_id: parent_id, tps: tps_norm} } -fn new_nominal_id_hash<T: copy>() -> hashmap<nominal_id, T> { +fn new_nominal_id_hash<T: Copy>() -> hashmap<nominal_id, T> { return hashmap(); } diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index b8679a3818a..e6476b57e70 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -799,7 +799,7 @@ fn mk_rcache() -> creader_cache { return map::hashmap(); } -fn new_ty_hash<V: copy>() -> map::hashmap<t, V> { +fn new_ty_hash<V: Copy>() -> map::hashmap<t, V> { map::hashmap() } @@ -2568,7 +2568,7 @@ pure fn hash_bound_region(br: &bound_region) -> uint { } } -fn br_hashmap<V:copy>() -> hashmap<bound_region, V> { +fn br_hashmap<V:Copy>() -> hashmap<bound_region, V> { map::hashmap() } @@ -3081,7 +3081,7 @@ fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) { // Maintains a little union-set tree for inferred modes. `canon()` returns // the current head value for `m0`. -fn canon<T:copy>(tbl: hashmap<ast::node_id, ast::inferable<T>>, +fn canon<T:Copy>(tbl: hashmap<ast::node_id, ast::inferable<T>>, +m0: ast::inferable<T>) -> ast::inferable<T> { match m0 { ast::infer(id) => match tbl.find(id) { diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs index 85bac78da97..2ac872117e3 100644 --- a/src/rustc/middle/typeck/astconv.rs +++ b/src/rustc/middle/typeck/astconv.rs @@ -69,7 +69,7 @@ fn get_region_reporting_err(tcx: ty::ctxt, } } -fn ast_region_to_region<AC: ast_conv, RS: region_scope copy owned>( +fn ast_region_to_region<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, span: span, a_r: @ast::region) -> ty::region { let res = match a_r.node { @@ -80,7 +80,7 @@ fn ast_region_to_region<AC: ast_conv, RS: region_scope copy owned>( get_region_reporting_err(self.tcx(), span, res) } -fn ast_path_to_substs_and_ty<AC: ast_conv, RS: region_scope copy owned>( +fn ast_path_to_substs_and_ty<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, did: ast::def_id, path: @ast::path) -> ty_param_substs_and_ty { @@ -129,7 +129,7 @@ fn ast_path_to_substs_and_ty<AC: ast_conv, RS: region_scope copy owned>( {substs: substs, ty: ty::subst(tcx, &substs, decl_ty)} } -fn ast_path_to_ty<AC: ast_conv, RS: region_scope copy owned>( +fn ast_path_to_ty<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, did: ast::def_id, @@ -152,10 +152,10 @@ const NO_TPS: uint = 2u; // Parses the programmer's textual representation of a type into our // internal notion of a type. `getter` is a function that returns the type // corresponding to a definition ID: -fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>( +fn ast_ty_to_ty<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, &&ast_ty: @ast::ty) -> ty::t { - fn ast_mt_to_mt<AC: ast_conv, RS: region_scope copy owned>( + fn ast_mt_to_mt<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, mt: ast::mt) -> ty::mt { return {ty: ast_ty_to_ty(self, rscope, mt.ty), mutbl: mt.mutbl}; @@ -164,7 +164,7 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>( // Handle @, ~, and & being able to mean estrs and evecs. // If a_seq_ty is a str or a vec, make it an estr/evec. // Also handle function sigils and first-class trait types. - fn mk_maybe_vstore<AC: ast_conv, RS: region_scope copy owned>( + fn mk_maybe_vstore<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, a_seq_ty: ast::mt, vst: ty::vstore, span: span, constr: fn(ty::mt) -> ty::t) -> ty::t { @@ -400,7 +400,7 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>( return typ; } -fn ty_of_arg<AC: ast_conv, RS: region_scope copy owned>( +fn ty_of_arg<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, a: ast::arg, expected_ty: Option<ty::arg>) -> ty::arg { @@ -445,7 +445,7 @@ fn ty_of_arg<AC: ast_conv, RS: region_scope copy owned>( {mode: mode, ty: ty} } -fn ast_proto_to_proto<AC: ast_conv, RS: region_scope copy owned>( +fn ast_proto_to_proto<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, span: span, ast_proto: ast::proto) -> ty::fn_proto { match ast_proto { ast::proto_bare => @@ -465,7 +465,7 @@ fn ast_proto_to_proto<AC: ast_conv, RS: region_scope copy owned>( type expected_tys = Option<{inputs: ~[ty::arg], output: ty::t}>; -fn ty_of_fn_decl<AC: ast_conv, RS: region_scope copy owned>( +fn ty_of_fn_decl<AC: ast_conv, RS: region_scope Copy Owned>( self: AC, rscope: RS, ast_proto: ast::proto, purity: ast::purity, diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index 96d9bf1e2e5..f63f6f2e125 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -1203,7 +1203,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, // through the `unpack` function. It there is no expected type or // resolution is not possible (e.g., no constraints yet present), just // returns `none`. - fn unpack_expected<O: copy>(fcx: @fn_ctxt, expected: Option<ty::t>, + fn unpack_expected<O: Copy>(fcx: @fn_ctxt, expected: Option<ty::t>, unpack: fn(ty::sty) -> Option<O>) -> Option<O> { match expected { diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index 3206d1709c5..0a06e554724 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -75,7 +75,7 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { } impl @crate_ctxt { - fn to_ty<RS: region_scope copy owned>( + fn to_ty<RS: region_scope Copy Owned>( rs: RS, ast_ty: @ast::ty) -> ty::t { ast_ty_to_ty(self, rs, ast_ty) diff --git a/src/rustc/middle/typeck/infer.rs b/src/rustc/middle/typeck/infer.rs index cbda05a4012..2aef5ff6b5b 100644 --- a/src/rustc/middle/typeck/infer.rs +++ b/src/rustc/middle/typeck/infer.rs @@ -298,8 +298,8 @@ export assignment; export root, to_str; export int_ty_set_all; -type bound<T:copy> = Option<T>; -type bounds<T:copy> = {lb: bound<T>, ub: bound<T>}; +type bound<T:Copy> = Option<T>; +type bounds<T:Copy> = {lb: bound<T>, ub: bound<T>}; type cres<T> = Result<T,ty::type_err>; // "combine result" type ures = cres<()>; // "unify result" @@ -348,7 +348,7 @@ fn fixup_err_to_str(f: fixup_err) -> ~str { } } -fn new_vals_and_bindings<V:copy, T:copy>() -> vals_and_bindings<V, T> { +fn new_vals_and_bindings<V:Copy, T:Copy>() -> vals_and_bindings<V, T> { vals_and_bindings { vals: smallintmap::mk(), mut bindings: ~[] @@ -458,12 +458,12 @@ fn resolve_borrowings(cx: infer_ctxt) { */ trait then { - fn then<T:copy>(f: fn() -> Result<T,ty::type_err>) + fn then<T:Copy>(f: fn() -> Result<T,ty::type_err>) -> Result<T,ty::type_err>; } impl ures: then { - fn then<T:copy>(f: fn() -> Result<T,ty::type_err>) + fn then<T:Copy>(f: fn() -> Result<T,ty::type_err>) -> Result<T,ty::type_err> { self.chain(|_i| f()) } @@ -474,7 +474,7 @@ trait cres_helpers<T> { fn compare(t: T, f: fn() -> ty::type_err) -> cres<T>; } -impl<T:copy Eq> cres<T>: cres_helpers<T> { +impl<T:Copy Eq> cres<T>: cres_helpers<T> { fn to_ures() -> ures { match self { Ok(_v) => Ok(()), @@ -497,7 +497,7 @@ fn uok() -> ures { Ok(()) } -fn rollback_to<V:copy vid, T:copy>( +fn rollback_to<V:Copy vid, T:Copy>( vb: &vals_and_bindings<V, T>, len: uint) { while vb.bindings.len() != len { diff --git a/src/rustc/middle/typeck/infer/to_str.rs b/src/rustc/middle/typeck/infer/to_str.rs index f66685d766b..7acfdcac424 100644 --- a/src/rustc/middle/typeck/infer/to_str.rs +++ b/src/rustc/middle/typeck/infer/to_str.rs @@ -23,7 +23,7 @@ impl ty::region: to_str { } } -impl<V:copy to_str> bound<V>: to_str { +impl<V:Copy to_str> bound<V>: to_str { fn to_str(cx: infer_ctxt) -> ~str { match self { Some(v) => v.to_str(cx), @@ -32,7 +32,7 @@ impl<V:copy to_str> bound<V>: to_str { } } -impl<T:copy to_str> bounds<T>: to_str { +impl<T:Copy to_str> bounds<T>: to_str { fn to_str(cx: infer_ctxt) -> ~str { fmt!("{%s <: %s}", self.lb.to_str(cx), @@ -48,7 +48,7 @@ impl int_ty_set: to_str { } } -impl<V:copy vid, T:copy to_str> var_value<V, T>: to_str { +impl<V:Copy vid, T:Copy to_str> var_value<V, T>: to_str { fn to_str(cx: infer_ctxt) -> ~str { match self { redirect(vid) => fmt!("redirect(%s)", vid.to_str()), diff --git a/src/rustc/middle/typeck/infer/unify.rs b/src/rustc/middle/typeck/infer/unify.rs index 36c3093874a..2793d0e4f5a 100644 --- a/src/rustc/middle/typeck/infer/unify.rs +++ b/src/rustc/middle/typeck/infer/unify.rs @@ -3,24 +3,24 @@ use integral::*; use to_str::to_str; use std::smallintmap::SmallIntMap; -enum var_value<V:copy, T:copy> { +enum var_value<V:Copy, T:Copy> { redirect(V), root(T, uint), } -struct vals_and_bindings<V:copy, T:copy> { +struct vals_and_bindings<V:Copy, T:Copy> { vals: SmallIntMap<var_value<V, T>>, mut bindings: ~[(V, var_value<V, T>)], } -struct node<V:copy, T:copy> { +struct node<V:Copy, T:Copy> { root: V, possible_types: T, rank: uint, } impl infer_ctxt { - fn get<V:copy vid, T:copy>( + fn get<V:Copy vid, T:Copy>( vb: &vals_and_bindings<V, T>, vid: V) -> node<V, T> { let vid_u = vid.to_uint(); @@ -46,7 +46,7 @@ impl infer_ctxt { } } - fn set<V:copy vid, T:copy to_str>( + fn set<V:Copy vid, T:Copy to_str>( vb: &vals_and_bindings<V, T>, vid: V, +new_v: var_value<V, T>) { diff --git a/src/rustc/middle/typeck/rscope.rs b/src/rustc/middle/typeck/rscope.rs index 3826d3e527c..0224d6933a7 100644 --- a/src/rustc/middle/typeck/rscope.rs +++ b/src/rustc/middle/typeck/rscope.rs @@ -46,7 +46,7 @@ fn bound_self_region(rp: Option<ty::region_variance>) -> Option<ty::region> { } enum anon_rscope = {anon: ty::region, base: region_scope}; -fn in_anon_rscope<RS: region_scope copy owned>(self: RS, r: ty::region) +fn in_anon_rscope<RS: region_scope Copy Owned>(self: RS, r: ty::region) -> @anon_rscope { @anon_rscope({anon: r, base: self as region_scope}) } @@ -63,7 +63,7 @@ struct binding_rscope { base: region_scope, mut anon_bindings: uint, } -fn in_binding_rscope<RS: region_scope copy owned>(self: RS) +fn in_binding_rscope<RS: region_scope Copy Owned>(self: RS) -> @binding_rscope { let base = self as region_scope; @binding_rscope { base: base, anon_bindings: 0 } diff --git a/src/rustdoc/astsrv.rs b/src/rustdoc/astsrv.rs index a68f998e6fe..385f76873b3 100644 --- a/src/rustdoc/astsrv.rs +++ b/src/rustdoc/astsrv.rs @@ -88,7 +88,7 @@ fn act(po: comm::Port<msg>, source: ~str, parse: parser) { } } -fn exec<T:send>( +fn exec<T:Send>( srv: srv, +f: fn~(ctxt: ctxt) -> T ) -> T { diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs index d93e49aa841..6244d52c897 100644 --- a/src/rustdoc/attr_pass.rs +++ b/src/rustdoc/attr_pass.rs @@ -89,7 +89,7 @@ fn fold_item( } } -fn parse_item_attrs<T:send>( +fn parse_item_attrs<T:Send>( srv: astsrv::srv, id: doc::ast_id, +parse_attrs: fn~(~[ast::attribute]) -> T) -> T { diff --git a/src/rustdoc/fold.rs b/src/rustdoc/fold.rs index 5dcbfb664ea..a3a8fa5d6ae 100644 --- a/src/rustdoc/fold.rs +++ b/src/rustdoc/fold.rs @@ -50,7 +50,7 @@ type t<T> = { // This exists because fn types don't infer correctly as record // initializers, but they do as function arguments -fn mk_fold<T:copy>( +fn mk_fold<T:Copy>( ctxt: T, +fold_doc: fold_doc<T>, +fold_crate: fold_crate<T>, @@ -80,7 +80,7 @@ fn mk_fold<T:copy>( }) } -fn default_any_fold<T:send copy>(ctxt: T) -> fold<T> { +fn default_any_fold<T:Send Copy>(ctxt: T) -> fold<T> { mk_fold( ctxt, |f, d| default_seq_fold_doc(f, d), @@ -97,7 +97,7 @@ fn default_any_fold<T:send copy>(ctxt: T) -> fold<T> { ) } -fn default_seq_fold<T:copy>(ctxt: T) -> fold<T> { +fn default_seq_fold<T:Copy>(ctxt: T) -> fold<T> { mk_fold( ctxt, |f, d| default_seq_fold_doc(f, d), @@ -114,7 +114,7 @@ fn default_seq_fold<T:copy>(ctxt: T) -> fold<T> { ) } -fn default_par_fold<T:send copy>(ctxt: T) -> fold<T> { +fn default_par_fold<T:Send Copy>(ctxt: T) -> fold<T> { mk_fold( ctxt, |f, d| default_seq_fold_doc(f, d), @@ -163,7 +163,7 @@ fn default_seq_fold_item<T>( doc } -fn default_any_fold_mod<T:send copy>( +fn default_any_fold_mod<T:Send Copy>( fold: fold<T>, doc: doc::moddoc ) -> doc::moddoc { @@ -189,7 +189,7 @@ fn default_seq_fold_mod<T>( }) } -fn default_par_fold_mod<T:send copy>( +fn default_par_fold_mod<T:Send Copy>( fold: fold<T>, doc: doc::moddoc ) -> doc::moddoc { @@ -202,7 +202,7 @@ fn default_par_fold_mod<T:send copy>( }) } -fn default_any_fold_nmod<T:send copy>( +fn default_any_fold_nmod<T:Send Copy>( fold: fold<T>, doc: doc::nmoddoc ) -> doc::nmoddoc { @@ -228,7 +228,7 @@ fn default_seq_fold_nmod<T>( } } -fn default_par_fold_nmod<T:send copy>( +fn default_par_fold_nmod<T:Send Copy>( fold: fold<T>, doc: doc::nmoddoc ) -> doc::nmoddoc { diff --git a/src/test/auxiliary/cci_capture_clause.rs b/src/test/auxiliary/cci_capture_clause.rs index 27400322e40..68d24ed28cb 100644 --- a/src/test/auxiliary/cci_capture_clause.rs +++ b/src/test/auxiliary/cci_capture_clause.rs @@ -2,7 +2,7 @@ export foo; use comm::*; -fn foo<T: send copy>(x: T) -> Port<T> { +fn foo<T: Send Copy>(x: T) -> Port<T> { let p = Port(); let c = Chan(p); do task::spawn() |copy c, copy x| { diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index 8a714740550..6ead738753e 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -3,11 +3,11 @@ use dvec::DVec; type entry<A,B> = {key: A, value: B}; type alist<A,B> = { eq_fn: fn@(A,A) -> bool, data: DVec<entry<A,B>> }; -fn alist_add<A: copy, B: copy>(lst: alist<A,B>, k: A, v: B) { +fn alist_add<A: Copy, B: Copy>(lst: alist<A,B>, k: A, v: B) { lst.data.push({key:k, value:v}); } -fn alist_get<A: copy, B: copy>(lst: alist<A,B>, k: A) -> B { +fn alist_get<A: Copy, B: Copy>(lst: alist<A,B>, k: A) -> B { let eq_fn = lst.eq_fn; for lst.data.each |entry| { if eq_fn(entry.key, k) { return entry.value; } @@ -16,13 +16,13 @@ fn alist_get<A: copy, B: copy>(lst: alist<A,B>, k: A) -> B { } #[inline] -fn new_int_alist<B: copy>() -> alist<int, B> { +fn new_int_alist<B: Copy>() -> alist<int, B> { fn eq_int(&&a: int, &&b: int) -> bool { a == b } return {eq_fn: eq_int, data: DVec()}; } #[inline] -fn new_int_alist_2<B: copy>() -> alist<int, B> { +fn new_int_alist_2<B: Copy>() -> alist<int, B> { #[inline] fn eq_int(&&a: int, &&b: int) -> bool { a == b } return {eq_fn: eq_int, data: DVec()}; diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs index 14fe2b8fee9..ef977507dd2 100644 --- a/src/test/auxiliary/issue-2526.rs +++ b/src/test/auxiliary/issue-2526.rs @@ -7,18 +7,18 @@ use std; export context; -struct arc_destruct<T:const> { +struct arc_destruct<T:Const> { _data: int, drop {} } -fn arc_destruct<T: const>(data: int) -> arc_destruct<T> { +fn arc_destruct<T: Const>(data: int) -> arc_destruct<T> { arc_destruct { _data: data } } -fn arc<T: const>(_data: T) -> arc_destruct<T> { +fn arc<T: Const>(_data: T) -> arc_destruct<T> { arc_destruct(0) } diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index 35a35420636..4c3a6ea6121 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -10,6 +10,6 @@ use std::map::hashmap; type header_map = hashmap<~str, @DVec<@~str>>; // the unused ty param is necessary so this gets monomorphized -fn request<T: copy>(req: header_map) { +fn request<T: Copy>(req: header_map) { let _x = *(*req.get(~"METHOD"))[0u]; } diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index 954e1f66f51..cd011227c84 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -25,7 +25,7 @@ impl bool: read { } } -fn read<T: read copy>(s: ~str) -> T { +fn read<T: read Copy>(s: ~str) -> T { match readMaybe(s) { Some(x) => x, _ => fail ~"read failed!" diff --git a/src/test/auxiliary/test_comm.rs b/src/test/auxiliary/test_comm.rs index 20c5579e427..fed01e6a30e 100644 --- a/src/test/auxiliary/test_comm.rs +++ b/src/test/auxiliary/test_comm.rs @@ -18,16 +18,16 @@ export recv; * transmitted. If a port value is copied, both copies refer to the same * port. Ports may be associated with multiple `chan`s. */ -enum port<T: send> { +enum port<T: Send> { port_t(@port_ptr<T>) } /// Constructs a port -fn port<T: send>() -> port<T> { +fn port<T: Send>() -> port<T> { port_t(@port_ptr(rustrt::new_port(sys::size_of::<T>() as size_t))) } -struct port_ptr<T:send> { +struct port_ptr<T:Send> { po: *rust_port, drop unsafe { debug!("in the port_ptr destructor"); @@ -48,7 +48,7 @@ struct port_ptr<T:send> { } } -fn port_ptr<T: send>(po: *rust_port) -> port_ptr<T> { +fn port_ptr<T: Send>(po: *rust_port) -> port_ptr<T> { debug!("in the port_ptr constructor"); port_ptr { po: po @@ -59,11 +59,11 @@ fn port_ptr<T: send>(po: *rust_port) -> port_ptr<T> { * Receive from a port. If no data is available on the port then the * task will block until data becomes available. */ -fn recv<T: send>(p: port<T>) -> T { recv_((**p).po) } +fn recv<T: Send>(p: port<T>) -> T { recv_((**p).po) } /// Receive on a raw port pointer -fn recv_<T: send>(p: *rust_port) -> T { +fn recv_<T: Send>(p: *rust_port) -> T { let yield = 0u; let yieldp = ptr::addr_of(yield); let mut res; diff --git a/src/test/bench/pingpong.rs b/src/test/bench/pingpong.rs index 53132293de9..5e0f9072f6c 100644 --- a/src/test/bench/pingpong.rs +++ b/src/test/bench/pingpong.rs @@ -64,7 +64,7 @@ macro_rules! follow ( ) ) -fn switch<T: send, Tb: send, U>(+endp: pipes::RecvPacketBuffered<T, Tb>, +fn switch<T: Send, Tb: Send, U>(+endp: pipes::RecvPacketBuffered<T, Tb>, f: fn(+Option<T>) -> U) -> U { f(pipes::try_recv(endp)) } diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 6d46d2b597e..5437de9643a 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -15,14 +15,14 @@ fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str { return (xx as float) * 100f / (yy as float); } - pure fn le_by_val<TT: copy, UU: copy>(kv0: &(TT,UU), + pure fn le_by_val<TT: Copy, UU: Copy>(kv0: &(TT,UU), kv1: &(TT,UU)) -> bool { let (_, v0) = *kv0; let (_, v1) = *kv1; return v0 >= v1; } - pure fn le_by_key<TT: copy, UU: copy>(kv0: &(TT,UU), + pure fn le_by_key<TT: Copy, UU: Copy>(kv0: &(TT,UU), kv1: &(TT,UU)) -> bool { let (k0, _) = *kv0; let (k1, _) = *kv1; @@ -30,7 +30,7 @@ fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str { } // sort by key, then by value - fn sortKV<TT: copy, UU: copy>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] { + fn sortKV<TT: Copy, UU: Copy>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] { return sort::merge_sort(le_by_val, sort::merge_sort(le_by_key, orig)); } diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 578e9c433f3..5f907e55a1f 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -14,14 +14,14 @@ fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str { return (xx as float) * 100f / (yy as float); } - pure fn le_by_val<TT: copy, UU: copy>(kv0: &(TT,UU), + pure fn le_by_val<TT: Copy, UU: Copy>(kv0: &(TT,UU), kv1: &(TT,UU)) -> bool { let (_, v0) = *kv0; let (_, v1) = *kv1; return v0 >= v1; } - pure fn le_by_key<TT: copy, UU: copy>(kv0: &(TT,UU), + pure fn le_by_key<TT: Copy, UU: Copy>(kv0: &(TT,UU), kv1: &(TT,UU)) -> bool { let (k0, _) = *kv0; let (k1, _) = *kv1; @@ -29,7 +29,7 @@ fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str { } // sort by key, then by value - fn sortKV<TT: copy, UU: copy>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] { + fn sortKV<TT: Copy, UU: Copy>(orig: ~[(TT,UU)]) -> ~[(TT,UU)] { return sort::merge_sort(le_by_val, sort::merge_sort(le_by_key, orig)); } diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index 646488c61c8..0469e7e40bf 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -39,9 +39,9 @@ trait hash_key { pure fn eq(&&k: self) -> bool; } -fn mk_hash<K: const hash_key, V: copy>() -> map::hashmap<K, V> { - pure fn hashfn<K: const hash_key>(k: &K) -> uint { k.hash() } - pure fn hasheq<K: const hash_key>(k1: &K, k2: &K) -> bool { k1.eq(*k2) } +fn mk_hash<K: Const hash_key, V: Copy>() -> map::hashmap<K, V> { + pure fn hashfn<K: Const hash_key>(k: &K) -> uint { k.hash() } + pure fn hasheq<K: Const hash_key>(k1: &K, k2: &K) -> bool { k1.eq(*k2) } map::hashmap(hashfn, hasheq) } @@ -125,35 +125,35 @@ mod map_reduce { export reducer; export map_reduce; - type putter<K: send, V: send> = fn(K, V); + type putter<K: Send, V: Send> = fn(K, V); - type mapper<K1: send, K2: send, V: send> = fn~(K1, putter<K2, V>); + type mapper<K1: Send, K2: Send, V: Send> = fn~(K1, putter<K2, V>); - type getter<V: send> = fn() -> Option<V>; + type getter<V: Send> = fn() -> Option<V>; - type reducer<K: copy send, V: copy send> = fn~(K, getter<V>); + type reducer<K: Copy Send, V: Copy Send> = fn~(K, getter<V>); - enum ctrl_proto<K: copy send, V: copy send> { + enum ctrl_proto<K: Copy Send, V: Copy Send> { find_reducer(K, Chan<Chan<reduce_proto<V>>>), mapper_done } proto! ctrl_proto ( - open: send<K: copy send, V: copy send> { + open: send<K: Copy Send, V: Copy Send> { find_reducer(K) -> reducer_response<K, V>, mapper_done -> ! } - reducer_response: recv<K: copy send, V: copy send> { + reducer_response: recv<K: Copy Send, V: Copy Send> { reducer(Chan<reduce_proto<V>>) -> open<K, V> } ) - enum reduce_proto<V: copy send> { emit_val(V), done, addref, release } + enum reduce_proto<V: Copy Send> { emit_val(V), done, addref, release } - fn start_mappers<K1: copy send, K2: const copy send hash_key, - V: copy send>( + fn start_mappers<K1: Copy Send, K2: Const Copy Send hash_key, + V: Copy Send>( map: mapper<K1, K2, V>, &ctrls: ~[ctrl_proto::server::open<K2, V>], inputs: ~[K1]) @@ -169,7 +169,7 @@ mod map_reduce { return tasks; } - fn map_task<K1: copy send, K2: const copy send hash_key, V: copy send>( + fn map_task<K1: Copy Send, K2: Const Copy Send hash_key, V: Copy Send>( map: mapper<K1, K2, V>, ctrl: box<ctrl_proto::client::open<K2, V>>, input: K1) @@ -198,7 +198,7 @@ mod map_reduce { send(c.get(), emit_val(val)); } - fn finish<K: copy send, V: copy send>(_k: K, v: Chan<reduce_proto<V>>) + fn finish<K: Copy Send, V: Copy Send>(_k: K, v: Chan<reduce_proto<V>>) { send(v, release); } @@ -206,7 +206,7 @@ mod map_reduce { ctrl_proto::client::mapper_done(ctrl.unwrap()); } - fn reduce_task<K: copy send, V: copy send>( + fn reduce_task<K: Copy Send, V: Copy Send>( reduce: reducer<K, V>, key: K, out: Chan<Chan<reduce_proto<V>>>) @@ -218,7 +218,7 @@ mod map_reduce { let mut ref_count = 0; let mut is_done = false; - fn get<V: copy send>(p: Port<reduce_proto<V>>, + fn get<V: Copy Send>(p: Port<reduce_proto<V>>, &ref_count: int, &is_done: bool) -> Option<V> { while !is_done || ref_count > 0 { @@ -241,7 +241,7 @@ mod map_reduce { reduce(key, || get(p, ref_count, is_done) ); } - fn map_reduce<K1: copy send, K2: const copy send hash_key, V: copy send>( + fn map_reduce<K1: Copy Send, K2: Const Copy Send hash_key, V: Copy Send>( map: mapper<K1, K2, V>, reduce: reducer<K2, V>, inputs: ~[K1]) diff --git a/src/test/compile-fail/bad-method-typaram-kind.rs b/src/test/compile-fail/bad-method-typaram-kind.rs index 1da4ec8a626..8983d42a90b 100644 --- a/src/test/compile-fail/bad-method-typaram-kind.rs +++ b/src/test/compile-fail/bad-method-typaram-kind.rs @@ -3,11 +3,11 @@ fn foo<T>() { } trait bar { - fn bar<T:copy>(); + fn bar<T:Copy>(); } impl uint: bar { - fn bar<T:copy>() { + fn bar<T:Copy>() { } } diff --git a/src/test/compile-fail/fn-variance-2.rs b/src/test/compile-fail/fn-variance-2.rs index 6d9bdabae86..487860c01b1 100644 --- a/src/test/compile-fail/fn-variance-2.rs +++ b/src/test/compile-fail/fn-variance-2.rs @@ -1,4 +1,4 @@ -fn reproduce<T:copy>(t: T) -> fn@() -> T { +fn reproduce<T:Copy>(t: T) -> fn@() -> T { fn@() -> T { t } } diff --git a/src/test/compile-fail/fn-variance-3.rs b/src/test/compile-fail/fn-variance-3.rs index f9fe3d31fcc..576a9ba7675 100644 --- a/src/test/compile-fail/fn-variance-3.rs +++ b/src/test/compile-fail/fn-variance-3.rs @@ -1,4 +1,4 @@ -fn mk_identity<T:copy>() -> fn@(T) -> T { +fn mk_identity<T:Copy>() -> fn@(T) -> T { fn@(t: T) -> T { t } } diff --git a/src/test/compile-fail/infinite-instantiation.rs b/src/test/compile-fail/infinite-instantiation.rs index 090bb5e4f48..682b856afd0 100644 --- a/src/test/compile-fail/infinite-instantiation.rs +++ b/src/test/compile-fail/infinite-instantiation.rs @@ -11,7 +11,7 @@ impl uint: to_opt { } } -impl<T:copy> Option<T>: to_opt { +impl<T:Copy> Option<T>: to_opt { fn to_option() -> Option<Option<T>> { Some(self) } diff --git a/src/test/compile-fail/issue-2587-2.rs b/src/test/compile-fail/issue-2587-2.rs index db8d8f9fb7b..36cf99b321c 100644 --- a/src/test/compile-fail/issue-2587-2.rs +++ b/src/test/compile-fail/issue-2587-2.rs @@ -1,4 +1,4 @@ -fn foo<T: copy>(+_t: T) { fail; } +fn foo<T: Copy>(+_t: T) { fail; } fn bar<T>(+_t: T) { fail; } diff --git a/src/test/compile-fail/issue-2611-3.rs b/src/test/compile-fail/issue-2611-3.rs index 9a042fd1d0b..5545c0b2a13 100644 --- a/src/test/compile-fail/issue-2611-3.rs +++ b/src/test/compile-fail/issue-2611-3.rs @@ -7,7 +7,7 @@ import iter; import iter::BaseIter; trait A { - fn b<C:copy const, D>(x: C) -> C; + fn b<C:Copy Const, D>(x: C) -> C; } struct E { @@ -15,7 +15,7 @@ struct E { } impl E: A { - fn b<F:copy, G>(_x: F) -> F { fail } //~ ERROR in method `b`, type parameter 0 has 1 bound, but + fn b<F:Copy, G>(_x: F) -> F { fail } //~ ERROR in method `b`, type parameter 0 has 1 bound, but } fn main() {} \ No newline at end of file diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index 977cce73808..22674c06595 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -4,7 +4,7 @@ import iter; import iter::BaseIter; trait A { - fn b<C:copy, D>(x: C) -> C; + fn b<C:Copy, D>(x: C) -> C; } struct E { @@ -12,7 +12,7 @@ struct E { } impl E: A { - fn b<F:copy const, G>(_x: F) -> F { fail } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but + fn b<F:Copy Const, G>(_x: F) -> F { fail } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but } fn main() {} \ No newline at end of file diff --git a/src/test/compile-fail/issue-2611-5.rs b/src/test/compile-fail/issue-2611-5.rs index 99afe776f86..b01342282b2 100644 --- a/src/test/compile-fail/issue-2611-5.rs +++ b/src/test/compile-fail/issue-2611-5.rs @@ -4,7 +4,7 @@ import iter; import iter::BaseIter; trait A { - fn b<C:copy, D>(x: C) -> C; + fn b<C:Copy, D>(x: C) -> C; } struct E { @@ -13,7 +13,7 @@ struct E { impl E: A { // n.b. The error message is awful -- see #3404 - fn b<F:copy, G>(_x: G) -> G { fail } //~ ERROR method `b` has an incompatible type + fn b<F:Copy, G>(_x: G) -> G { fail } //~ ERROR method `b` has an incompatible type } fn main() {} \ No newline at end of file diff --git a/src/test/compile-fail/issue-2718-a.rs b/src/test/compile-fail/issue-2718-a.rs index 0feaa9b857e..b857af4e2f3 100644 --- a/src/test/compile-fail/issue-2718-a.rs +++ b/src/test/compile-fail/issue-2718-a.rs @@ -1,4 +1,4 @@ -struct send_packet<T: copy> { +struct send_packet<T: Copy> { p: T } diff --git a/src/test/compile-fail/issue-2766-a.rs b/src/test/compile-fail/issue-2766-a.rs index f2c6ded88d5..78225ba15ec 100644 --- a/src/test/compile-fail/issue-2766-a.rs +++ b/src/test/compile-fail/issue-2766-a.rs @@ -1,7 +1,7 @@ mod stream { - enum stream<T: send> { send(T, server::stream<T>), } + enum stream<T: Send> { send(T, server::stream<T>), } mod server { - impl<T: send> stream<T> { + impl<T: Send> stream<T> { fn recv() -> extern fn(+stream<T>) -> stream::stream<T> { // resolve really should report just one error here. // Change the test case when it changes. @@ -14,7 +14,7 @@ mod stream { recv } } - type stream<T: send> = pipes::RecvPacket<stream::stream<T>>; + type stream<T: Send> = pipes::RecvPacket<stream::stream<T>>; } } diff --git a/src/test/compile-fail/kindck-owned-trait-contains.rs b/src/test/compile-fail/kindck-owned-trait-contains.rs index 5d12ab9d517..c916bcba7c8 100644 --- a/src/test/compile-fail/kindck-owned-trait-contains.rs +++ b/src/test/compile-fail/kindck-owned-trait-contains.rs @@ -1,10 +1,10 @@ trait repeat<A> { fn get() -> A; } -impl<A:copy> @A: repeat<A> { +impl<A:Copy> @A: repeat<A> { fn get() -> A { *self } } -fn repeater<A:copy>(v: @A) -> repeat<A> { +fn repeater<A:Copy>(v: @A) -> repeat<A> { // Note: owned kind is not necessary as A appears in the trait type v as repeat::<A> // No } diff --git a/src/test/compile-fail/kindck-owned-trait-scoped.rs b/src/test/compile-fail/kindck-owned-trait-scoped.rs index 80a0e3bc0d5..5b39d3e4651 100644 --- a/src/test/compile-fail/kindck-owned-trait-scoped.rs +++ b/src/test/compile-fail/kindck-owned-trait-scoped.rs @@ -5,11 +5,11 @@ trait foo { fn foo(i: &self/int) -> int; } -impl<T:copy> T: foo { +impl<T:Copy> T: foo { fn foo(i: &self/int) -> int {*i} } -fn to_foo<T:copy>(t: T) { +fn to_foo<T:Copy>(t: T) { // This version is ok because, although T may contain borrowed // pointers, it never escapes the fn body. We know this because // the type of foo includes a region which will be resolved to @@ -19,13 +19,13 @@ fn to_foo<T:copy>(t: T) { assert x.foo(v) == 3; } -fn to_foo_2<T:copy>(t: T) -> foo { +fn to_foo_2<T:Copy>(t: T) -> foo { // Not OK---T may contain borrowed ptrs and it is going to escape // as part of the returned foo value {f:t} as foo //~ ERROR value may contain borrowed pointers; use `owned` bound } -fn to_foo_3<T:copy owned>(t: T) -> foo { +fn to_foo_3<T:Copy Owned>(t: T) -> foo { // OK---T may escape as part of the returned foo value, but it is // owned and hence does not contain borrowed ptrs {f:t} as foo diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs index 35009847c73..ea57fe5a6cf 100644 --- a/src/test/compile-fail/kindck-owned-trait.rs +++ b/src/test/compile-fail/kindck-owned-trait.rs @@ -1,10 +1,10 @@ trait foo { fn foo(); } -fn to_foo<T: copy foo>(t: T) -> foo { +fn to_foo<T: Copy foo>(t: T) -> foo { t as foo //~ ERROR value may contain borrowed pointers; use `owned` bound } -fn to_foo2<T: copy foo owned>(t: T) -> foo { +fn to_foo2<T: Copy foo Owned>(t: T) -> foo { t as foo } diff --git a/src/test/compile-fail/kindck-owned.rs b/src/test/compile-fail/kindck-owned.rs index e689292c45e..3e6a2f2946d 100644 --- a/src/test/compile-fail/kindck-owned.rs +++ b/src/test/compile-fail/kindck-owned.rs @@ -1,8 +1,8 @@ -fn copy1<T: copy>(t: T) -> fn@() -> T { +fn copy1<T: Copy>(t: T) -> fn@() -> T { fn@() -> T { t } //~ ERROR value may contain borrowed pointers } -fn copy2<T: copy owned>(t: T) -> fn@() -> T { +fn copy2<T: Copy Owned>(t: T) -> fn@() -> T { fn@() -> T { t } } diff --git a/src/test/compile-fail/liveness-use-after-send.rs b/src/test/compile-fail/liveness-use-after-send.rs index 6dfa9a997ff..5447c88e567 100644 --- a/src/test/compile-fail/liveness-use-after-send.rs +++ b/src/test/compile-fail/liveness-use-after-send.rs @@ -1,4 +1,4 @@ -fn send<T: send>(ch: _chan<T>, -data: T) { +fn send<T: Send>(ch: _chan<T>, -data: T) { log(debug, ch); log(debug, data); fail; diff --git a/src/test/compile-fail/non-const.rs b/src/test/compile-fail/non-const.rs index 37ba5830b10..d2cf08fc847 100644 --- a/src/test/compile-fail/non-const.rs +++ b/src/test/compile-fail/non-const.rs @@ -1,6 +1,6 @@ // Test that various non const things are rejected. -fn foo<T: const>(_x: T) { } +fn foo<T: Const>(_x: T) { } struct r { x:int, diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index 39eb825b80b..bd65fa41fd5 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -5,7 +5,7 @@ use core; -fn last<T: copy>(v: ~[const T]) -> core::Option<T> { +fn last<T: Copy>(v: ~[const T]) -> core::Option<T> { fail; } diff --git a/src/test/compile-fail/tps-invariant-trait.rs b/src/test/compile-fail/tps-invariant-trait.rs index 88039f234b5..b1525229658 100644 --- a/src/test/compile-fail/tps-invariant-trait.rs +++ b/src/test/compile-fail/tps-invariant-trait.rs @@ -7,7 +7,7 @@ enum box_impl<T> = { mut f: T }; -impl<T:copy> box_impl<T>: box_trait<T> { +impl<T:Copy> box_impl<T>: box_trait<T> { fn get() -> T { return self.f; } fn set(t: T) { self.f = t; } } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index afa8134e083..eea832c91a4 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -1,4 +1,4 @@ -fn f<T: send>(_i: T) { +fn f<T: Send>(_i: T) { } fn main() { diff --git a/src/test/compile-fail/vec-concat-bug.rs b/src/test/compile-fail/vec-concat-bug.rs index afbb57f5878..c21e337af60 100644 --- a/src/test/compile-fail/vec-concat-bug.rs +++ b/src/test/compile-fail/vec-concat-bug.rs @@ -1,4 +1,4 @@ -fn concat<T: copy>(v: ~[const ~[const T]]) -> ~[T] { +fn concat<T: Copy>(v: ~[const ~[const T]]) -> ~[T] { let mut r = ~[]; // Earlier versions of our type checker accepted this: diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index e376085772b..a6575143765 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -4,8 +4,8 @@ fn test00_start(ch: chan_t<int>, message: int) { send(ch, message); } type task_id = int; type port_id = int; -enum chan_t<T: send> = {task: task_id, port: port_id}; +enum chan_t<T: Send> = {task: task_id, port: port_id}; -fn send<T: send>(ch: chan_t<T>, data: T) { fail; } +fn send<T: Send>(ch: chan_t<T>, data: T) { fail; } fn main() { fail ~"quux"; } diff --git a/src/test/run-fail/issue-2444.rs b/src/test/run-fail/issue-2444.rs index ed8bd9173b5..20620ac62e8 100644 --- a/src/test/run-fail/issue-2444.rs +++ b/src/test/run-fail/issue-2444.rs @@ -3,7 +3,7 @@ use std; use std::arc; -enum e<T: const send> { e(arc::ARC<T>) } +enum e<T: Const Send> { e(arc::ARC<T>) } fn foo() -> e<int> {fail;} diff --git a/src/test/run-fail/port-type.rs b/src/test/run-fail/port-type.rs index 40d3067d4df..44ce6e524ca 100644 --- a/src/test/run-fail/port-type.rs +++ b/src/test/run-fail/port-type.rs @@ -5,7 +5,7 @@ use comm::Port; use comm::send; use comm::recv; -fn echo<T: send>(c: Chan<T>, oc: Chan<Chan<T>>) { +fn echo<T: Send>(c: Chan<T>, oc: Chan<Chan<T>>) { // Tests that the type argument in port gets // visited let p = Port::<T>(); diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 410bc9b570b..23cc80233fe 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -2,7 +2,7 @@ type pair<A,B> = { a: A, b: B }; -fn f<A:copy owned>(a: A, b: u16) -> fn@() -> (A, u16) { +fn f<A:Copy Owned>(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/alignment-gep-tup-like-2.rs b/src/test/run-pass/alignment-gep-tup-like-2.rs index dda856efb37..098c82b18d4 100644 --- a/src/test/run-pass/alignment-gep-tup-like-2.rs +++ b/src/test/run-pass/alignment-gep-tup-like-2.rs @@ -8,12 +8,12 @@ type _rec<A> = { mut rec: Option<@rec<A>> }; -fn make_cycle<A:copy>(a: A) { +fn make_cycle<A:Copy>(a: A) { let g: @rec<A> = @rec({val: a, mut rec: None}); g.rec = Some(g); } -fn f<A:send copy, B:send copy>(a: A, b: B) -> fn@() -> (A, B) { +fn f<A:Send Copy, B:Send Copy>(a: A, b: B) -> fn@() -> (A, B) { fn@() -> (A, B) { (a, b) } } diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index 522ead87c73..941a20f85e0 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -2,7 +2,7 @@ // -*- rust -*- -fn f<T: copy, U: copy>(x: T, y: U) -> {a: T, b: U} { return {a: x, b: y}; } +fn f<T: Copy, U: Copy>(x: T, y: U) -> {a: T, b: U} { return {a: x, b: y}; } fn main() { log(debug, f({x: 3, y: 4, z: 5}, 4).a.x); diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index ad3b1366fca..70e513a879d 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -1,4 +1,4 @@ -fn f<T: copy>(x: ~[T]) -> T { return x[0]; } +fn f<T: Copy>(x: ~[T]) -> T { return x[0]; } fn g(act: fn(~[int]) -> int) -> int { return act(~[1, 2, 3]); } diff --git a/src/test/run-pass/bounded-fn-type.rs b/src/test/run-pass/bounded-fn-type.rs index b21050f4d43..09f05d86d07 100644 --- a/src/test/run-pass/bounded-fn-type.rs +++ b/src/test/run-pass/bounded-fn-type.rs @@ -1,7 +1,7 @@ fn ignore<T>(_x: T) {} fn main() { - let f: fn@:send() = ||(); + let f: fn@:Send() = ||(); ignore(f); } diff --git a/src/test/run-pass/box-unbox.rs b/src/test/run-pass/box-unbox.rs index e189066c09f..27cb9846b3d 100644 --- a/src/test/run-pass/box-unbox.rs +++ b/src/test/run-pass/box-unbox.rs @@ -1,8 +1,8 @@ -type box<T: copy> = {c: @T}; +type box<T: Copy> = {c: @T}; -fn unbox<T: copy>(b: box<T>) -> T { return *b.c; } +fn unbox<T: Copy>(b: box<T>) -> T { return *b.c; } fn main() { let foo: int = 17; diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 316d98cd84a..665ee3cfe25 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -14,7 +14,7 @@ impl cat_type : cmp::Eq { // for any int value that's less than the meows field // ok: T should be in scope when resolving the trait ref for map -struct cat<T: copy> : map<int, T> { +struct cat<T: Copy> : map<int, T> { priv { // Yes, you can have negative meows mut meows : int, @@ -94,7 +94,7 @@ struct cat<T: copy> : map<int, T> { fn clear() { } } -fn cat<T: copy>(in_x : int, in_y : int, in_name: T) -> cat<T> { +fn cat<T: Copy>(in_x : int, in_y : int, in_name: T) -> cat<T> { cat { meows: in_x, how_hungry: in_y, diff --git a/src/test/run-pass/class-trait-bounded-param.rs b/src/test/run-pass/class-trait-bounded-param.rs index 91b3f68d5b2..2ffd41229a5 100644 --- a/src/test/run-pass/class-trait-bounded-param.rs +++ b/src/test/run-pass/class-trait-bounded-param.rs @@ -3,7 +3,7 @@ use std; use std::map::{map, hashmap, int_hash}; -class keys<K: copy, V: copy, M: copy map<K,V>> +class keys<K: Copy, V: Copy, M: Copy map<K,V>> : iter::base_iter<K> { let map: M; diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index ed0388b2bce..83f92e7a72d 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -6,7 +6,7 @@ type pair<A,B> = { a: A, b: B }; -fn f<A:copy owned>(a: A, b: u16) -> fn@() -> (A, u16) { +fn f<A:Copy Owned>(a: A, b: u16) -> fn@() -> (A, u16) { fn@() -> (A, u16) { (a, b) } } diff --git a/src/test/run-pass/const-bound.rs b/src/test/run-pass/const-bound.rs index e5e60f184f2..9d0d33524ef 100644 --- a/src/test/run-pass/const-bound.rs +++ b/src/test/run-pass/const-bound.rs @@ -2,7 +2,7 @@ // are const. -fn foo<T: copy const>(x: T) -> T { x } +fn foo<T: Copy Const>(x: T) -> T { x } fn main() { foo(1); diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs index ad3436c2b8f..ef0b2c2078d 100644 --- a/src/test/run-pass/expr-alt-generic-box2.rs +++ b/src/test/run-pass/expr-alt-generic-box2.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, eq: compare<T>) { let actual: T = match true { true => { expected }, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs index a227931180f..264f03ee2c3 100644 --- a/src/test/run-pass/expr-alt-generic-unique1.rs +++ b/src/test/run-pass/expr-alt-generic-unique1.rs @@ -3,7 +3,7 @@ // -*- rust -*- type compare<T> = fn@(~T, ~T) -> bool; -fn test_generic<T: copy>(expected: ~T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: ~T, eq: compare<T>) { let actual: ~T = match true { true => { expected }, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs index d92cde5d82a..e5c8d2acd87 100644 --- a/src/test/run-pass/expr-alt-generic-unique2.rs +++ b/src/test/run-pass/expr-alt-generic-unique2.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, eq: compare<T>) { let actual: T = match true { true => expected, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs index 0d1f5e2bbe8..d17d7db9038 100644 --- a/src/test/run-pass/expr-alt-generic.rs +++ b/src/test/run-pass/expr-alt-generic.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, eq: compare<T>) { let actual: T = match true { true => { expected }, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-box2.rs b/src/test/run-pass/expr-block-generic-box2.rs index 7935cec7f5d..8fc566d5843 100644 --- a/src/test/run-pass/expr-block-generic-box2.rs +++ b/src/test/run-pass/expr-block-generic-box2.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, eq: compare<T>) { let actual: T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs index df94544acd1..0ccabb2c081 100644 --- a/src/test/run-pass/expr-block-generic-unique1.rs +++ b/src/test/run-pass/expr-block-generic-unique1.rs @@ -3,7 +3,7 @@ // -*- rust -*- type compare<T> = fn@(~T, ~T) -> bool; -fn test_generic<T: copy>(expected: ~T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: ~T, eq: compare<T>) { let actual: ~T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-unique2.rs b/src/test/run-pass/expr-block-generic-unique2.rs index 51bb0274e7f..cda0148cfe8 100644 --- a/src/test/run-pass/expr-block-generic-unique2.rs +++ b/src/test/run-pass/expr-block-generic-unique2.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, eq: compare<T>) { let actual: T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs index 71e6f962e35..adb49f3142d 100644 --- a/src/test/run-pass/expr-block-generic.rs +++ b/src/test/run-pass/expr-block-generic.rs @@ -6,7 +6,7 @@ // Tests for standalone blocks as expressions with dynamic type sizes type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, eq: compare<T>) { let actual: T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index f181b3f3261..c2d27cf696c 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -9,7 +9,7 @@ fn test_vec() { } fn test_generic() { - fn f<T: copy>(t: T) -> T { t } + fn f<T: Copy>(t: T) -> T { t } assert (f(10) == 10); } diff --git a/src/test/run-pass/expr-if-generic-box2.rs b/src/test/run-pass/expr-if-generic-box2.rs index ef56bcd41dc..e5370db83d1 100644 --- a/src/test/run-pass/expr-if-generic-box2.rs +++ b/src/test/run-pass/expr-if-generic-box2.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, not_expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, not_expected: T, eq: compare<T>) { let actual: T = if true { expected } else { not_expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-if-generic.rs b/src/test/run-pass/expr-if-generic.rs index 1ad0b006592..5d7730809d5 100644 --- a/src/test/run-pass/expr-if-generic.rs +++ b/src/test/run-pass/expr-if-generic.rs @@ -6,7 +6,7 @@ // Tests for if as expressions with dynamic type sizes type compare<T> = fn@(T, T) -> bool; -fn test_generic<T: copy>(expected: T, not_expected: T, eq: compare<T>) { +fn test_generic<T: Copy>(expected: T, not_expected: T, eq: compare<T>) { let actual: T = if true { expected } else { not_expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/fixed-point-bind-unique.rs b/src/test/run-pass/fixed-point-bind-unique.rs index 95ebd437b88..2c7ef7fb125 100644 --- a/src/test/run-pass/fixed-point-bind-unique.rs +++ b/src/test/run-pass/fixed-point-bind-unique.rs @@ -1,8 +1,8 @@ -fn fix_help<A: owned, B: send>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { +fn fix_help<A: Owned, B: Send>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { return f({|a|fix_help(f, a)}, x); } -fn fix<A: owned, B: send>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { +fn fix<A: Owned, B: Send>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { return {|a|fix_help(f, a)}; } diff --git a/src/test/run-pass/fn-bare-spawn.rs b/src/test/run-pass/fn-bare-spawn.rs index 4ad9b5090cc..cc57ba6a9af 100644 --- a/src/test/run-pass/fn-bare-spawn.rs +++ b/src/test/run-pass/fn-bare-spawn.rs @@ -1,6 +1,6 @@ // This is what the signature to spawn should look like with bare functions -fn spawn<T: send>(val: T, f: extern fn(T)) { +fn spawn<T: Send>(val: T, f: extern fn(T)) { f(val); } diff --git a/src/test/run-pass/generic-alias-box.rs b/src/test/run-pass/generic-alias-box.rs index c273672f781..f140ad1b994 100644 --- a/src/test/run-pass/generic-alias-box.rs +++ b/src/test/run-pass/generic-alias-box.rs @@ -1,6 +1,6 @@ -fn id<T: copy>(t: T) -> T { return t; } +fn id<T: Copy>(t: T) -> T { return t; } fn main() { let expected = @100; diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index 79285589766..9d3ac09de7c 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -1,6 +1,6 @@ -fn id<T: copy send>(t: T) -> T { return t; } +fn id<T: Copy Send>(t: T) -> T { return t; } fn main() { let expected = ~100; diff --git a/src/test/run-pass/generic-box.rs b/src/test/run-pass/generic-box.rs index 3d871c896a8..fed97b99f8e 100644 --- a/src/test/run-pass/generic-box.rs +++ b/src/test/run-pass/generic-box.rs @@ -1,6 +1,6 @@ -fn box<T: copy>(x: {x: T, y: T, z: T}) -> @{x: T, y: T, z: T} { return @x; } +fn box<T: Copy>(x: {x: T, y: T, z: T}) -> @{x: T, y: T, z: T} { return @x; } fn main() { let x: @{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3}); diff --git a/src/test/run-pass/generic-derived-type.rs b/src/test/run-pass/generic-derived-type.rs index cb406e85980..f190e72b648 100644 --- a/src/test/run-pass/generic-derived-type.rs +++ b/src/test/run-pass/generic-derived-type.rs @@ -1,8 +1,8 @@ -fn g<X: copy>(x: X) -> X { return x; } +fn g<X: Copy>(x: X) -> X { return x; } -fn f<T: copy>(t: T) -> {a: T, b: T} { +fn f<T: Copy>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; diff --git a/src/test/run-pass/generic-drop-glue.rs b/src/test/run-pass/generic-drop-glue.rs index 15583f9904b..c6d16a4127c 100644 --- a/src/test/run-pass/generic-drop-glue.rs +++ b/src/test/run-pass/generic-drop-glue.rs @@ -1,5 +1,5 @@ -fn f<T: copy>(t: T) { let t1: T = t; } +fn f<T: Copy>(t: T) { let t1: T = t; } fn main() { let x = {x: @10, y: @12}; f(x); } diff --git a/src/test/run-pass/generic-exterior-box.rs b/src/test/run-pass/generic-exterior-box.rs index c683da09bdf..ff2221aeefb 100644 --- a/src/test/run-pass/generic-exterior-box.rs +++ b/src/test/run-pass/generic-exterior-box.rs @@ -1,8 +1,8 @@ -type recbox<T: copy> = {x: @T}; +type recbox<T: Copy> = {x: @T}; -fn reclift<T: copy>(t: T) -> recbox<T> { return {x: @t}; } +fn reclift<T: Copy>(t: T) -> recbox<T> { return {x: @t}; } fn main() { let foo: int = 17; diff --git a/src/test/run-pass/generic-exterior-unique.rs b/src/test/run-pass/generic-exterior-unique.rs index 227bb7066c4..61860d36b5e 100644 --- a/src/test/run-pass/generic-exterior-unique.rs +++ b/src/test/run-pass/generic-exterior-unique.rs @@ -1,6 +1,6 @@ -type recbox<T: copy> = {x: ~T}; +type recbox<T: Copy> = {x: ~T}; -fn reclift<T: copy>(t: T) -> recbox<T> { return {x: ~t}; } +fn reclift<T: Copy>(t: T) -> recbox<T> { return {x: ~t}; } fn main() { let foo: int = 17; diff --git a/src/test/run-pass/generic-fn-infer.rs b/src/test/run-pass/generic-fn-infer.rs index b375752d1a1..c7696259ec2 100644 --- a/src/test/run-pass/generic-fn-infer.rs +++ b/src/test/run-pass/generic-fn-infer.rs @@ -4,6 +4,6 @@ // -*- rust -*- // Issue #45: infer type parameters in function applications -fn id<T: copy>(x: T) -> T { return x; } +fn id<T: Copy>(x: T) -> T { return x; } fn main() { let x: int = 42; let y: int = id(x); assert (x == y); } diff --git a/src/test/run-pass/generic-fn-unique.rs b/src/test/run-pass/generic-fn-unique.rs index 7d54afd59eb..81fbd307d2a 100644 --- a/src/test/run-pass/generic-fn-unique.rs +++ b/src/test/run-pass/generic-fn-unique.rs @@ -1,4 +1,4 @@ -fn f<T: copy>(x: ~T) -> ~T { return x; } +fn f<T: Copy>(x: ~T) -> ~T { return x; } fn main() { let x = f(~3); log(debug, *x); } diff --git a/src/test/run-pass/generic-fn.rs b/src/test/run-pass/generic-fn.rs index fae711ae3ad..c7a38940caf 100644 --- a/src/test/run-pass/generic-fn.rs +++ b/src/test/run-pass/generic-fn.rs @@ -2,7 +2,7 @@ // -*- rust -*- -fn id<T: copy>(x: T) -> T { return x; } +fn id<T: Copy>(x: T) -> T { return x; } type triple = {x: int, y: int, z: int}; diff --git a/src/test/run-pass/generic-tup.rs b/src/test/run-pass/generic-tup.rs index b660592720c..1d37565be31 100644 --- a/src/test/run-pass/generic-tup.rs +++ b/src/test/run-pass/generic-tup.rs @@ -1,4 +1,4 @@ -fn get_third<T: copy>(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } +fn get_third<T: Copy>(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } fn main() { log(debug, get_third((1, 2, 3))); diff --git a/src/test/run-pass/generic-unique.rs b/src/test/run-pass/generic-unique.rs index 0572257a877..21daeac2ef7 100644 --- a/src/test/run-pass/generic-unique.rs +++ b/src/test/run-pass/generic-unique.rs @@ -1,5 +1,5 @@ -fn box<T: copy>(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { return ~x; } +fn box<T: Copy>(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { return ~x; } fn main() { let x: ~{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3}); diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs index a01b55f50c6..f4d045bb444 100644 --- a/src/test/run-pass/issue-2288.rs +++ b/src/test/run-pass/issue-2288.rs @@ -1,19 +1,19 @@ -trait clam<A: copy> { +trait clam<A: Copy> { fn chowder(y: A); } -struct foo<A: copy> : clam<A> { +struct foo<A: Copy> : clam<A> { x: A, fn chowder(y: A) { } } -fn foo<A: copy>(b: A) -> foo<A> { +fn foo<A: Copy>(b: A) -> foo<A> { foo { x: b } } -fn f<A: copy>(x: clam<A>, a: A) { +fn f<A: Copy>(x: clam<A>, a: A) { x.chowder(a); } diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs index 20c9b9ad947..ef3752d5fa7 100644 --- a/src/test/run-pass/issue-2311-2.rs +++ b/src/test/run-pass/issue-2311-2.rs @@ -1,12 +1,12 @@ -trait clam<A: copy> { } -struct foo<A: copy> { +trait clam<A: Copy> { } +struct foo<A: Copy> { x: A, fn bar<B,C:clam<A>>(c: C) -> B { fail; } } -fn foo<A: copy>(b: A) -> foo<A> { +fn foo<A: Copy>(b: A) -> foo<A> { foo { x: b } diff --git a/src/test/run-pass/issue-2445-b.rs b/src/test/run-pass/issue-2445-b.rs index 2318691aebe..0b650286020 100644 --- a/src/test/run-pass/issue-2445-b.rs +++ b/src/test/run-pass/issue-2445-b.rs @@ -1,16 +1,16 @@ -struct c1<T: copy> { +struct c1<T: Copy> { x: T, fn f1(x: int) { } } -fn c1<T: copy>(x: T) -> c1<T> { +fn c1<T: Copy>(x: T) -> c1<T> { c1 { x: x } } -impl<T: copy> c1<T> { +impl<T: Copy> c1<T> { fn f2(x: int) { } } diff --git a/src/test/run-pass/issue-2445.rs b/src/test/run-pass/issue-2445.rs index edb0fdf16ae..ae6cdf34e4d 100644 --- a/src/test/run-pass/issue-2445.rs +++ b/src/test/run-pass/issue-2445.rs @@ -1,17 +1,17 @@ use dvec::DVec; -struct c1<T: copy> { +struct c1<T: Copy> { x: T, fn f1(x: T) {} } -fn c1<T: copy>(x: T) -> c1<T> { +fn c1<T: Copy>(x: T) -> c1<T> { c1 { x: x } } -impl<T: copy> c1<T> { +impl<T: Copy> c1<T> { fn f2(x: T) {} } diff --git a/src/test/run-pass/issue-2550.rs b/src/test/run-pass/issue-2550.rs index 989818ef594..496fe3a4798 100644 --- a/src/test/run-pass/issue-2550.rs +++ b/src/test/run-pass/issue-2550.rs @@ -8,7 +8,7 @@ fn C(x: uint) -> C { } } -fn f<T:copy>(_x: T) { +fn f<T:Copy>(_x: T) { } #[deny(non_implicitly_copyable_typarams)] diff --git a/src/test/run-pass/issue-2611.rs b/src/test/run-pass/issue-2611.rs index 94456ecb25b..0d5c244abcb 100644 --- a/src/test/run-pass/issue-2611.rs +++ b/src/test/run-pass/issue-2611.rs @@ -1,11 +1,11 @@ use iter::BaseIter; trait FlatMapToVec<A> { - fn flat_map_to_vec<B:copy, IB:BaseIter<B>>(op: fn(A) -> IB) -> ~[B]; + fn flat_map_to_vec<B:Copy, IB:BaseIter<B>>(op: fn(A) -> IB) -> ~[B]; } -impl<A:copy> BaseIter<A>: FlatMapToVec<A> { - fn flat_map_to_vec<B:copy, IB:BaseIter<B>>(op: fn(A) -> IB) -> ~[B] { +impl<A:Copy> BaseIter<A>: FlatMapToVec<A> { + fn flat_map_to_vec<B:Copy, IB:BaseIter<B>>(op: fn(A) -> IB) -> ~[B] { iter::flat_map_to_vec(self, op) } } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 856e8c2c174..d878d3fcf4b 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -15,13 +15,13 @@ mod pipes { pure fn ne(&&other: state) -> bool { !self.eq(other) } } - type packet<T: send> = { + type packet<T: Send> = { mut state: state, mut blocked_task: Option<task::Task>, mut payload: Option<T> }; - fn packet<T: send>() -> *packet<T> unsafe { + fn packet<T: Send>() -> *packet<T> unsafe { let p: *packet<T> = unsafe::transmute(~{ mut state: empty, mut blocked_task: None::<task::Task>, @@ -55,7 +55,7 @@ mod pipes { } } - fn send<T: send>(-p: send_packet<T>, -payload: T) { + fn send<T: Send>(-p: send_packet<T>, -payload: T) { let p = p.unwrap(); let p = unsafe { uniquify(p) }; assert (*p).payload.is_none(); @@ -81,7 +81,7 @@ mod pipes { } } - fn recv<T: send>(-p: recv_packet<T>) -> Option<T> { + fn recv<T: Send>(-p: recv_packet<T>) -> Option<T> { let p = p.unwrap(); let p = unsafe { uniquify(p) }; loop { @@ -102,7 +102,7 @@ mod pipes { } } - fn sender_terminate<T: send>(p: *packet<T>) { + fn sender_terminate<T: Send>(p: *packet<T>) { let p = unsafe { uniquify(p) }; match swap_state_rel(&mut (*p).state, terminated) { empty | blocked => { @@ -119,7 +119,7 @@ mod pipes { } } - fn receiver_terminate<T: send>(p: *packet<T>) { + fn receiver_terminate<T: Send>(p: *packet<T>) { let p = unsafe { uniquify(p) }; match swap_state_rel(&mut (*p).state, terminated) { empty => { @@ -136,7 +136,7 @@ mod pipes { } } - struct send_packet<T: send> { + struct send_packet<T: Send> { mut p: Option<*packet<T>>, drop { if self.p != None { @@ -152,13 +152,13 @@ mod pipes { } } - fn send_packet<T: send>(p: *packet<T>) -> send_packet<T> { + fn send_packet<T: Send>(p: *packet<T>) -> send_packet<T> { send_packet { p: Some(p) } } - struct recv_packet<T: send> { + struct recv_packet<T: Send> { mut p: Option<*packet<T>>, drop { if self.p != None { @@ -174,13 +174,13 @@ mod pipes { } } - fn recv_packet<T: send>(p: *packet<T>) -> recv_packet<T> { + fn recv_packet<T: Send>(p: *packet<T>) -> recv_packet<T> { recv_packet { p: Some(p) } } - fn entangle<T: send>() -> (send_packet<T>, recv_packet<T>) { + fn entangle<T: Send>() -> (send_packet<T>, recv_packet<T>) { let p = packet(); (send_packet(p), recv_packet(p)) } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index a440d4f05d4..30a806d165d 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -1,7 +1,7 @@ trait hax { } impl <A> A: hax { } -fn perform_hax<T: owned>(x: @T) -> hax { +fn perform_hax<T: Owned>(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index 81fbae57105..0c9795cc5c3 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -1,7 +1,7 @@ trait hax { } impl <A> A: hax { } -fn perform_hax<T: owned>(x: @T) -> hax { +fn perform_hax<T: Owned>(x: @T) -> hax { x as hax } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index b4ae83bb702..741235554ac 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -45,7 +45,7 @@ fn square_from_char(c: char) -> square { } } -fn read_board_grid<rdr: owned io::Reader>(+in: rdr) -> ~[~[square]] { +fn read_board_grid<rdr: Owned io::Reader>(+in: rdr) -> ~[~[square]] { let in = in as io::Reader; let mut grid = ~[]; for in.each_line |line| { diff --git a/src/test/run-pass/issue-2930.rs b/src/test/run-pass/issue-2930.rs index 0d24f72cb23..98cfaded04a 100644 --- a/src/test/run-pass/issue-2930.rs +++ b/src/test/run-pass/issue-2930.rs @@ -1,5 +1,5 @@ proto! stream ( - stream:send<T:send> { + stream:send<T:Send> { send(T) -> stream<T> } ) diff --git a/src/test/run-pass/issue-3149.rs b/src/test/run-pass/issue-3149.rs index fe0f646e07d..47d72c53e3b 100644 --- a/src/test/run-pass/issue-3149.rs +++ b/src/test/run-pass/issue-3149.rs @@ -1,4 +1,4 @@ -pure fn Matrix4<T:copy Num>(m11: T, m12: T, m13: T, m14: T, +pure fn Matrix4<T:Copy Num>(m11: T, m12: T, m13: T, m14: T, m21: T, m22: T, m23: T, m24: T, m31: T, m32: T, m33: T, m34: T, m41: T, m42: T, m43: T, m44: T) @@ -12,7 +12,7 @@ pure fn Matrix4<T:copy Num>(m11: T, m12: T, m13: T, m14: T, } } -struct Matrix4<T:copy Num> { +struct Matrix4<T:Copy Num> { m11: T, m12: T, m13: T, m14: T, m21: T, m22: T, m23: T, m24: T, m31: T, m32: T, m33: T, m34: T, diff --git a/src/test/run-pass/issue-333.rs b/src/test/run-pass/issue-333.rs index 3452beaf7f4..94829fdb7a8 100644 --- a/src/test/run-pass/issue-333.rs +++ b/src/test/run-pass/issue-333.rs @@ -1,5 +1,5 @@ -fn quux<T: copy>(x: T) -> T { let f = id::<T>; return f(x); } +fn quux<T: Copy>(x: T) -> T { let f = id::<T>; return f(x); } -fn id<T: copy>(x: T) -> T { return x; } +fn id<T: Copy>(x: T) -> T { return x; } fn main() { assert (quux(10) == 10); } diff --git a/src/test/run-pass/ivec-add.rs b/src/test/run-pass/ivec-add.rs index 652336145f6..9464b6923a9 100644 --- a/src/test/run-pass/ivec-add.rs +++ b/src/test/run-pass/ivec-add.rs @@ -1,4 +1,4 @@ -fn double<T: copy>(a: T) -> ~[T] { return ~[a] + ~[a]; } +fn double<T: Copy>(a: T) -> ~[T] { return ~[a] + ~[a]; } fn double_int(a: int) -> ~[int] { return ~[a] + ~[a]; } diff --git a/src/test/run-pass/kindck-owned-trait-contains-1.rs b/src/test/run-pass/kindck-owned-trait-contains-1.rs index 7de63c20e0c..afbc2561d15 100644 --- a/src/test/run-pass/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs @@ -1,10 +1,10 @@ trait repeat<A> { fn get() -> A; } -impl<A:copy> @A: repeat<A> { +impl<A:Copy> @A: repeat<A> { fn get() -> A { *self } } -fn repeater<A:copy>(v: @A) -> repeat<A> { +fn repeater<A:Copy>(v: @A) -> repeat<A> { // Note: owned kind is not necessary as A appears in the trait type v as repeat::<A> // No } diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index d3f8c668edb..36eea6e89d5 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -1,9 +1,9 @@ trait vec_monad<A> { - fn bind<B: copy>(f: fn(A) -> ~[B]) -> ~[B]; + fn bind<B: Copy>(f: fn(A) -> ~[B]) -> ~[B]; } impl<A> ~[A]: vec_monad<A> { - fn bind<B: copy>(f: fn(A) -> ~[B]) -> ~[B] { + fn bind<B: Copy>(f: fn(A) -> ~[B]) -> ~[B] { let mut r = ~[]; for self.each |elt| { r += f(elt); } r diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index fa6b0b86012..18f6557fdac 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -1,8 +1,8 @@ enum myvec<X> = ~[X]; -fn myvec_deref<X: copy>(mv: myvec<X>) -> ~[X] { return *mv; } +fn myvec_deref<X: Copy>(mv: myvec<X>) -> ~[X] { return *mv; } -fn myvec_elt<X: copy>(mv: myvec<X>) -> X { return mv[0]; } +fn myvec_elt<X: Copy>(mv: myvec<X>) -> X { return mv[0]; } fn main() { let mv = myvec(~[1, 2, 3]); diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index 600afd97a69..9b8bbfd9438 100644 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ b/src/test/run-pass/non-boolean-pure-fns.rs @@ -2,15 +2,15 @@ use std; use std::list::*; -pure fn pure_length_go<T: copy>(ls: @List<T>, acc: uint) -> uint { +pure fn pure_length_go<T: Copy>(ls: @List<T>, acc: uint) -> uint { match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } } } -pure fn pure_length<T: copy>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) } +pure fn pure_length<T: Copy>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) } -pure fn nonempty_list<T: copy>(ls: @List<T>) -> bool { pure_length(ls) > 0u } +pure fn nonempty_list<T: Copy>(ls: @List<T>) -> bool { pure_length(ls) > 0u } -fn safe_head<T: copy>(ls: @List<T>) -> T { +fn safe_head<T: Copy>(ls: @List<T>) -> T { assert is_not_empty(ls); return head(ls); } diff --git a/src/test/run-pass/pipe-bank-proto.rs b/src/test/run-pass/pipe-bank-proto.rs index fc76487b436..f484e635e49 100644 --- a/src/test/run-pass/pipe-bank-proto.rs +++ b/src/test/run-pass/pipe-bank-proto.rs @@ -36,7 +36,7 @@ macro_rules! move_it ( { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } } ) -fn switch<T: send, U>(+endp: pipes::RecvPacket<T>, +fn switch<T: Send, U>(+endp: pipes::RecvPacket<T>, f: fn(+Option<T>) -> U) -> U { f(pipes::try_recv(endp)) } diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index 7f36dbe546c..783febf942c 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -14,7 +14,7 @@ proto! oneshot ( ) proto! stream ( - stream:send<T:send> { + stream:send<T:Send> { send(T) -> stream<T> } ) diff --git a/src/test/run-pass/resource-generic.rs b/src/test/run-pass/resource-generic.rs index 1d01de738b5..392d68d8763 100644 --- a/src/test/run-pass/resource-generic.rs +++ b/src/test/run-pass/resource-generic.rs @@ -1,9 +1,9 @@ -struct finish<T: copy> { +struct finish<T: Copy> { arg: {val: T, fin: extern fn(T)}, drop { self.arg.fin(self.arg.val); } } -fn finish<T: copy>(arg: {val: T, fin: extern fn(T)}) -> finish<T> { +fn finish<T: Copy>(arg: {val: T, fin: extern fn(T)}) -> finish<T> { finish { arg: arg } diff --git a/src/test/run-pass/ret-none.rs b/src/test/run-pass/ret-none.rs index 1533bb9ef09..069618aaa05 100644 --- a/src/test/run-pass/ret-none.rs +++ b/src/test/run-pass/ret-none.rs @@ -2,6 +2,6 @@ enum option<T> { none, some(T), } -fn f<T: copy>() -> option<T> { return none; } +fn f<T: Copy>() -> option<T> { return none; } fn main() { f::<int>(); } diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index 67a1b618413..c642670afbc 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -4,9 +4,9 @@ use comm::send; use comm::Port; // tests that ctrl's type gets inferred properly -type command<K: send, V: send> = {key: K, val: V}; +type command<K: Send, V: Send> = {key: K, val: V}; -fn cache_server<K: send, V: send>(c: Chan<Chan<command<K, V>>>) { +fn cache_server<K: Send, V: Send>(c: Chan<Chan<command<K, V>>>) { let ctrl = Port(); send(c, Chan(ctrl)); } diff --git a/src/test/run-pass/sendfn-deep-copy.rs b/src/test/run-pass/sendfn-deep-copy.rs index d5ee2f1aaec..d089eb873bd 100644 --- a/src/test/run-pass/sendfn-deep-copy.rs +++ b/src/test/run-pass/sendfn-deep-copy.rs @@ -5,7 +5,7 @@ use comm::send; fn main() { test05(); } -fn mk_counter<A:copy>() -> fn~(A) -> (A,uint) { +fn mk_counter<A:Copy>() -> fn~(A) -> (A,uint) { // The only reason that the counter is generic is so that it closes // over both a type descriptor and some data. let v = ~[mut 0u]; diff --git a/src/test/run-pass/sendfn-generic-fn.rs b/src/test/run-pass/sendfn-generic-fn.rs index eece50e7570..2fcc6adfce3 100644 --- a/src/test/run-pass/sendfn-generic-fn.rs +++ b/src/test/run-pass/sendfn-generic-fn.rs @@ -7,7 +7,7 @@ fn main() { test05(); } type pair<A,B> = { a: A, b: B }; -fn make_generic_record<A: copy, B: copy>(a: A, b: B) -> pair<A,B> { +fn make_generic_record<A: Copy, B: Copy>(a: A, b: B) -> pair<A,B> { return {a: a, b: b}; } @@ -23,7 +23,7 @@ fn test05_start(&&f: fn~(&&float, &&~str) -> pair<float, ~str>) { assert q.b == ~"Ho"; } -fn spawn<A: copy, B: copy>(f: extern fn(fn~(A,B)->pair<A,B>)) { +fn spawn<A: Copy, B: Copy>(f: extern fn(fn~(A,B)->pair<A,B>)) { let arg = fn~(a: A, b: B) -> pair<A,B> { return make_generic_record(a, b); }; diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index f338dcef577..e29f3fdd5e4 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -28,13 +28,13 @@ impl uint: uint_utils { trait vec_utils<T> { fn length_() -> uint; fn iter_(f: fn(T)); - fn map_<U: copy>(f: fn(T) -> U) -> ~[U]; + fn map_<U: Copy>(f: fn(T) -> U) -> ~[U]; } impl<T> ~[T]: vec_utils<T> { fn length_() -> uint { vec::len(self) } fn iter_(f: fn(T)) { for self.each |x| { f(x); } } - fn map_<U: copy>(f: fn(T) -> U) -> ~[U] { + fn map_<U: Copy>(f: fn(T) -> U) -> ~[U] { let mut r = ~[]; for self.each |elt| { r += ~[f(elt)]; } r diff --git a/src/test/run-pass/static-method-test.rs b/src/test/run-pass/static-method-test.rs index b8832edbad9..1fc930a688e 100644 --- a/src/test/run-pass/static-method-test.rs +++ b/src/test/run-pass/static-method-test.rs @@ -5,7 +5,7 @@ trait bool_like { static fn select<A>(b: self, +x1: A, +x2: A) -> A; } -fn andand<T: bool_like copy>(x1: T, x2: T) -> T { +fn andand<T: bool_like Copy>(x1: T, x2: T) -> T { select(x1, x2, x1) } diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index 95709971e03..4c7d0415d85 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -12,10 +12,10 @@ impl (): to_str { } trait map<T> { - fn map<U: copy>(f: fn(T) -> U) -> ~[U]; + fn map<U: Copy>(f: fn(T) -> U) -> ~[U]; } impl<T> ~[T]: map<T> { - fn map<U: copy>(f: fn(T) -> U) -> ~[U] { + fn map<U: Copy>(f: fn(T) -> U) -> ~[U] { let mut r = ~[]; for self.each |x| { r += ~[f(x)]; } r diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index f9174598cce..f96c2bede61 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -1,6 +1,6 @@ fn p_foo<T>(pinned: T) { } -fn s_foo<T: copy>(shared: T) { } -fn u_foo<T: send>(unique: T) { } +fn s_foo<T: Copy>(shared: T) { } +fn u_foo<T: Send>(unique: T) { } struct r { i: int, diff --git a/src/test/run-pass/uniq-cc-generic.rs b/src/test/run-pass/uniq-cc-generic.rs index 5c7e2228ab4..18c3db591f6 100644 --- a/src/test/run-pass/uniq-cc-generic.rs +++ b/src/test/run-pass/uniq-cc-generic.rs @@ -8,7 +8,7 @@ type pointy = { d : fn~() -> uint, }; -fn make_uniq_closure<A:send copy>(a: A) -> fn~() -> uint { +fn make_uniq_closure<A:Send Copy>(a: A) -> fn~() -> uint { fn~() -> uint { ptr::addr_of(a) as uint } } diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index 8addb1acaf2..8a36cbd7c7d 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -1,4 +1,4 @@ -fn f<T: copy>(t: T) -> T { +fn f<T: Copy>(t: T) -> T { let t1 = t; t1 } diff --git a/src/test/run-pass/unique-generic-assign.rs b/src/test/run-pass/unique-generic-assign.rs index f8fd6f62c26..a299e88c344 100644 --- a/src/test/run-pass/unique-generic-assign.rs +++ b/src/test/run-pass/unique-generic-assign.rs @@ -1,6 +1,6 @@ // Issue #976 -fn f<T: copy>(x: ~T) { +fn f<T: Copy>(x: ~T) { let _x2 = x; } fn main() { } diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index c22b529910a..2f6c94f3f34 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -2,11 +2,11 @@ use cmp::Eq; fn sendable() { - fn f<T: send Eq>(i: T, j: T) { + fn f<T: Send Eq>(i: T, j: T) { assert i == j; } - fn g<T: send Eq>(i: T, j: T) { + fn g<T: Send Eq>(i: T, j: T) { assert i != j; } @@ -20,11 +20,11 @@ fn sendable() { fn copyable() { - fn f<T: copy Eq>(i: T, j: T) { + fn f<T: Copy Eq>(i: T, j: T) { assert i == j; } - fn g<T: copy Eq>(i: T, j: T) { + fn g<T: Copy Eq>(i: T, j: T) { assert i != j; } |
