diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 14 | ||||
| -rw-r--r-- | src/libstd/comm.rs | 9 | ||||
| -rw-r--r-- | src/libstd/flatpipes.rs | 33 | ||||
| -rw-r--r-- | src/libstd/map.rs | 8 | ||||
| -rw-r--r-- | src/libstd/priority_queue.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 4 | ||||
| -rw-r--r-- | src/libstd/treemap.rs | 10 | ||||
| -rw-r--r-- | src/libstd/workcache.rs | 7 |
8 files changed, 49 insertions, 38 deletions
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| { |
