summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-03-31Bump version to 0.10Alex Crichton-1/+1
2014-03-31auto merge of #13221 : thestinger/rust/append, r=alexcrichtonbors-32/+32
These were only free functions on `~[T]` because taking self by-value used to be broken.
2014-03-31vec: convert `append` and `append_one` to methodsDaniel Micay-32/+32
These were only free functions on `~[T]` because taking self by-value used to be broken.
2014-03-30Rename `from_iterator` to `from_iter` for consistency.Brian Anderson-8/+8
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-91/+6
2014-03-29auto merge of #13183 : erickt/rust/remove-list, r=alexcrichtonbors-3/+3
`collections::list::List` was decided in a [team meeting](https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-03-25) that it was unnecessary, so this PR removes it. Additionally, it removes an old and redundant purity test and fixes some warnings.
2014-03-29auto merge of #13188 : FlaPer87/rust/master, r=alexcrichtonbors-27/+0
2014-03-29Register new snapshotFlavio Percoco-27/+0
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-83/+83
Closes #2569
2014-03-28syntax: Accept meta matchers in macrosAlex Crichton-6/+6
This removes the `attr` matcher and adds a `meta` matcher. The previous `attr` matcher is now ambiguous because it doesn't disambiguate whether it means inner attribute or outer attribute. The new behavior can still be achieved by taking an argument of the form `#[$foo:meta]` (the brackets are part of the macro pattern). Closes #13067
2014-03-28auto merge of #13158 : alexcrichton/rust/issue-13123, r=brsonbors-0/+30
Some unix platforms will send a SIGPIPE signal instead of returning EPIPE from a syscall by default. The native runtime doesn't install a SIGPIPE handler, causing the program to die immediately in this case. This brings the behavior in line with libgreen by ignoring SIGPIPE and propagating EPIPE upwards to the application in the form of an IoError. Closes #13123
2014-03-28native: Ignore SIGPIPE by defaultAlex Crichton-0/+30
Some unix platforms will send a SIGPIPE signal instead of returning EPIPE from a syscall by default. The native runtime doesn't install a SIGPIPE handler, causing the program to die immediately in this case. This brings the behavior in line with libgreen by ignoring SIGPIPE and propagating EPIPE upwards to the application in the form of an IoError. Closes #13123
2014-03-28native: Use WNOHANG before signalingAlex Crichton-3/+32
It turns out that on linux, and possibly other platforms, child processes will continue to accept signals until they have been *reaped*. This means that once the child has exited, it will succeed to receive signals until waitpid() has been invoked on it. This is unfortunate behavior, and differs from what is seen on OSX and windows. This commit changes the behavior of Process::signal() to be the same across platforms, and updates the documentation of Process::kill() to note that when signaling a foreign process it may accept signals until reaped. Implementation-wise, this invokes waitpid() with WNOHANG before each signal to the child to ensure that if the child has exited that we will reap it. Other possibilities include installing a SIGCHLD signal handler, but at this time I believe that that's too complicated. Closes #13124
2014-03-28std and green: fix some warningsErick Tryzelaar-3/+3
2014-03-28auto merge of #13160 : FlaPer87/rust/rename-pod, r=thestingerbors-33/+48
So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the `Pod` kind into `Copy`. RFC: 0003-opt-in-builtin-traits r? @nikomatsakis
2014-03-28auto merge of #13154 : tomassedovic/rust/patch-1, r=alexcrichtonbors-1/+1
HashMap and HashSet require keys to implement TotalEq. This makes it possible to use TypeId as a HashMap key again. Question for reviewers: assuming we want to support `HashMap<TypeId, whatever>`, would it make sense to add a relevant test? If so, should it go to libcollections or libstd?
2014-03-28Rename Pod into CopyFlavio Percoco-33/+48
Summary: So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the Pod kind into Copy. RFC: 0003-opt-in-builtin-traits Test Plan: make check Reviewers: cmr Differential Revision: http://phabricator.octayn.net/D3
2014-03-27Fix fallout of removing default boundsAlex Crichton-167/+177
This is all purely fallout of getting the previous commit to compile.
2014-03-26auto merge of #13135 : alexcrichton/rust/dox, r=alexcrichtonbors-114/+713
I touched up the documentation from @pcwalton found in #12952.
2014-03-26Derive TotalEq for std::intrinsics::TypeIdTomas Sedovic-1/+1
HashMap and HashSet require keys to implement TotalEq. This makes it possible to use TypeId as a HashMap key again.
2014-03-26auto merge of #13134 : alexcrichton/rust/freebsd-libm, r=thestingerbors-0/+1
Apparently we had forgotten to do this for freebsd, causing possible problems on FreeBSD 10. The discussion in #12324 has some more details about how it's missing.
2014-03-26auto merge of #13117 : alexcrichton/rust/no-crate-map, r=brsonbors-108/+1
This can be done now that logging has been moved out and libnative is the default (not libgreen)
2014-03-25auto merge of #13039 : Kimundi/rust/iter_by_value_extend, r=alexcrichtonbors-24/+24
# Summary Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by value. These functions always exhaust the passed `Iterator`, and are often used for transferring the values of a new `Iterator` directly into a data structure, so using them usually require the use of the `&mut` operator: ``` foo.extend(&mut bar.move_iter()); // Transfer content from bar into foo let mut iter = ...; foo.extend(&mut iter); // iter is now empty ``` This patch changes both the `FromIterator` and `Extendable` traits to take the iterator by value instead, which makes the common case of using these traits less heavy: ``` foo.extend(bar.move_iter()); // Transfer content from bar into foo let iter = ...; foo.extend(iter); // iter is now inaccessible if it moved // or unchanged if it was Pod and copied. ``` # Composability This technically makes the traits less flexible from a type system pov, because they now require ownership. However, because `Iterator` provides the `ByRef` adapter, there is no loss of functionality: ``` foo.extend(iter.by_ref()); // Same semantic as today, for the few situations where you need it. ``` # Motivation This change makes it less painful to use iterators for shuffling values around between collections, which makes it more acceptable to always use them for this, enabling more flexibility. For example, `foo.extend(bar.move_iter())` can generally be the fastest way to append an collections content to another one, without both needing to have the same type. Making this easy to use would allow the removal of special cased methods like `push_all()` on vectors. (See https://github.com/mozilla/rust/issues/12456) I opened https://github.com/mozilla/rust/issues/13038 as well, to discuss this change in general if people object to it. # Further work This didn't change the `collect()` method to take by value `self`, nor any of the other adapters that also exhaust their iterator argument. For consistency this should probably happen in the long term, but for now this is too much trouble, as every use of them would need to be checked for accidentally changed semantic by going `&mut self -> self`. (which allows for the possibility that a `Pod` iterator got copied instead of exhausted without generating a type error by the change)
2014-03-25Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by ↵Marvin Löbel-24/+24
value
2014-03-25auto merge of #13070 : huonw/rust/share-doc, r=alexcrichtonbors-1/+45
std: expand the `Share` docs to make them more precise. And give some examples about exactly what's `Share` and what's not.
2014-03-25std: Touch various I/O documentation blocksAlex Crichton-17/+39
These are mostly touchups from the previous commit.
2014-03-25libstd: Document the following modules:Patrick Walton-112/+689
* native::io * std::char * std::fmt * std::fmt::parse * std::io * std::io::extensions * std::io::net::ip * std::io::net::udp * std::io::net::unix * std::io::pipe * std::num * std::num::f32 * std::num::f64 * std::num::strconv * std::os
2014-03-25std: Explicitly link to libm for freebsdAlex Crichton-0/+1
Apparently we had forgotten to do this for freebsd, causing possible problems on FreeBSD 10. The discussion in #12324 has some more details about how it's missing.
2014-03-26std: expand the `Share` docs to make them more precise.Huon Wilson-1/+45
And give some examples about exactly what's `Share` and what's not.
2014-03-24comm: Implement synchronous channelsAlex Crichton-16/+1227
This commit contains an implementation of synchronous, bounded channels for Rust. This is an implementation of the proposal made last January [1]. These channels are built on mutexes, and currently focus on a working implementation rather than speed. Receivers for sync channels have select() implemented for them, but there is currently no implementation of select() for sync senders. Rust will continue to provide both synchronous and asynchronous channels as part of the standard distribution, there is no intent to remove asynchronous channels. This flavor of channels is meant to provide an alternative to asynchronous channels because like green tasks, asynchronous channels are not appropriate for all situations. [1] - https://mail.mozilla.org/pipermail/rust-dev/2014-January/007924.html
2014-03-24auto merge of #12900 : alexcrichton/rust/rewrite-sync, r=brsonbors-55/+61
* Remove clone-ability from all primitives. All shared state will now come from the usage of the primitives being shared, not the primitives being inherently shareable. This allows for fewer allocations for stack-allocated primitives. * Add `Mutex<T>` and `RWLock<T>` which are stack-allocated primitives for purely wrapping a piece of data * Remove `RWArc<T>` in favor of `Arc<RWLock<T>>` * Remove `MutexArc<T>` in favor of `Arc<Mutex<T>>` * Shuffle around where things are located * The `arc` module now only contains `Arc` * A new `lock` module contains `Mutex`, `RWLock`, and `Barrier` * A new `raw` module contains the primitive implementations of `Semaphore`, `Mutex`, and `RWLock` * The Deref/DerefMut trait was implemented where appropriate * `CowArc` was removed, the functionality is now part of `Arc` and is tagged with `#[experimental]`. * The crate now has #[deny(missing_doc)] * `Arc` now supports weak pointers This is not a large-scale rewrite of the functionality contained within the `sync` crate, but rather a shuffling of who does what an a thinner hierarchy of ownership to allow for better composability.
2014-03-24std: Unignore atomic testsBrian Anderson-4/+2
2014-03-24auto merge of #13049 : alexcrichton/rust/io-fill, r=huonwbors-7/+38
This method can be used to fill a byte slice of data entirely, and it's considered an error if any error happens before its entirely filled.
2014-03-24rustc: Remove all crate map supportAlex Crichton-107/+0
The crate map is no longer necessary now that logging and event loop factories have been moved out. Closes #11617 Closes #11731
2014-03-24green: Remove the dependence on the crate mapAlex Crichton-1/+1
This is the final nail in the coffin for the crate map. The `start` function for libgreen now has a new added parameter which is the event loop factory instead of inferring it from the crate map. The two current valid values for this parameter are `green::basic::event_loop` and `rustuv::event_loop`.
2014-03-23auto merge of #13096 : sstewartgallus/rust/cleanup-test-warnings, r=huonwbors-6/+5
2014-03-23This commit cleans up a few test warningsSteven Stewart-Gallus-6/+5
2014-03-23std: Move NativeMutex from &mut self to &selfAlex Crichton-50/+59
The proper usage of shared types is now sharing through `&self` rather than `&mut self` because the mutable version will provide stronger guarantees (no aliasing on *any* thread).
2014-03-23Snapshot cleanupAlex Crichton-1/+0
2014-03-23auto merge of #13102 : huonw/rust/totaleq-deriving, r=thestingerbors-85/+32
std: remove the `equals` method from `TotalEq`. `TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-23auto merge of #13099 : FlaPer87/rust/master, r=huonwbors-1042/+0
2014-03-23std: remove the `equals` method from `TotalEq`.Huon Wilson-85/+32
`TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
2014-03-23auto merge of #13092 : sfackler/rust/buffer-vec, r=thestingerbors-15/+24
`Vec` is now used for the internal buffer instead of `~[]`. Some module level documentation somehow ended up attached to `BufferedReader` so I fixed that as well.
2014-03-23Register new snapshotsFlavio Percoco-1042/+0
2014-03-23auto merge of #13090 : thestinger/rust/iter, r=Aatchbors-42/+30
This has been rendered obsolete by partial type hints. Since the `~[T]` type is in the process of being removed, it needs to go away.
2014-03-23iter: remove `to_owned_vec`Daniel Micay-42/+30
This needs to be removed as part of removing `~[T]`. Partial type hints are now allowed, and will remove the need to add a version of this method for `Vec<T>`. For now, this involves a few workarounds for partial type hints not completely working.
2014-03-22auto merge of #13088 : thestinger/rust/hashmap, r=cmrbors-6/+23
Closes #5283
2014-03-23use TotalEq for HashMapDaniel Micay-6/+23
Closes #5283
2014-03-22make std::managed privateDaniel Micay-19/+1
This removes two tests built on `managed::refcount`, but these issues are well-covered elsewhere for non-managed types.
2014-03-22Some cleanup in std::io::bufferedSteven Fackler-15/+24
`Vec` is now used for the internal buffer instead of `~[]`. Some module level documentation somehow ended up attached to `BufferedReader` so I fixed that as well.