about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
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-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.
2014-03-22auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichtonbors-31/+11
This PR removes the `Freeze` kind and the `NoFreeze` marker completely. Fixes #12577 cc @nikomatsakis r?
2014-03-22auto merge of #12995 : Kroisse/rust/vec_ng_mut_slices, r=alexcrichtonbors-0/+122
These functions are implemented for &mut [T], but std::vec_ng::Vec has not yet.
2014-03-23Add Vec::mut_slice_from(), mut_slice_to(), and mut_split_at()Eunchong Yu-0/+122
2014-03-22auto merge of #13053 : alexcrichton/rust/removing-ref-cell-get, r=huonwbors-43/+20
This commit removes the `get()` method from `Ref` and `RefMut` in favor of the `*` operator, and removes all usage of the `deref()` function manually from rustc, favoring using `*` instead. Some of the code is a little wacky, but that's due to either #13044 or #13042
2014-03-22std: Add an I/O reader method to fill a bufferAlex Crichton-7/+38
I've found a common use case being to fill a slice (not an owned vector) completely with bytes. It's posible for short reads to happen, and if you're trying to get an exact number of bytes then this helper will be useful.
2014-03-22rustc: Remove all usage of manual deref()Alex Crichton-17/+15
Favor using '*' instead
2014-03-22std: Remove the get() method from RefCell wrappersAlex Crichton-27/+6
This method has been entirely obsoleted by autoderef, so there's no reason for its existence.
2014-03-22std::os: Handle FormatMessage failureklutzy-3/+8
`FormatMessageW()` is called by `std::os::last_os_error()` to convert errno into string, but the function may fail on non-english locale. I don't know why it fails, but anyway it's better to return errno than to `fail!()` in the case. Fixes #13075 Fixes #13073
2014-03-22std: Remove the Freeze kind and the NoFreeze markerFlavio Percoco-15/+1
2014-03-22cell: Remove Freeze / NoFreezeFlavio Percoco-10/+6
2014-03-22std::comm: Remove Freeze / NoFreezeFlavio Percoco-6/+4
2014-03-22auto merge of #13052 : sfackler/rust/clean-refcell, r=alexcrichtonbors-83/+16
These are superfluous now that we have fixed rvalue lifetimes and Deref. I'd also like to kill off `get` and `set`, but that'll be a large change so I want to make sure that we actually want to do that first.
2014-03-22auto merge of #12907 : alexcrichton/rust/issue-12892, r=brsonbors-18/+19
These methods can be mistaken for general "read some bytes" utilities when they're actually only meant for reading an exact number of bytes. By renaming them it's much clearer about what they're doing without having to read the documentation. Closes #12892
2014-03-21auto merge of #13051 : alexcrichton/rust/issue-13047, r=thestingerbors-1/+2
It's useful for structures which use deriving(Clone), even though it's implicitly copyable. Closes #13047
2014-03-21auto merge of #13036 : alexcrichton/rust/atomics, r=alexcrichtonbors-137/+1110
Closes #11583, rebasing of #12430 now that we've got `Share` and better analysis with statics.
2014-03-21auto merge of #13016 : huonw/rust/new-opt-vec, r=cmrbors-0/+13
Replace syntax::opt_vec with syntax::owned_slice The `owned_slice::OwnedSlice` is `(*T, uint)` (i.e. a direct equivalent to DSTs `~[T]`). This shaves two words off the old OptVec type; and also makes substituting in other implementations easy, by removing all the mutation methods. (And also everything that's very rarely/never used.)
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-0/+13
syntax::opt_vec is now entirely unused, and so can go.
2014-03-21rustc: Switch defaults from libgreen to libnativeAlex Crichton-0/+10
The compiler will no longer inject libgreen as the default runtime for rust programs, this commit switches it over to libnative by default. Now that libnative has baked for some time, it is ready enough to start getting more serious usage as the default runtime for rustc generated binaries. We've found that there isn't really a correct decision in choosing a 1:1 or M:N runtime as a default for all applications, but it seems that a larger number of programs today would work more reasonable with a native default rather than a green default. With this commit come a number of bugfixes: * The main native task is now named "<main>" * The main native task has the stack bounds set up properly * #[no_uv] was renamed to #[no_start] * The core-run-destroy test was rewritten for both libnative and libgreen and one of the tests was modified to be more robust. * The process-detach test was locked to libgreen because it uses signal handling