summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-01-03libstd: De-`@mut` the `heap_cycles` testPatrick Walton-4/+8
2014-01-03libstd: Remove a spurious `@mut` from a disabled testPatrick Walton-2/+3
2014-01-03auto merge of #11149 : alexcrichton/rust/remove-either, r=brsonbors-282/+35
Had to change some stuff in typeck to bootstrap (getting methods in fmt off of Either), but other than that not so painful. Closes #9157
2014-01-03Remove std::eitherAlex Crichton-282/+35
2014-01-03auto merge of #11276 : brson/rust/0.9, r=pcwaltonbors-1/+1
2014-01-03auto merge of #10861 : alexcrichton/rust/iostr, r=pcwaltonbors-24/+73
These methods are sorely needed on readers and writers, and I believe that the encoding story should be solved with composition. This commit adds back the missed functions when reading/writing strings onto generic Readers/Writers.
2014-01-03Add read_to_str and write_{str, line}Alex Crichton-24/+73
These methods are sorely needed on readers and writers, and I believe that the encoding story should be solved with composition. This commit adds back the missed functions when reading/writing strings onto generic Readers/Writers.
2014-01-02Abort on double-failure. #910Brian Anderson-1/+7
Previously this was an rtabort!, indicating a runtime bug. Promote this to a more intentional abort and print a (slightly) more informative error message. Can't test this sense our test suite can't handle an abort exit.
2014-01-03fixup! libstd: Always inline all byteswap functionsCarl-Anton Ingmarsson-27/+27
2014-01-02auto merge of #10828 : SimonSapin/rust/ascii_opt, r=pcwaltonbors-36/+70
… instead of failing. Make them default methods on the trait, and also make .to_ascii() a default method while we’re at it.
2014-01-02libstd: Always inline all byteswap functionsCarl-Anton Ingmarsson-27/+27
2014-01-02Bump version to 0.9Brian Anderson-1/+1
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-31Add .insert() and .insert_char() methods to ~str.Simon Sapin-0/+42
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.