about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-01-02auto merge of #11265 : c-a/rust/byteswap_from, r=alexcrichtonbors-0/+13
This patchset adds intrinsics similar to the to_[be|le][16|32|64] intrinsics but for going in the reverse direction, e.g. from big/little endian to host endian. Implementation wise they do exactly the same as the corresponding to_* functions but I think it anyway make sense to have them since using the to_* functions in the reverse direction is not entirely intuitive. The first patch adds the intrinsics and the two following changes instances of bswap* to use the [to|from]_* intrinsics instead.
2014-01-01auto merge of #11245 : alexcrichton/rust/issue-11225, r=pcwaltonbors-0/+3
Commit messages are a little more descriptive.
2014-01-01auto merge of #11242 : Dretch/rust/hashmap-key-value-iterators, r=pcwaltonbors-6/+39
2014-01-01Add byteswap intrinsics for converting from big/little to host endianCarl-Anton Ingmarsson-0/+13
These are similar to the ntoh[s|l] functions in C and have the style of from_[be|le][16|32|64].
2014-01-01auto merge of #11212 : alexcrichton/rust/local-task-count, r=brsonbors-37/+59
For libgreen, bookeeping should not be global but rather on a per-pool basis. Inside libnative, it's known that there must be a global counter with a mutex/cvar. The benefit of taking this strategy is to remove this functionality from libstd to allow fine-grained control of it through libnative/libgreen. Notably, helper threads in libnative can manually decrement the global count so they don't count towards the global count of threads. Also, the shutdown process of *all* sched pools is now dependent on the number of tasks in the pool being 0 rather than this only being a hardcoded solution for the initial sched pool in libgreen. This involved adding a Local::try_take() method on the Local trait in order for the channel wakeup to work inside of libgreen. The channel send was happening from a SchedTask when there is no Task available in TLS, and now this is possible to work (remote wakeups are always possible, just a little slower).
2014-01-01Move task count bookeeping out of libstdAlex Crichton-37/+59
For libgreen, bookeeping should not be global but rather on a per-pool basis. Inside libnative, it's known that there must be a global counter with a mutex/cvar. The benefit of taking this strategy is to remove this functionality from libstd to allow fine-grained control of it through libnative/libgreen. Notably, helper threads in libnative can manually decrement the global count so they don't count towards the global count of threads. Also, the shutdown process of *all* sched pools is now dependent on the number of tasks in the pool being 0 rather than this only being a hardcoded solution for the initial sched pool in libgreen. This involved adding a Local::try_take() method on the Local trait in order for the channel wakeup to work inside of libgreen. The channel send was happening from a SchedTask when there is no Task available in TLS, and now this is possible to work (remote wakeups are always possible, just a little slower).
2014-01-01Don't leave lingering files in doc testsAlex Crichton-0/+2
Closes #11234
2013-12-31auto merge of #11187 : alexcrichton/rust/once, r=brsonbors-13/+150
Rationale can be found in the first commit, but this is basically the same thing as `pthread_once`
2013-12-31Convert relevant static mutexes to OnceAlex Crichton-22/+15
2013-12-31auto merge of #11137 : g3xzh/rust/benchm, r=cmrbors-0/+41
Benchmark testing `is_ancestor_of` and `pop` ref: https://github.com/mozilla/rust/issues/9694
2013-12-31auto merge of #11186 : alexcrichton/rust/native-udp, r=brsonbors-24/+115
I personally do not have huge amounts of experience in this area, so there's likely a thing or two wrong around the edges. I tried to just copy what libuv is doing as closely as possible with a few tweaks in a few places, but all of the `std::io::net::udp` tests are now run in both native and green settings so the published functionality is all being tested.
2013-12-31auto merge of #11173 : whitequark/rust/master, r=thestingerbors-0/+12
This PR adds `std::unsafe::intrinsics::{volatile_load,volatile_store}`, which map to LLVM's `load volatile` and `store volatile` operations correspondingly. This would fix #11172. I have addressed several uncertainties with this PR in the line comments.
2013-12-31Conservatively export all trait methods and implsAlex Crichton-0/+1
The comments have more information as to why this is done, but the basic idea is that finding an exported trait is actually a fairly difficult problem. The true answer lies in whether a trait is ever referenced from another exported method, and right now this kind of analysis doesn't exist, so the conservative answer of "yes" is always returned to answer whether a trait is exported. Closes #11224 Closes #11225
2013-12-31Fix issue #11216 - Replace std::hashmap::{each_key, each_value} with iterators.Gareth Smith-6/+39
2013-12-31Implement native UDP I/OAlex Crichton-24/+115
2013-12-31auto merge of #11208 : alexcrichton/rust/less-c, r=cmrbors-10/+102
Right now on linux, an empty executable with LTO still depends on librt becaues of the clock_gettime function in rust_builtin.o, but this commit moves this dependency into a rust function which is subject to elimination via LTO. At the same time, this also drops libstd's dependency on librt on unices that are not OSX because the library is only used by extra::time (and now the dependency is listed in that module instead).
2013-12-31auto merge of #11236 : huonw/rust/sort-rust-log-help, r=sanxiynbors-2/+9
Fixes #8949.
2013-12-31std: print RUST_LOG=::help in sorted order.Huon Wilson-2/+9
Fixes #8949.
2013-12-30auto merge of #11142 : alan-andrade/rust/improve_opts_example, r=cmrbors-5/+9
Ran into this in practice, fixing it to improve example correctness.
2013-12-31Fix testsAlan Andrade-5/+9
2013-12-30Add rust_fail. #11219Brian Anderson-14/+21
2013-12-31Implement volatile_load and volatile_store intrinsics.Peter Zotov-0/+12
2013-12-30Convert some C functions to rust functionsAlex Crichton-10/+102
Right now on linux, an empty executable with LTO still depends on librt becaues of the clock_gettime function in rust_builtin.o, but this commit moves this dependency into a rust function which is subject to elimination via LTO. At the same time, this also drops libstd's dependency on librt on unices that are not OSX because the library is only used by extra::time (and now the dependency is listed in that module instead).
2013-12-30Add more benchmark tests to path/posixg3xzh-0/+41
Benchmark testing `is_ancestor_of` and `path_relative_from`
2013-12-30auto merge of #11199 : alexcrichton/rust/windows-isnt-waiting, r=pcwaltonbors-4/+1
Turns out with an argument of 0 the function always returns immediately! Closes #11003
2013-12-29Actually block in a windows cvarAlex Crichton-4/+1
Turns out with an argument of 0 the function always returns immediately! Closes #11003
2013-12-29Add method .as_mut_slice() to MutableVectorKevin Ballard-0/+6
This method is primarily intended to allow for converting a [T, ..N] to a &mut [T].
2013-12-29auto merge of #11134 : lucab/rust/lucab/libstd-doc, r=cmrbors-42/+50
Uniform the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index.
2013-12-28Implement a Once primitive for initializationAlex Crichton-1/+145
Of the 8 static mutexes that are currently in-use by the compiler and its libraries, 4 of them are currently used for one-time initialization. The unforunate side effect of using a static mutex is that the mutex is leaked. This primitive should provide the basis for efficiently keeping track of one-time initialization as well as ensuring that it does not leak the internal mutex that is used. I have chosen to put this in libstd because libstd is currently making use of a static initialization mutex (rt::local_ptr), but I can also see a more refined version of this type being suitable to initialize FFI bindings (such as initializing LLVM and initializing winsock networking on windows). I also intend on adding "helper threads" to libnative, and those will greatly benefit from a simple "once" primitive rather than always reinventing the wheel by using mutexes and bools. I would much rather see this primitive built on a mutex that blocks green threads appropriately, but that does not exist at this time, so it does not belong outside of `std::unstable`.
2013-12-28auto merge of #11180 : alexcrichton/rust/fix-deferred-send, r=cmrbors-1/+1
I forgot to add this back in after I removed can_resched and then realized I had to add it back.
2013-12-28auto merge of #11150 : huonw/rust/moar-docs, r=alexcrichtonbors-174/+189
(I removed the `fn main` from the `std::rand` examples to make it consistent with the rest of the codebase.)
2013-12-29std::hashmap: add an example with the basic methods.Huon Wilson-0/+39
2013-12-28Guard a maybe_yield in Chan with can_reschedAlex Crichton-1/+1
I forgot to add this back in after I removed can_resched and then realized I had to add it back.
2013-12-28auto merge of #11159 : alexcrichton/rust/native-io, r=pcwaltonbors-75/+506
The old `rtio-processes` run-pass test is now moved into libstd's `io::process` module, and all process and TCP tests are now run with `iotest!` (both a native and a green version are tested). All TCP networking on windows is provided by `ws2_32` which is apparently very similar to unix networking (hurray!).
2013-12-27Implement native TCP I/OAlex Crichton-70/+354
2013-12-27auto merge of #11160 : octurion/rust/cloneable, r=alexcrichtonbors-5/+5
Rename all instances of ClonableIterator to CloneableIterator. This fixes bug https://github.com/mozilla/rust/issues/11132.
2013-12-27Bring native process bindings up to dateAlex Crichton-6/+152
Move the tests into libstd, use the `iotest!` macro to test both native and uv bindings, and use the cloexec trick to figure out when the child process fails in exec.
2013-12-27auto merge of #11098 : erickt/rust/collect, r=alexcrichtonbors-31/+98
This patch changes `result::collect` (and adds a new `option::collect`) from creating a `~[T]` to take an `Iterator`. This makes the function much more flexible, and may replace the need for #10989. This patch is a little more complicated than it needs to be because of #11084. Once that is fixed we can replace the `CollectIterator` with a `Scan` iterator. It also fixes a test warning.
2013-12-27Renamed ClonableIterator to CloneableIteratorAlexandros Tasos-5/+5
2013-12-27std: uniform modules titles for docLuca Bruno-42/+50
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-26libstd: Make a temporary separate `stage0` implementation for `Cell` toPatrick Walton-0/+27
avoid a crash in later stages
2013-12-26std: result::collect to take an iterator, add option::collectErick Tryzelaar-29/+97
2013-12-26std: remove some test warningsErick Tryzelaar-2/+1
2013-12-26Register new snapshotsAlex Crichton-27/+0
2013-12-27std::hashmap: add an example to mangle.Huon Wilson-0/+37
2013-12-26std::rand: remove the `fn main()` from the examples.Huon Wilson-174/+113
2013-12-26auto merge of #11127 : huonw/rust/vec-docs, r=alexcrichtonbors-27/+115
2013-12-25Test fixes and rebase conflictsAlex Crichton-109/+144
* vec::raw::to_ptr is gone * Pausible => Pausable * Removing @ * Calling the main task "<main>" * Removing unused imports * Removing unused mut * Bringing some libextra tests up to date * Allowing compiletest to work at stage0 * Fixing the bootstrap-from-c rmake tests * assert => rtassert in a few cases * printing to stderr instead of stdout in fail!()
2013-12-24green: Move a scheduler test inside libgreenAlex Crichton-60/+0
This test also had a race condition in using the cvar/lock, so I fixed that up as well. The race originated from one half trying to destroy the lock when another half was using it.
2013-12-24std: Remove must deferred sending functionsAlex Crichton-34/+5
These functions are all unnecessary now, and they only have meaning in the M:N context. Removing these functions uncovered a bug in the librustuv timer bindings, but it was fairly easy to cover (and the test is already committed). These cannot be completely removed just yet due to their usage in the WaitQueue of extra::sync, and until the mutex in libextra is rewritten it will not be possible to remove the deferred sends for channels.