diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-28 10:46:43 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-29 10:42:58 -0800 |
| commit | 6ce74460e6a5c8045a7b43b86a656f28354f4b0c (patch) | |
| tree | a09e6a6b8ba8566e6dc9f223d6cbbfbbdcde19e2 | |
| parent | eb4d39e1fef918242a5dba2a09d7b9faa437b911 (diff) | |
| download | rust-6ce74460e6a5c8045a7b43b86a656f28354f4b0c.tar.gz rust-6ce74460e6a5c8045a7b43b86a656f28354f4b0c.zip | |
librustc: Disallow trait bounds in types, enumerations, and structure definitions. r=tjc
44 files changed, 424 insertions, 107 deletions
diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index df98e469bbc..3a51a2a212c 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -35,13 +35,13 @@ pub mod linear { const INITIAL_CAPACITY: uint = 32u; // 2^5 - struct Bucket<K: Eq Hash, V> { + struct Bucket<K,V> { hash: uint, key: K, value: V, } - pub struct LinearMap<K: Eq Hash, V> { + pub struct LinearMap<K,V> { k0: u64, k1: u64, resize_at: uint, @@ -408,7 +408,7 @@ pub mod linear { pure fn ne(&self, other: &LinearMap<K, V>) -> bool { !self.eq(other) } } - pub struct LinearSet<T: Hash IterBytes Eq> { + pub struct LinearSet<T> { priv map: LinearMap<T, ()> } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index cf49ee0becc..6d618627ece 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1111,7 +1111,7 @@ pub mod fsync { // Artifacts that need to fsync on destruction - pub struct Res<t: Copy> { + pub struct Res<t> { arg: Arg<t>, } diff --git a/src/libcore/oldcomm.rs b/src/libcore/oldcomm.rs index 89300be9ab4..dc245f5bffd 100644 --- a/src/libcore/oldcomm.rs +++ b/src/libcore/oldcomm.rs @@ -68,7 +68,7 @@ use vec; * transmitted. If a port value is copied, both copies refer to the same * port. Ports may be associated with multiple `chan`s. */ -pub enum Port<T: Owned> { +pub enum Port<T> { Port_(@PortPtr<T>) } @@ -84,7 +84,7 @@ pub enum Port<T: Owned> { * data will be silently dropped. Channels may be duplicated and * themselves transmitted over other channels. */ -pub enum Chan<T: Owned> { +pub enum Chan<T> { Chan_(port_id) } @@ -120,7 +120,7 @@ pub fn listen<T: Owned, U>(f: fn(Chan<T>) -> U) -> U { f(po.chan()) } -struct PortPtr<T:Owned> { +struct PortPtr<T> { po: *rust_port, drop { unsafe { @@ -238,7 +238,7 @@ fn peek_chan<T: Owned>(ch: Chan<T>) -> bool { } /// Receive on a raw port pointer -fn recv_<T: Owned>(p: *rust_port) -> T { +fn recv_<T>(p: *rust_port) -> T { unsafe { let yield = 0; let yieldp = ptr::addr_of(&yield); diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 33826d10c3c..5af9950ff08 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -151,7 +151,7 @@ type Buffer<T: Owned> = { #[cfg(stage1)] #[cfg(stage2)] #[cfg(stage3)] -pub struct Buffer<T: Owned> { +pub struct Buffer<T> { header: BufferHeader, data: T, } @@ -212,10 +212,18 @@ impl PacketHeader { } #[doc(hidden)] +#[cfg(stage0)] pub struct Packet<T: Owned> { header: PacketHeader, mut payload: Option<T>, } +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +pub struct Packet<T> { + header: PacketHeader, + mut payload: Option<T>, +} #[doc(hidden)] pub trait HasBuffer { @@ -256,12 +264,11 @@ fn unibuffer<T: Owned>() -> ~Buffer<Packet<T>> { } move b } - #[doc(hidden)] #[cfg(stage1)] #[cfg(stage2)] #[cfg(stage3)] -fn unibuffer<T: Owned>() -> ~Buffer<Packet<T>> { +fn unibuffer<T>() -> ~Buffer<Packet<T>> { let b = ~Buffer { header: BufferHeader(), data: Packet { @@ -277,6 +284,7 @@ fn unibuffer<T: Owned>() -> ~Buffer<Packet<T>> { } #[doc(hidden)] +#[cfg(stage0)] pub fn packet<T: Owned>() -> *Packet<T> { let b = unibuffer(); let p = ptr::addr_of(&(b.data)); @@ -284,6 +292,16 @@ pub fn packet<T: Owned>() -> *Packet<T> { unsafe { forget(move b) } p } +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +pub fn packet<T>() -> *Packet<T> { + let b = unibuffer(); + let p = ptr::addr_of(&(b.data)); + // We'll take over memory management from here. + unsafe { forget(move b) } + p +} #[doc(hidden)] pub fn entangle_buffer<T: Owned, Tstart: Owned>( @@ -387,11 +405,19 @@ fn swap_state_rel(dst: &mut State, src: State) -> State { } #[doc(hidden)] +#[cfg(stage0)] pub unsafe fn get_buffer<T: Owned>(p: *PacketHeader) -> ~Buffer<T> { transmute((*p).buf_header()) } +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +pub unsafe fn get_buffer<T>(p: *PacketHeader) -> ~Buffer<T> { + transmute((*p).buf_header()) +} // This could probably be done with SharedMutableState to avoid move_it!(). +#[cfg(stage0)] struct BufferResource<T: Owned> { buffer: ~Buffer<T>, @@ -413,7 +439,31 @@ struct BufferResource<T: Owned> { } } } +#[cfg(stage1)] +#[cfg(stage2)] +struct BufferResource<T> { + buffer: ~Buffer<T>, + drop { + unsafe { + let b = move_it!(self.buffer); + //let p = ptr::addr_of(*b); + //error!("drop %?", p); + let old_count = atomic_sub_rel(&mut b.header.ref_count, 1); + //let old_count = atomic_xchng_rel(b.header.ref_count, 0); + if old_count == 1 { + // The new count is 0. + + // go go gadget drop glue + } + else { + forget(move b) + } + } + } +} + +#[cfg(stage0)] fn BufferResource<T: Owned>(b: ~Buffer<T>) -> BufferResource<T> { //let p = ptr::addr_of(*b); //error!("take %?", p); @@ -424,8 +474,21 @@ fn BufferResource<T: Owned>(b: ~Buffer<T>) -> BufferResource<T> { buffer: move b } } +#[cfg(stage1)] +#[cfg(stage2)] +fn BufferResource<T>(b: ~Buffer<T>) -> BufferResource<T> { + //let p = ptr::addr_of(*b); + //error!("take %?", p); + atomic_add_acq(&mut b.header.ref_count, 1); + + BufferResource { + // tjc: ???? + buffer: move b + } +} #[doc(hidden)] +#[cfg(stage0)] pub fn send<T: Owned, Tbuffer: Owned>(p: SendPacketBuffered<T, Tbuffer>, payload: T) -> bool { let header = p.header(); @@ -467,6 +530,49 @@ pub fn send<T: Owned, Tbuffer: Owned>(p: SendPacketBuffered<T, Tbuffer>, } } } +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +pub fn send<T,Tbuffer>(p: SendPacketBuffered<T,Tbuffer>, payload: T) -> bool { + let header = p.header(); + let p_ = p.unwrap(); + let p = unsafe { &*p_ }; + assert ptr::addr_of(&(p.header)) == header; + assert p.payload.is_none(); + p.payload = move Some(move payload); + let old_state = swap_state_rel(&mut p.header.state, Full); + match old_state { + Empty => { + // Yay, fastpath. + + // The receiver will eventually clean this up. + //unsafe { forget(p); } + return true; + } + Full => fail ~"duplicate send", + Blocked => { + debug!("waking up task for %?", p_); + let old_task = swap_task(&mut p.header.blocked_task, ptr::null()); + if !old_task.is_null() { + unsafe { + rustrt::task_signal_event( + old_task, + ptr::addr_of(&(p.header)) as *libc::c_void); + rustrt::rust_task_deref(old_task); + } + } + + // The receiver will eventually clean this up. + //unsafe { forget(p); } + return true; + } + Terminated => { + // The receiver will never receive this. Rely on drop_glue + // to clean everything up. + return false; + } + } +} /** Receives a message from a pipe. @@ -812,13 +918,24 @@ pub fn select<T: Owned, Tb: Owned>(endpoints: ~[RecvPacketBuffered<T, Tb>]) message. */ +#[cfg(stage0)] pub type SendPacket<T: Owned> = SendPacketBuffered<T, Packet<T>>; +#[cfg(stage1)] +#[cfg(stage2)] +pub type SendPacket<T> = SendPacketBuffered<T, Packet<T>>; #[doc(hidden)] +#[cfg(stage0)] pub fn SendPacket<T: Owned>(p: *Packet<T>) -> SendPacket<T> { SendPacketBuffered(p) } +#[cfg(stage1)] +#[cfg(stage2)] +pub fn SendPacket<T>(p: *Packet<T>) -> SendPacket<T> { + SendPacketBuffered(p) +} +#[cfg(stage0)] pub struct SendPacketBuffered<T: Owned, Tbuffer: Owned> { mut p: Option<*Packet<T>>, mut buffer: Option<BufferResource<Tbuffer>>, @@ -837,7 +954,31 @@ pub struct SendPacketBuffered<T: Owned, Tbuffer: Owned> { // } else { "some" }); } } } +#[cfg(stage1)] +#[cfg(stage2)] +pub struct SendPacketBuffered<T, Tbuffer> { + mut p: Option<*Packet<T>>, + mut buffer: Option<BufferResource<Tbuffer>>, +} +impl<T:Owned,Tbuffer:Owned> SendPacketBuffered<T,Tbuffer> : ::ops::Drop { + fn finalize(&self) { + //if self.p != none { + // debug!("drop send %?", option::get(self.p)); + //} + if self.p != None { + let mut p = None; + p <-> self.p; + sender_terminate(option::unwrap(move p)) + } + //unsafe { error!("send_drop: %?", + // if self.buffer == none { + // "none" + // } else { "some" }); } + } +} + +#[cfg(stage0)] pub fn SendPacketBuffered<T: Owned, Tbuffer: Owned>(p: *Packet<T>) -> SendPacketBuffered<T, Tbuffer> { //debug!("take send %?", p); @@ -849,8 +990,50 @@ pub fn SendPacketBuffered<T: Owned, Tbuffer: Owned>(p: *Packet<T>) } } } +#[cfg(stage1)] +#[cfg(stage2)] +pub fn SendPacketBuffered<T,Tbuffer>(p: *Packet<T>) + -> SendPacketBuffered<T, Tbuffer> { + //debug!("take send %?", p); + SendPacketBuffered { + p: Some(p), + buffer: unsafe { + Some(BufferResource( + get_buffer(ptr::addr_of(&((*p).header))))) + } + } +} + +#[cfg(stage0)] +impl<T:Owned,Tbuffer:Owned> SendPacketBuffered<T,Tbuffer> { + fn unwrap() -> *Packet<T> { + let mut p = None; + p <-> self.p; + option::unwrap(move p) + } + + pure fn header() -> *PacketHeader { + match self.p { + Some(packet) => unsafe { + let packet = &*packet; + let header = ptr::addr_of(&(packet.header)); + //forget(packet); + header + }, + None => fail ~"packet already consumed" + } + } -impl<T: Owned, Tbuffer: Owned> SendPacketBuffered<T, Tbuffer> { + fn reuse_buffer() -> BufferResource<Tbuffer> { + //error!("send reuse_buffer"); + let mut tmp = None; + tmp <-> self.buffer; + option::unwrap(move tmp) + } +} +#[cfg(stage1)] +#[cfg(stage2)] +impl<T,Tbuffer> SendPacketBuffered<T,Tbuffer> { fn unwrap() -> *Packet<T> { let mut p = None; p <-> self.p; @@ -879,13 +1062,25 @@ impl<T: Owned, Tbuffer: Owned> SendPacketBuffered<T, Tbuffer> { /// Represents the receive end of a pipe. It can receive exactly one /// message. +#[cfg(stage0)] pub type RecvPacket<T: Owned> = RecvPacketBuffered<T, Packet<T>>; +#[cfg(stage1)] +#[cfg(stage2)] +pub type RecvPacket<T> = RecvPacketBuffered<T, Packet<T>>; #[doc(hidden)] +#[cfg(stage0)] pub fn RecvPacket<T: Owned>(p: *Packet<T>) -> RecvPacket<T> { RecvPacketBuffered(p) } +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +pub fn RecvPacket<T>(p: *Packet<T>) -> RecvPacket<T> { + RecvPacketBuffered(p) +} +#[cfg(stage0)] pub struct RecvPacketBuffered<T: Owned, Tbuffer: Owned> { mut p: Option<*Packet<T>>, mut buffer: Option<BufferResource<Tbuffer>>, @@ -904,6 +1099,29 @@ pub struct RecvPacketBuffered<T: Owned, Tbuffer: Owned> { // } else { "some" }); } } } +#[cfg(stage1)] +#[cfg(stage2)] +pub struct RecvPacketBuffered<T, Tbuffer> { + mut p: Option<*Packet<T>>, + mut buffer: Option<BufferResource<Tbuffer>>, +} + +impl<T:Owned, Tbuffer:Owned> RecvPacketBuffered<T,Tbuffer> : ::ops::Drop { + fn finalize(&self) { + //if self.p != none { + // debug!("drop recv %?", option::get(self.p)); + //} + if self.p != None { + let mut p = None; + p <-> self.p; + receiver_terminate(option::unwrap(move p)) + } + //unsafe { error!("recv_drop: %?", + // if self.buffer == none { + // "none" + // } else { "some" }); } + } +} impl<T: Owned, Tbuffer: Owned> RecvPacketBuffered<T, Tbuffer> { fn unwrap() -> *Packet<T> { @@ -934,6 +1152,7 @@ impl<T: Owned, Tbuffer: Owned> RecvPacketBuffered<T, Tbuffer> : Selectable { } } +#[cfg(stage0)] pub fn RecvPacketBuffered<T: Owned, Tbuffer: Owned>(p: *Packet<T>) -> RecvPacketBuffered<T, Tbuffer> { //debug!("take recv %?", p); @@ -945,12 +1164,33 @@ pub fn RecvPacketBuffered<T: Owned, Tbuffer: Owned>(p: *Packet<T>) } } } +#[cfg(stage1)] +#[cfg(stage2)] +pub fn RecvPacketBuffered<T,Tbuffer>(p: *Packet<T>) + -> RecvPacketBuffered<T,Tbuffer> { + //debug!("take recv %?", p); + RecvPacketBuffered { + p: Some(p), + buffer: unsafe { + Some(BufferResource( + get_buffer(ptr::addr_of(&((*p).header))))) + } + } +} #[doc(hidden)] +#[cfg(stage0)] pub fn entangle<T: Owned>() -> (SendPacket<T>, RecvPacket<T>) { let p = packet(); (SendPacket(p), RecvPacket(p)) } +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +pub fn entangle<T>() -> (SendPacket<T>, RecvPacket<T>) { + let p = packet(); + (SendPacket(p), RecvPacket(p)) +} /** Spawn a task to provide a service. @@ -1042,24 +1282,50 @@ pub trait Peekable<T> { } #[doc(hidden)] +#[cfg(stage0)] struct Chan_<T:Owned> { - mut endp: Option<streamp::client::Open<T>>, + mut endp: Option<streamp::client::Open<T>> +} +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +struct Chan_<T> { + mut endp: Option<streamp::client::Open<T>> } /// An endpoint that can send many messages. +#[cfg(stage0)] pub enum Chan<T:Owned> { Chan_(Chan_<T>) } +#[cfg(stage1)] +#[cfg(stage2)] +pub enum Chan<T> { + Chan_(Chan_<T>) +} #[doc(hidden)] +#[cfg(stage0)] struct Port_<T:Owned> { mut endp: Option<streamp::server::Open<T>>, } +#[doc(hidden)] +#[cfg(stage1)] +#[cfg(stage2)] +struct Port_<T> { + mut endp: Option<streamp::server::Open<T>>, +} /// An endpoint that can receive many messages. +#[cfg(stage0)] pub enum Port<T:Owned> { Port_(Port_<T>) } +#[cfg(stage1)] +#[cfg(stage2)] +pub enum Port<T> { + Port_(Port_<T>) +} /** Creates a `(chan, port)` pair. @@ -1145,9 +1411,15 @@ impl<T: Owned> Port<T>: Selectable { } /// Treat many ports as one. +#[cfg(stage0)] pub struct PortSet<T: Owned> { mut ports: ~[pipes::Port<T>], } +#[cfg(stage1)] +#[cfg(stage2)] +pub struct PortSet<T> { + mut ports: ~[pipes::Port<T>], +} pub fn PortSet<T: Owned>() -> PortSet<T>{ PortSet { @@ -1210,7 +1482,11 @@ impl<T: Owned> PortSet<T> : Peekable<T> { } /// A channel that can be shared between many senders. +#[cfg(stage0)] pub type SharedChan<T: Owned> = private::Exclusive<Chan<T>>; +#[cfg(stage1)] +#[cfg(stage2)] +pub type SharedChan<T> = private::Exclusive<Chan<T>>; impl<T: Owned> SharedChan<T>: GenericChan<T> { fn send(x: T) { @@ -1278,9 +1554,17 @@ proto! oneshot ( ) /// The send end of a oneshot pipe. +#[cfg(stage0)] pub type ChanOne<T: Owned> = oneshot::client::Oneshot<T>; +#[cfg(stage1)] +#[cfg(stage2)] +pub type ChanOne<T> = oneshot::client::Oneshot<T>; /// The receive end of a oneshot pipe. +#[cfg(stage0)] pub type PortOne<T: Owned> = oneshot::server::Oneshot<T>; +#[cfg(stage1)] +#[cfg(stage2)] +pub type PortOne<T> = oneshot::server::Oneshot<T>; /// Initialiase a (send-endpoint, recv-endpoint) oneshot pipe pair. pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) { diff --git a/src/libcore/private.rs b/src/libcore/private.rs index 332c763f151..b6ac711d764 100644 --- a/src/libcore/private.rs +++ b/src/libcore/private.rs @@ -238,7 +238,7 @@ pub unsafe fn unwrap_shared_mutable_state<T: Owned>(rc: SharedMutableState<T>) * Data races between tasks can result in crashes and, with sufficient * cleverness, arbitrary type coercion. */ -pub type SharedMutableState<T: Owned> = ArcDestruct<T>; +pub type SharedMutableState<T> = ArcDestruct<T>; pub unsafe fn shared_mutable_state<T: Owned>(data: T) -> SharedMutableState<T> { @@ -341,11 +341,11 @@ impl LittleLock { } } -struct ExData<T: Owned> { lock: LittleLock, mut failed: bool, mut data: T, } +struct ExData<T> { lock: LittleLock, mut failed: bool, mut data: T, } /** * An arc over mutable data that is protected by a lock. For library use only. */ -pub struct Exclusive<T: Owned> { x: SharedMutableState<ExData<T>> } +pub struct Exclusive<T> { x: SharedMutableState<ExData<T>> } pub fn exclusive<T:Owned >(user_data: T) -> Exclusive<T> { let data = ExData { diff --git a/src/libcore/private/global.rs b/src/libcore/private/global.rs index 69319abc009..ee20fb665be 100644 --- a/src/libcore/private/global.rs +++ b/src/libcore/private/global.rs @@ -41,7 +41,7 @@ use sys::Closure; use task::spawn; use uint; -pub type GlobalDataKey<T: Owned> = &fn(v: T); +pub type GlobalDataKey<T> = &fn(v: T); pub unsafe fn global_data_clone_create<T: Owned Clone>( key: GlobalDataKey<T>, create: &fn() -> ~T) -> T { diff --git a/src/libcore/reflect.rs b/src/libcore/reflect.rs index 55eb53bc026..81a36e1ae13 100644 --- a/src/libcore/reflect.rs +++ b/src/libcore/reflect.rs @@ -41,7 +41,7 @@ pub fn align(size: uint, align: uint) -> uint { } /// Adaptor to wrap around visitors implementing MovePtr. -pub struct MovePtrAdaptor<V: TyVisitor MovePtr> { +pub struct MovePtrAdaptor<V> { inner: V } pub fn MovePtrAdaptor<V: TyVisitor MovePtr>(v: V) -> MovePtrAdaptor<V> { diff --git a/src/libcore/task/local_data.rs b/src/libcore/task/local_data.rs index 05a4e35b249..42765ef139f 100644 --- a/src/libcore/task/local_data.rs +++ b/src/libcore/task/local_data.rs @@ -45,7 +45,7 @@ use task; * * These two cases aside, the interface is safe. */ -pub type LocalDataKey<T: Durable> = &fn(v: @T); +pub type LocalDataKey<T> = &fn(v: @T); /** * Remove a task-local data value from the table, returning the diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 0a2f6634214..3db6fa00f16 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -77,7 +77,7 @@ use cast; use container::Map; use oldcomm; use option; -use pipes::{Chan, GenericChan, GenericPort, Port}; +use pipes::{Chan, GenericChan, GenericPort, Port, stream}; use pipes; use prelude::*; use private; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 002e04ca475..26f4310bf1c 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -569,7 +569,7 @@ struct FnSig { * by the meta information because, in some cases, the * meta information is inferred. */ #[deriving_eq] -struct FnTyBase<M: cmp::Eq> { +struct FnTyBase<M> { meta: M, // Either FnMeta or FnVid sig: FnSig // Types of arguments/return type } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index ce0c7a94c7c..8374a65f63c 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -598,6 +598,20 @@ fn convert_methods(ccx: @crate_ctxt, } } +fn ensure_no_ty_param_bounds(ccx: @crate_ctxt, + span: span, + ty_params: &[ast::ty_param], + thing: &static/str) { + for ty_params.each |ty_param| { + if ty_param.bounds.len() > 0 { + ccx.tcx.sess.span_err( + span, + fmt!("trait bounds are not allowed in %s definitions", + thing)); + } + } +} + fn convert(ccx: @crate_ctxt, it: @ast::item) { let tcx = ccx.tcx; let rp = tcx.region_paramd_items.find(it.id); @@ -607,6 +621,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) { // These don't define types. ast::item_foreign_mod(_) | ast::item_mod(_) => {} ast::item_enum(ref enum_definition, ref ty_params) => { + ensure_no_ty_param_bounds(ccx, it.span, *ty_params, "enumeration"); let tpt = ty_of_item(ccx, it); write_ty_to_tcx(tcx, it.id, tpt.ty); get_enum_variant_types(ccx, @@ -644,6 +659,8 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) { let _ = convert_methods(ccx, provided_methods, rp, bounds); } ast::item_struct(struct_def, tps) => { + ensure_no_ty_param_bounds(ccx, it.span, tps, "structure"); + // Write the class type let tpt = ty_of_item(ccx, it); write_ty_to_tcx(tcx, it.id, tpt.ty); @@ -651,6 +668,11 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) { convert_struct(ccx, rp, struct_def, tps, tpt, it.id); } + ast::item_ty(_, ref ty_params) => { + ensure_no_ty_param_bounds(ccx, it.span, *ty_params, "type"); + let tpt = ty_of_item(ccx, it); + write_ty_to_tcx(tcx, it.id, tpt.ty); + } _ => { // This call populates the type cache with the converted type // of the item in passing. All we have to do here is to write diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index 6c831427b03..b2b1188388f 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -31,7 +31,7 @@ struct ValsAndBindings<V, T> { mut bindings: ~[(V, VarValue<V, T>)], } -struct Node<V:Copy, T:Copy> { +struct Node<V, T> { root: V, possible_types: T, rank: uint, diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 0c40fe283af..edffa32e501 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -79,7 +79,7 @@ impl &Condvar { ****************************************************************************/ /// An atomically reference counted wrapper for shared immutable state. -struct ARC<T: Const Owned> { x: SharedMutableState<T> } +struct ARC<T> { x: SharedMutableState<T> } /// Create an atomically reference counted wrapper. pub fn ARC<T: Const Owned>(data: T) -> ARC<T> { @@ -130,9 +130,9 @@ impl<T: Const Owned> ARC<T>: Clone { ****************************************************************************/ #[doc(hidden)] -struct MutexARCInner<T: Owned> { lock: Mutex, failed: bool, data: T } +struct MutexARCInner<T> { lock: Mutex, failed: bool, data: T } /// An ARC with mutable data protected by a blocking mutex. -struct MutexARC<T: Owned> { x: SharedMutableState<MutexARCInner<T>> } +struct MutexARC<T> { x: SharedMutableState<MutexARCInner<T>> } /// Create a mutex-protected ARC with the supplied data. pub fn MutexARC<T: Owned>(user_data: T) -> MutexARC<T> { @@ -267,14 +267,14 @@ fn PoisonOnFail(failed: &r/mut bool) -> PoisonOnFail { ****************************************************************************/ #[doc(hidden)] -struct RWARCInner<T: Const Owned> { lock: RWlock, failed: bool, data: T } +struct RWARCInner<T> { 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 Owned> { +struct RWARC<T> { x: SharedMutableState<RWARCInner<T>>, mut cant_nest: () } @@ -426,10 +426,10 @@ fn borrow_rwlock<T: Const Owned>(state: &r/mut RWARCInner<T>) -> &r/RWlock { // FIXME (#3154) ice with struct/&<T> prevents these from being structs. /// The "write permission" token used for RWARC.write_downgrade(). -pub enum RWWriteMode<T: Const Owned> = +pub enum RWWriteMode<T> = (&mut T, sync::RWlockWriteMode, PoisonOnFail); /// The "read permission" token used for RWARC.write_downgrade(). -pub enum RWReadMode<T:Const Owned> = (&T, sync::RWlockReadMode); +pub enum RWReadMode<T> = (&T, sync::RWlockReadMode); impl<T: Const Owned> &RWWriteMode<T> { /// Access the pre-downgrade RWARC in write mode. diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 3118a0c1ba5..16e8b63da81 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -23,7 +23,14 @@ use core::pipes; use core::prelude::*; /// An extension of `pipes::stream` that allows both sending and receiving. -pub struct DuplexStream<T: Owned, U: Owned> { +#[cfg(stage0)] +pub struct DuplexStream<T:Owned, U:Owned> { + priv chan: Chan<T>, + priv port: Port<U>, +} +#[cfg(stage1)] +#[cfg(stage2)] +pub struct DuplexStream<T, U> { priv chan: Chan<T>, priv port: Port<U>, } diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index afc3e72e636..bd684baf6b3 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -63,7 +63,7 @@ and an `Unflattener` that converts the bytes to a value. Create using the constructors in the `serial` and `pod` modules. */ -pub struct FlatPort<T, U: Unflattener<T>, P: BytePort> { +pub struct FlatPort<T, U, P> { unflattener: U, byte_port: P } @@ -74,7 +74,7 @@ byte vectors, and a `ByteChan` that transmits the bytes. Create using the constructors in the `serial` and `pod` modules. */ -pub struct FlatChan<T, F: Flattener<T>, C: ByteChan> { +pub struct FlatChan<T, F, C> { flattener: F, byte_chan: C } @@ -181,14 +181,12 @@ pub mod pod { use core::pipes; use core::prelude::*; - pub type ReaderPort<T: Copy Owned, R> = + pub type ReaderPort<T, R> = FlatPort<T, PodUnflattener<T>, ReaderBytePort<R>>; - pub type WriterChan<T: Copy Owned, W> = + pub type WriterChan<T, W> = FlatChan<T, PodFlattener<T>, WriterByteChan<W>>; - pub type PipePort<T: Copy Owned> = - FlatPort<T, PodUnflattener<T>, PipeBytePort>; - pub type PipeChan<T: Copy Owned> = - FlatChan<T, PodFlattener<T>, PipeByteChan>; + pub type PipePort<T> = FlatPort<T, PodUnflattener<T>, PipeBytePort>; + pub type PipeChan<T> = FlatChan<T, PodFlattener<T>, PipeByteChan>; /// Create a `FlatPort` from a `Reader` pub fn reader_port<T: Copy Owned, R: Reader>( @@ -352,11 +350,11 @@ pub mod flatteners { // FIXME #4074: Copy + Owned != POD - pub struct PodUnflattener<T: Copy Owned> { + pub struct PodUnflattener<T> { bogus: () } - pub struct PodFlattener<T: Copy Owned> { + pub struct PodFlattener<T> { bogus: () } @@ -398,14 +396,13 @@ pub mod flatteners { pub type DeserializeBuffer<T> = ~fn(buf: &[u8]) -> T; - pub struct DeserializingUnflattener<D: Decoder, - T: Decodable<D>> { + pub struct DeserializingUnflattener<D, T> { deserialize_buffer: DeserializeBuffer<T> } pub type SerializeValue<T> = ~fn(val: &T) -> ~[u8]; - pub struct SerializingFlattener<S: Encoder, T: Encodable<S>> { + pub struct SerializingFlattener<S, T> { serialize_value: SerializeValue<T> } @@ -518,11 +515,11 @@ pub mod bytepipes { use core::pipes; use core::prelude::*; - pub struct ReaderBytePort<R: Reader> { + pub struct ReaderBytePort<R> { reader: R } - pub struct WriterByteChan<W: Writer> { + pub struct WriterByteChan<W> { writer: W } @@ -767,9 +764,9 @@ mod test { test_some_tcp_stream(reader_port, writer_chan, 9667); } - type ReaderPortFactory<U: Unflattener<int>> = + type ReaderPortFactory<U> = ~fn(TcpSocketBuf) -> FlatPort<int, U, ReaderBytePort<TcpSocketBuf>>; - type WriterChanFactory<F: Flattener<int>> = + type WriterChanFactory<F> = ~fn(TcpSocketBuf) -> FlatChan<int, F, WriterByteChan<TcpSocketBuf>>; fn test_some_tcp_stream<U: Unflattener<int>, F: Flattener<int>>( @@ -893,7 +890,7 @@ mod test { use core::sys; use core::task; - type PortLoader<P: BytePort> = + type PortLoader<P> = ~fn(~[u8]) -> FlatPort<int, PodUnflattener<int>, P>; fn reader_port_loader(bytes: ~[u8] diff --git a/src/libstd/map.rs b/src/libstd/map.rs index f3016e9df21..2fa2825eb4c 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -24,9 +24,9 @@ use core::uint; use core::vec; /// A convenience type to treat a hashmap as a set -pub type Set<K:Eq IterBytes Hash> = HashMap<K, ()>; +pub type Set<K> = HashMap<K, ()>; -pub type HashMap<K:Eq IterBytes Hash, V> = chained::T<K, V>; +pub type HashMap<K, V> = chained::T<K, V>; pub trait StdMap<K:Eq IterBytes Hash Copy, V: Copy> { /// Return the number of elements in the map @@ -142,12 +142,12 @@ pub mod chained { mut next: Option<@Entry<K, V>> } - struct HashMap_<K:Eq IterBytes Hash, V> { + struct HashMap_<K, V> { mut count: uint, mut chains: ~[mut Option<@Entry<K,V>>] } - pub type T<K:Eq IterBytes Hash, V> = @HashMap_<K, V>; + pub type T<K, V> = @HashMap_<K, V>; enum SearchResult<K, V> { NotFound, diff --git a/src/libstd/priority_queue.rs b/src/libstd/priority_queue.rs index 5231d51e31e..fcd9f8379b2 100644 --- a/src/libstd/priority_queue.rs +++ b/src/libstd/priority_queue.rs @@ -22,7 +22,7 @@ extern "C" mod rusti { fn init<T>() -> T; } -pub struct PriorityQueue <T: Ord>{ +pub struct PriorityQueue<T> { priv data: ~[T], } diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 03ef98d09c5..6ded82d5ae4 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -83,7 +83,7 @@ struct SemInner<Q> { blocked: Q } #[doc(hidden)] -enum Sem<Q: Owned> = Exclusive<SemInner<Q>>; +enum Sem<Q> = Exclusive<SemInner<Q>>; #[doc(hidden)] fn new_sem<Q: Owned>(count: int, q: Q) -> Sem<Q> { @@ -167,7 +167,7 @@ impl &Sem<~[mut Waitqueue]> { #[doc(hidden)] type SemRelease = SemReleaseGeneric<()>; type SemAndSignalRelease = SemReleaseGeneric<~[mut Waitqueue]>; -struct SemReleaseGeneric<Q: Owned> { sem: &Sem<Q> } +struct SemReleaseGeneric<Q> { sem: &Sem<Q> } impl<Q: Owned> SemReleaseGeneric<Q> : Drop { fn finalize(&self) { diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 1f285b992c7..82090f8dd62 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -35,7 +35,7 @@ use core::prelude::*; // * symmetric difference: ^ // These would be convenient since the methods work like `each` -pub struct TreeMap<K: Ord, V> { +pub struct TreeMap<K, V> { priv root: Option<~TreeNode<K, V>>, priv length: uint } @@ -202,7 +202,7 @@ impl <K: Ord, V> TreeMap<K, V> { } /// Lazy forward iterator over a map -pub struct TreeMapIterator<K: Ord, V> { +pub struct TreeMapIterator<K, V> { priv stack: ~[&~TreeNode<K, V>], priv node: &Option<~TreeNode<K, V>>, priv current: Option<&~TreeNode<K, V>> @@ -240,7 +240,7 @@ impl <K: Ord, V> TreeMapIterator<K, V> { } } -pub struct TreeSet<T: Ord> { +pub struct TreeSet<T> { priv map: TreeMap<T, ()> } @@ -518,7 +518,7 @@ impl <T: Ord> TreeSet<T> { } /// Lazy forward iterator over a set -pub struct TreeSetIterator<T: Ord> { +pub struct TreeSetIterator<T> { priv iter: TreeMapIterator<T, ()> } @@ -540,7 +540,7 @@ impl <T: Ord> TreeSetIterator<T> { // Nodes keep track of their level in the tree, starting at 1 in the // leaves and with a red child sharing the level of the parent. -struct TreeNode<K: Ord, V> { +struct TreeNode<K, V> { key: K, value: V, left: Option<~TreeNode<K, V>>, diff --git a/src/libstd/workcache.rs b/src/libstd/workcache.rs index 9f46ebef440..81285e5e563 100644 --- a/src/libstd/workcache.rs +++ b/src/libstd/workcache.rs @@ -235,10 +235,17 @@ struct Exec { discovered_outputs: WorkMap } +#[cfg(stage0)] struct Work<T:Owned> { prep: @Mut<Prep>, res: Option<Either<T,PortOne<(Exec,T)>>> } +#[cfg(stage1)] +#[cfg(stage2)] +struct Work<T> { + prep: @Mut<Prep>, + res: Option<Either<T,PortOne<(Exec,T)>>> +} fn json_encode<T:Encodable<json::Encoder>>(t: &T) -> ~str { do io::with_str_writer |wr| { diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 8a5b8a127d0..0433aab51fc 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -110,6 +110,7 @@ pub trait ext_ctxt_ast_builder { fn ty_option(ty: @ast::Ty) -> @ast::Ty; fn ty_infer() -> @ast::Ty; fn ty_nil_ast_builder() -> @ast::Ty; + fn strip_bounds(bounds: &[ast::ty_param]) -> ~[ast::ty_param]; } impl ext_ctxt: ext_ctxt_ast_builder { @@ -370,6 +371,12 @@ impl ext_ctxt: ext_ctxt_ast_builder { } } + fn strip_bounds(bounds: &[ast::ty_param]) -> ~[ast::ty_param] { + do bounds.map |ty_param| { + ast::ty_param { bounds: @~[], ..copy *ty_param } + } + } + fn item_ty_poly(name: ident, span: span, ty: @ast::Ty, diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 774a5596258..e7a8cbb9891 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -248,7 +248,7 @@ impl state: to_type_decls { ast::enum_def(enum_def_ { variants: items_msg, common: None }), - self.ty_params + cx.strip_bounds(self.ty_params) ) ] } @@ -281,7 +281,7 @@ impl state: to_type_decls { self.data_name()], dummy_sp()) .add_tys(cx.ty_vars_global(self.ty_params))))), - self.ty_params)); + cx.strip_bounds(self.ty_params))); } else { items.push( @@ -299,7 +299,7 @@ impl state: to_type_decls { dummy_sp()) .add_tys(cx.ty_vars_global(self.ty_params))), self.proto.buffer_ty_path(cx)])), - self.ty_params)); + cx.strip_bounds(self.ty_params))); }; items } @@ -417,7 +417,7 @@ impl protocol: gen_init { cx.ident_of(~"__Buffer"), dummy_sp(), cx.ty_rec(fields), - params) + cx.strip_bounds(params)) } fn compile(cx: ext_ctxt) -> @ast::item { diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 67f6c4bed3f..86dea693f8a 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -33,6 +33,7 @@ use core::str; use core::to_bytes; /// The specific types of unsupported syntax +#[deriving_eq] pub enum ObsoleteSyntax { ObsoleteLowerCaseKindBounds, ObsoleteLet, @@ -45,16 +46,8 @@ pub enum ObsoleteSyntax { ObsoleteModeInFnType, ObsoleteMoveInit, ObsoleteBinaryMove, - ObsoleteUnsafeBlock -} - -impl ObsoleteSyntax : cmp::Eq { - pure fn eq(&self, other: &ObsoleteSyntax) -> bool { - (*self) as uint == (*other) as uint - } - pure fn ne(&self, other: &ObsoleteSyntax) -> bool { - !(*self).eq(other) - } + ObsoleteUnsafeBlock, + ObsoleteUnenforcedBound } impl ObsoleteSyntax: to_bytes::IterBytes { @@ -123,6 +116,11 @@ impl Parser { ObsoleteUnsafeBlock => ( "non-standalone unsafe block", "use an inner `unsafe { ... }` block instead" + ), + ObsoleteUnenforcedBound => ( + "unenforced type parameter bound", + "use trait bounds on the functions that take the type as \ + arguments, not on the types themselves" ) }; diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index e4a09c3c349..9de875485db 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -18,7 +18,7 @@ use core::dvec::DVec; use std::map::HashMap; use std::map; -type hash_interner<T: Const> = +type hash_interner<T> = {map: HashMap<T, uint>, vect: DVec<T>}; diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs index a14cc3758b1..fc5cf127518 100644 --- a/src/test/auxiliary/issue-2526.rs +++ b/src/test/auxiliary/issue-2526.rs @@ -17,7 +17,7 @@ extern mod std; export context; -struct arc_destruct<T:Const> { +struct arc_destruct<T> { _data: int, } diff --git a/src/test/auxiliary/test_comm.rs b/src/test/auxiliary/test_comm.rs index af321b9959f..6fd39368bae 100644 --- a/src/test/auxiliary/test_comm.rs +++ b/src/test/auxiliary/test_comm.rs @@ -24,7 +24,7 @@ use core::libc::size_t; * transmitted. If a port value is copied, both copies refer to the same * port. Ports may be associated with multiple `chan`s. */ -pub enum port<T: Owned> { +pub enum port<T> { port_t(@port_ptr<T>) } @@ -35,7 +35,7 @@ pub fn port<T: Owned>() -> port<T> { } } -struct port_ptr<T:Owned> { +struct port_ptr<T> { po: *rust_port, } diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index 21709a487e8..17444018356 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -122,15 +122,15 @@ mod map_reduce { use std::map::HashMap; use std::map; - pub type putter<K: Owned, V: Owned> = fn(&K, V); + pub type putter<K, V> = fn(&K, V); - pub type mapper<K1: Owned, K2: Owned, V: Owned> = fn~(K1, putter<K2, V>); + pub type mapper<K1, K2, V> = fn~(K1, putter<K2, V>); - pub type getter<V: Owned> = fn() -> Option<V>; + pub type getter<V> = fn() -> Option<V>; - pub type reducer<K: Copy Owned, V: Copy Owned> = fn~(&K, getter<V>); + pub type reducer<K, V> = fn~(&K, getter<V>); - enum ctrl_proto<K: Copy Owned, V: Copy Owned> { + enum ctrl_proto<K, V> { find_reducer(K, Chan<Chan<::map_reduce::reduce_proto<V>>>), mapper_done } @@ -148,7 +148,7 @@ mod map_reduce { } ) - pub enum reduce_proto<V: Copy Owned> { + pub enum reduce_proto<V> { emit_val(V), done, addref, diff --git a/src/test/compile-fail/issue-2718-a.rs b/src/test/compile-fail/issue-2718-a.rs index 2332d54037f..925350d9b88 100644 --- a/src/test/compile-fail/issue-2718-a.rs +++ b/src/test/compile-fail/issue-2718-a.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub struct send_packet<T: Copy> { +pub struct send_packet<T> { p: T } diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index 739bf097d4f..31158df4185 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -14,7 +14,7 @@ fn test00_start(ch: chan_t<int>, message: int) { send(ch, message); } type task_id = int; type port_id = int; -enum chan_t<T: Owned> = {task: task_id, port: port_id}; +enum chan_t<T> = {task: task_id, port: port_id}; fn send<T: Owned>(ch: chan_t<T>, data: T) { fail; } diff --git a/src/test/run-fail/issue-2444.rs b/src/test/run-fail/issue-2444.rs index b1d8c99faa5..9172364a2f9 100644 --- a/src/test/run-fail/issue-2444.rs +++ b/src/test/run-fail/issue-2444.rs @@ -13,7 +13,7 @@ extern mod std; use std::arc; -enum e<T: Const Owned> { e(arc::ARC<T>) } +enum e<T> { e(arc::ARC<T>) } fn foo() -> e<int> {fail;} diff --git a/src/test/run-pass/auto-encode.rs b/src/test/run-pass/auto-encode.rs index ec73704ca27..ee8cf89d528 100644 --- a/src/test/run-pass/auto-encode.rs +++ b/src/test/run-pass/auto-encode.rs @@ -135,11 +135,6 @@ struct Spanned<T> { node: T, } -enum AnEnum { - AVariant, - AnotherVariant -} - #[auto_encode] #[auto_decode] struct SomeStruct { v: ~[uint] } diff --git a/src/test/run-pass/box-unbox.rs b/src/test/run-pass/box-unbox.rs index 35585014713..ad32ffc75c9 100644 --- a/src/test/run-pass/box-unbox.rs +++ b/src/test/run-pass/box-unbox.rs @@ -10,7 +10,7 @@ -struct Box<T: Copy> {c: @T} +struct Box<T> {c: @T} fn unbox<T: Copy>(b: Box<T>) -> T { return *b.c; } 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 6bc88188452..bccb42c4938 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -27,7 +27,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> { +struct cat<T> { // Yes, you can have negative meows priv mut meows : int, diff --git a/src/test/run-pass/generic-exterior-box.rs b/src/test/run-pass/generic-exterior-box.rs index 738bb73b0be..c2abcc75283 100644 --- a/src/test/run-pass/generic-exterior-box.rs +++ b/src/test/run-pass/generic-exterior-box.rs @@ -10,7 +10,7 @@ -struct Recbox<T: Copy> {x: @T} +struct Recbox<T> {x: @T} fn reclift<T: Copy>(t: T) -> Recbox<T> { return Recbox {x: @t}; } diff --git a/src/test/run-pass/generic-exterior-unique.rs b/src/test/run-pass/generic-exterior-unique.rs index 2095578aefa..a4a576abc75 100644 --- a/src/test/run-pass/generic-exterior-unique.rs +++ b/src/test/run-pass/generic-exterior-unique.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Recbox<T: Copy> {x: ~T} +struct Recbox<T> {x: ~T} fn reclift<T: Copy>(t: T) -> Recbox<T> { return Recbox {x: ~t}; } diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs index 52b3baba58e..0fa06e2f212 100644 --- a/src/test/run-pass/issue-2288.rs +++ b/src/test/run-pass/issue-2288.rs @@ -11,7 +11,7 @@ trait clam<A: Copy> { fn chowder(y: A); } -struct foo<A: Copy> { +struct foo<A> { x: A, } diff --git a/src/test/run-pass/issue-2311-2.rs b/src/test/run-pass/issue-2311-2.rs index 10befa74228..21201d0a957 100644 --- a/src/test/run-pass/issue-2311-2.rs +++ b/src/test/run-pass/issue-2311-2.rs @@ -9,7 +9,7 @@ // except according to those terms. trait clam<A: Copy> { } -struct foo<A: Copy> { +struct foo<A> { x: A, } diff --git a/src/test/run-pass/issue-2445-b.rs b/src/test/run-pass/issue-2445-b.rs index 35d3d089709..f1b7d45e440 100644 --- a/src/test/run-pass/issue-2445-b.rs +++ b/src/test/run-pass/issue-2445-b.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct c1<T: Copy> { +struct c1<T> { x: T, } diff --git a/src/test/run-pass/issue-2445.rs b/src/test/run-pass/issue-2445.rs index 7cf681c9f94..fada6a7b02e 100644 --- a/src/test/run-pass/issue-2445.rs +++ b/src/test/run-pass/issue-2445.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct c1<T: Copy> { +struct c1<T> { x: T, } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index f8f2fc461c3..68a318eab4e 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -34,7 +34,7 @@ pub mod pipes { pure fn ne(&self, other: &state) -> bool { !(*self).eq(other) } } - pub type packet<T: Owned> = { + pub type packet<T> = { mut state: state, mut blocked_task: Option<task::Task>, mut payload: Option<T> @@ -157,7 +157,7 @@ pub mod pipes { } } - pub struct send_packet<T: Owned> { + pub struct send_packet<T> { mut p: Option<*packet<T>>, } @@ -185,7 +185,7 @@ pub mod pipes { } } - pub struct recv_packet<T: Owned> { + pub struct recv_packet<T> { mut p: Option<*packet<T>>, } diff --git a/src/test/run-pass/issue-3149.rs b/src/test/run-pass/issue-3149.rs index 533106ff936..c578f1144a7 100644 --- a/src/test/run-pass/issue-3149.rs +++ b/src/test/run-pass/issue-3149.rs @@ -22,7 +22,7 @@ pure fn Matrix4<T:Copy Num>(m11: T, m12: T, m13: T, m14: T, } } -struct Matrix4<T:Copy Num> { +struct Matrix4<T> { 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/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs index d072df4d8e8..cf0a0a07397 100644 --- a/src/test/run-pass/reflect-visit-data.rs +++ b/src/test/run-pass/reflect-visit-data.rs @@ -29,7 +29,7 @@ fn align(size: uint, align: uint) -> uint { ((size + align) - 1u) & !(align - 1u) } -enum ptr_visit_adaptor<V: TyVisitor movable_ptr> = Inner<V>; +enum ptr_visit_adaptor<V> = Inner<V>; impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V> { diff --git a/src/test/run-pass/resource-generic.rs b/src/test/run-pass/resource-generic.rs index e528cd32974..7165d6089e8 100644 --- a/src/test/run-pass/resource-generic.rs +++ b/src/test/run-pass/resource-generic.rs @@ -13,7 +13,7 @@ struct Arg<T> {val: T, fin: extern fn(T)} -struct finish<T: Copy> { +struct finish<T> { arg: Arg<T> } diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index 8476e256cd2..8cb597a0d79 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -9,7 +9,7 @@ // except according to those terms. // tests that ctrl's type gets inferred properly -type command<K: Owned, V: Owned> = {key: K, val: V}; +type command<K, V> = {key: K, val: V}; fn cache_server<K: Owned, V: Owned>(c: oldcomm::Chan<oldcomm::Chan<command<K, V>>>) { let ctrl = oldcomm::Port(); |
