about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-12-03auto merge of #10768 : Blei/rust/logging-enabled-macros, r=alexcrichtonbors-5/+20
This is useful when the information that is needed to do useful logging is expensive to produce.
2013-12-03add MutableVector::mut_split(self, pred) -> DoubleEndedIterator<&mut [T]>Guillaume Pinot-4/+110
This method is the mutable version of ImmutableVector::split. It is a DoubleEndedIterator, making mut_rsplit irrelevent. The size_hint method is not optimal because of #9629. At the same time, clarify *split* iterator doc.
2013-12-02Add a macro to check if logging at a given label is enabledPhilipp Brüschweiler-5/+20
This is useful when the information that is needed to do useful logging is expensive to produce.
2013-12-02rename MutableVector::mut_split(at) to MutableVector::mut_split_at(at)Guillaume Pinot-6/+6
2013-12-01auto merge of #10756 : thestinger/rust/transmute, r=alexcrichtonbors-7/+1
2013-12-01remove useless `transmute_immut` functionDaniel Micay-7/+1
2013-11-30auto merge of #10739 : DaGenix/rust/mut-chunks, r=alexcrichtonbors-0/+102
mut_chunks() returns an iterator that produces mutable slices. This is the mutable version of the existing chunks() method on the ImmutableVector trait. EDIT: This uses only safe code now. PREVIOUSLY: I tried to get this working with safe code only, but I couldn't figure out how to make that work. Before #8624, the exact same code worked without the need for the transmute() call. With that fix and without the transmute() call, the compiler complains about the call to mut_slice(). I think the issue is that the mutable slice that is returned will live longer than the self parameter since the self parameter doesn't have an explicit lifetime. However, that is the way that the Iterator trait defines the next() method. I'm sure there is a good reason for that, although I don't quite understand why. Anyway, I think the interface is safe, since the MutChunkIter will only hand out non-overlapping pointers and there is no way to get it to hand out the same pointer twice.
2013-11-30auto merge of #10733 : alexcrichton/rust/ignore-on-windows, r=pcwaltonbors-0/+1
I've seen this fail on windows twice now, and it's not clear to me why it's failing. For now, ignore it on that platform while investigation enuses.
2013-11-30auto merge of #10738 : sfackler/rust/buffered-fixes, r=alexcrichtonbors-10/+28
BufferedWriter::inner flushes before returning the underlying writer. BufferedWriter::write no longer flushes the underlying writer. LineBufferedWriter::write flushes up to the *last* newline in the input string, not the first.
2013-11-30Implement DoubleEndedIterator for MutChunkIter.Palmer Cox-0/+29
2013-11-30Implement mut_chunks() method for MutableVector trait.Palmer Cox-0/+73
mut_chunks() returns an iterator that produces mutable slices. This is the mutable version of the existing chunks() method on the ImmutableVector trait.
2013-11-30auto merge of #10528 : alexcrichton/rust/static-linking-v2, r=pcwaltonbors-10/+59
In this series of commits, I've implemented static linking for rust. The scheme I implemented was the same as my [mailing list post](https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html). The commits have more details to the nitty gritty of what went on. I've rebased this on top of my native mutex pull request (#10479), but I imagine that it will land before this lands, I just wanted to pre-emptively get all the rebase conflicts out of the way (becuase this is reorganizing building librustrt as well). Some contentious points I want to make sure are all good: * I've added more "compiler chooses a default" behavior than I would like, I want to make sure that this is all very clearly outlined in the code, and if not I would like to remove behavior or make it clearer. * I want to make sure that the new "fancy suite" tests are ok (using make/python instead of another rust crate) If we do indeed pursue this, I would be more than willing to write up a document describing how linking in rust works. I believe that this behavior should be very understandable, and the compiler should never hinder someone just because linking is a little fuzzy.
2013-11-30Test fixes and merge conflictsAlex Crichton-0/+1
2013-11-30auto merge of #10737 : huonw/rust/with-cap, r=alexcrichtonbors-1/+7
This allows one to reduce the number of reallocs of the internal buffer if one has an approximate idea of the size of the final output.
2013-11-30Fixes for BufferedWriter and LineBufferedWriterSteven Fackler-10/+28
BufferedWriter::inner flushes before returning the underlying writer. BufferedWriter::write no longer flushes the underlying writer. LineBufferedWriter::write flushes up to the *last* newline in the input string, not the first.
2013-12-01std::io::mem: add a with_capacity constructor to MemWriter.Huon Wilson-1/+7
This allows one to reduce the number of reallocs of the internal buffer if one has an approximate idea of the size of the final output.
2013-11-30Wrap the return value of the type_id intrinsic in an opaque boxCorey Richardson-24/+32
Closes #10594
2013-11-29Ignore a deque test on windowsAlex Crichton-0/+1
I've seen this fail on windows twice now, and it's not clear to me why it's failing. For now, ignore it on that platform while investigation enuses.
2013-11-29Statically link librustrt to libstdAlex Crichton-1/+7
This commit alters the build process of the compiler to build a static librustrt.a instead of a dynamic version. This means that we can stop distributing librustrt as well as default linking against it in the compiler. This also means that if you attempt to build rust code without libstd, it will no longer work if there are any landing pads in play. The reason for this is that LLVM and rustc will emit calls to the various upcalls in librustrt used to manage exception handling. In theory we could split librustrt into librustrt and librustupcall. We would then distribute librustupcall and link to it for all programs using landing pads, but I would rather see just one librustrt artifact and simplify the build process. The major benefit of doing this is that building a static rust library for use in embedded situations all of a sudden just became a whole lot more feasible. Closes #3361
2013-11-29Add generation of static libraries to rustcAlex Crichton-10/+52
This commit implements the support necessary for generating both intermediate and result static rust libraries. This is an implementation of my thoughts in https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html. When compiling a library, we still retain the "lib" option, although now there are "rlib", "staticlib", and "dylib" as options for crate_type (and these are stackable). The idea of "lib" is to generate the "compiler default" instead of having too choose (although all are interchangeable). For now I have left the "complier default" to be a dynamic library for size reasons. Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a dynamic object. I chose this for size reasons, but also because you're probably not going to be embedding the rustc compiler anywhere any time soon. Other than the options outlined above, there are a few defaults/preferences that are now opinionated in the compiler: * If both a .dylib and .rlib are found for a rust library, the compiler will prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option * If generating a "lib", the compiler will generate a dynamic library. This is overridable by explicitly saying what flavor you'd like (rlib, staticlib, dylib). * If no options are passed to the command line, and no crate_type is found in the destination crate, then an executable is generated With this change, you can successfully build a rust program with 0 dynamic dependencies on rust libraries. There is still a dynamic dependency on librustrt, but I plan on removing that in a subsequent commit. This change includes no tests just yet. Our current testing infrastructure/harnesses aren't very amenable to doing flavorful things with linking, so I'm planning on adding a new mode of testing which I believe belongs as a separate commit. Closes #552
2013-11-29auto merge of #10719 : Kimundi/rust/switch_to_multi_item_macros, r=alexcrichtonbors-243/+232
- Removed module reexport workaround for the integer module macros - Removed legacy reexports of `cmp::{min, max}` in the integer module macros - Combined a few macros in `vec` into one - Documented a few issues
2013-11-29Implement a lock-free work-stealing dequeAlex Crichton-135/+716
This adds an implementation of the Chase-Lev work-stealing deque to libstd under std::rt::deque. I've been unable to break the implementation of the deque itself, and it's not super highly optimized just yet (everything uses a SeqCst memory ordering). The major snag in implementing the chase-lev deque is that the buffers used to store data internally cannot get deallocated back to the OS. In the meantime, a shared buffer pool (synchronized by a normal mutex) is used to deallocate/allocate buffers from. This is done in hope of not overcommitting too much memory. It is in theory possible to eventually free the buffers, but one must be very careful in doing so. I was unable to get some good numbers from src/test/bench tests (I don't think many of them are slamming the work queue that much), but I was able to get some good numbers from one of my own tests. In a recent rewrite of select::select(), I found that my implementation was incredibly slow due to contention on the shared work queue. Upon switching to the parallel deque, I saw the contention drop to 0 and the runtime go from 1.6s to 0.9s with the most amount of time spent in libuv awakening the schedulers (plus allocations). Closes #4877
2013-11-29Removed module macro workaround for signed and unsigned integersMarvin Löbel-57/+93
2013-11-29Removed useless cmp::{min, max} reexports from the integer modulesMarvin Löbel-7/+2
2013-11-29libstd: Change `Path::new` to `Path::init`.Patrick Walton-412/+413
2013-11-29Removed a few macro-expanding-to-module workaroundsMarvin Löbel-185/+143
Also documented a few issues
2013-11-28Fix initial debug statements printing twiceAlex Crichton-5/+7
It may mislead you into thinking tasks are spawning twice, when in fact they are not.
2013-11-28Register new snapshotsAlex Crichton-60/+56
2013-11-28auto merge of #10519 : ↵bors-0/+194
nikomatsakis/rust/issue-8624-borrowck-overly-permissive, r=pnkfelix See #8624 for details. r? @pnkfelix
2013-11-27auto merge of #10691 : g3xzh/rust/benchm, r=cmrbors-0/+86
I have written some benchmark tests to `push`, `push_many`, `join`, `join_many` and `ends_with_path`. Let me know what you think (@cmr). Thanks in advance.
2013-11-27auto merge of #10687 : alexcrichton/rust/issue-10686, r=thestingerbors-248/+227
Turns out android doesn't support LLVM's thread_local attribute and accompanying implementation. Closes #10686
2013-11-27Fix handling of upper/lowercase, and whitespaceFlorian Zeitz-10/+670
2013-11-27Update Unicode data to version 6.3Florian Zeitz-600/+605
2013-11-27Use the native tls implementation on androidAlex Crichton-248/+227
Turns out android doesn't support LLVM's thread_local attribute and accompanying implementation. Closes #10686
2013-11-27auto merge of #10685 : ebiggers/rust/ascii_fixes, r=alexcrichtonbors-2/+11
is_digit() incorrectly returned false for '0'. is_control() incorrectly returned true for ' ' (space).
2013-11-27auto merge of #10662 : alexcrichton/rust/thread-detach, r=pcwaltonbors-75/+208
This has one commit from a separate pull request (because these commits depend on that one), but otherwise the extra details can be found in the commit messages. The `rt::thread` module has been generally cleaned up for everyday safe usage (and it's a bug if it's not safe).
2013-11-27Improve the rt::thread moduleAlex Crichton-62/+154
* Added doc comments explaining what all public functionality does. * Added the ability to spawn a detached thread * Added the ability for the procs to return a value in 'join'
2013-11-27std::ascii: Add tests for is_digit() and is_control()Eric Biggers-0/+9
2013-11-27auto merge of #10688 : bjz/rust/recv_iter, r=brsonbors-3/+84
I've noticed I use this pattern quite a bit: ~~~rust do spawn { loop { match port.try_recv() { Some(x) => ..., None => ..., } } } ~~~ The `RecvIterator`, returned from a default `recv_iter` method on the `GenericPort` trait, allows you to reduce this down to: ~~~rust do spawn { for x in port.recv_iter() { ... } } ~~~ As demonstrated in the tests, you can also access the port from within the `for` block for further `recv`ing and `peek`ing with no borrow errors, which is quite nice.
2013-11-27Add benchmark tests to path/posixg3xzh-0/+86
I have written some benchmark tests to `push`, `push_many`, `join`, `join_many` and `ends_with_path`.
2013-11-26Clean up statically initialized data on shutdownAlex Crichton-14/+55
Whenever the runtime is shut down, add a few hooks to clean up some of the statically initialized data of the runtime. Note that this is an unsafe operation because there's no guarantee on behalf of the runtime that there's no other code running which is using the runtime. This helps turn down the noise a bit in the valgrind output related to statically initialized mutexes. It doesn't turn the noise down to 0 because there are still statically initialized mutexes in dynamic_lib and os::with_env_lock, but I believe that it would be easy enough to add exceptions for those cases and I don't think that it's the runtime's job to go and clean up that data.
2013-11-27Add an iterator for receiving messages from GenericPortsBrendan Zabarauskas-3/+84
2013-11-26auto merge of #10679 : alexcrichton/rust/no-routine, r=pcwaltonbors-29/+0
2013-11-26std::ascii: Fix is_digit() and is_control()Eric Biggers-2/+2
is_digit() incorrectly returned false for '0'. is_control() incorrectly returned true for ' ' (space).
2013-11-26Remove unused std::routineAlex Crichton-29/+0
2013-11-26auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchtonbors-5/+105
This provides a building block for fast thread-local storage. It does not change the safety semantics of `static mut`. Closes #10310
2013-11-26port the runtime to `#[thread_local]`Daniel Micay-5/+105
2013-11-26librustc: Fix merge fallout.Patrick Walton-32/+10
2013-11-26libstd: Fix Win32 and other bustage.Patrick Walton-39/+41
2013-11-26librustc: Make `||` lambdas not infer to `proc`sPatrick Walton-38/+46