summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
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
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-315/+337
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-895/+722
2013-11-26librustc: Remove remaining uses of `&fn()` in favor of `||`.Patrick Walton-42/+44
2013-11-26auto merge of #10660 : alexcrichton/rust/little-scope, r=pcwaltonbors-71/+71
This moves the locking/waiting methods to returning an RAII struct instead of relying on closures. Additionally, this changes the methods to all take '&mut self' to discourage recursive locking. The new method to block is to call `wait` on the returned RAII structure instead of calling it on the lock itself (this enforces that the lock is held). At the same time, this improves the Mutex interface a bit by allowing destruction of non-initialized members and by allowing construction of an empty mutex (nothing initialized inside).
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-337/+342
2013-11-25auto merge of #10631 : klutzy/rust/win-fixes, r=alexcrichtonbors-185/+53
This patchset fixes some parts broken on Win64. This also adds `--disable-pthreads` flags to llvm on mingw-w64 archs (both 32-bit and 64-bit, not mingw) due to bad performance. See #8996 for discussion.
2013-11-26std: Remove unused attributesklutzy-4/+2
This also enables two tests properly.
2013-11-26rustc: Add lint for obsolete attributesklutzy-1/+0
This also moves `#[auto_{en,de}code]` checker from syntax to lint.
2013-11-25Move LittleLock to using RAIIAlex Crichton-71/+71
This moves the locking/waiting methods to returning an RAII struct instead of relying on closures. Additionally, this changes the methods to all take '&mut self' to discourage recursive locking. The new method to block is to call `wait` on the returned RAII structure instead of calling it on the lock itself (this enforces that the lock is held). At the same time, this improves the Mutex interface a bit by allowing destruction of non-initialized members and by allowing construction of an empty mutex (nothing initialized inside).
2013-11-25auto merge of #10650 : andreasots/rust/ipv6-is-in-hex, r=alexcrichtonbors-1/+2
Without this the assert in <tt>rust_malloc_ip6_addr</tt> is triggered as it expects a correctly formatted IPv6 address.
2013-11-25auto merge of #10658 : LeoTestard/rust/serialize-rc, r=cmrbors-0/+8
Implement various traits (IterBytes and extra's Encodable and Decodable) for Rc<T> when T alreay implements the trait.
2013-11-25Implement IterBytes for Rc<T>.Léo Testard-0/+8
2013-11-25rm #[mutable_doc]Daniel Micay-2/+0
2013-11-25Add [mut_]shift_ref/[mut_]pop_ref functions, which return a pointer to the ↵Niko Matsakis-0/+194
first/last item in the slice and modify the slice to exclude the returned item. Useful when writing iterators over mutable references.
2013-11-25auto merge of #10643 : jorendorff/rust/master, r=alexcrichtonbors-1/+1
2013-11-24auto merge of #10635 : alexcrichton/rust/issue-10626, r=cmrbors-1/+5
This is both useful for performance (otherwise logging is unbuffered), but also useful for correctness. Because when a task is destroyed we can't block the task waiting for the logger to close, loggers are opened with a 'CloseAsynchronously' specification. This causes libuv do defer the call to close() until the next turn of the event loop. If you spin in a tight loop around printing, you never yield control back to the libuv event loop, meaning that you simply enqueue a large number of close requests but nothing is actually closed. This queue ends up never getting closed, meaning that if you keep trying to create handles one will eventually fail, which the runtime will attempt to print the failure, causing mass destruction. Caching will provide better performance as well as prevent creation of too many handles. Closes #10626
2013-11-25std: IPv6 addresses are represented as eight groups of four HEXADECIMAL digitsAndreas Ots-1/+2
2013-11-24auto merge of #10603 : alexcrichton/rust/no-linked-failure, r=brsonbors-2088/+145
The reasons for doing this are: * The model on which linked failure is based is inherently complex * The implementation is also very complex, and there are few remaining who fully understand the implementation * There are existing race conditions in the core context switching function of the scheduler, and possibly others. * It's unclear whether this model of linked failure maps well to a 1:1 threading model Linked failure is often a desired aspect of tasks, but we would like to take a much more conservative approach in re-implementing linked failure if at all. Closes #8674 Closes #8318 Closes #8863
2013-11-24Cache a task's stderr loggerAlex Crichton-1/+5
This is both useful for performance (otherwise logging is unbuffered), but also useful for correctness. Because when a task is destroyed we can't block the task waiting for the logger to close, loggers are opened with a 'CloseAsynchronously' specification. This causes libuv do defer the call to close() until the next turn of the event loop. If you spin in a tight loop around printing, you never yield control back to the libuv event loop, meaning that you simply enqueue a large number of close requests but nothing is actually closed. This queue ends up never getting closed, meaning that if you keep trying to create handles one will eventually fail, which the runtime will attempt to print the failure, causing mass destruction. Caching will provide better performance as well as prevent creation of too many handles. Closes #10626
2013-11-24Remove linked failure from the runtimeAlex Crichton-2088/+145
The reasons for doing this are: * The model on which linked failure is based is inherently complex * The implementation is also very complex, and there are few remaining who fully understand the implementation * There are existing race conditions in the core context switching function of the scheduler, and possibly others. * It's unclear whether this model of linked failure maps well to a 1:1 threading model Linked failure is often a desired aspect of tasks, but we would like to take a much more conservative approach in re-implementing linked failure if at all. Closes #8674 Closes #8318 Closes #8863
2013-11-24Fix spelling of "vacuum" in one of the abort quotes.Jason Orendorff-1/+1
2013-11-25std::trie: Fix find_mut for non-present keysJannis Harder-1/+12
Make TrieMap/TrieSet's find_mut check the key for external nodes. Without this find_mut sometimes returns a reference to another key when querying for a non-present key.
2013-11-24Implement cmp traits for Rc<T> and add a ptr_eq method.Léo Testard-0/+55
2013-11-24std::rt: Fix crate_map on Win64klutzy-1/+6
2013-11-24std::rt: Fix record_stack_bounds on win64klutzy-2/+2
2013-11-24std: Fix transmute error on win64klutzy-1/+1
2013-11-24std::libc: Simplify win32/win64 type definitionsklutzy-164/+30
2013-11-24std::libc: Remove TCHAR typesklutzy-20/+17
2013-11-23auto merge of #10514 : sfackler/rust/mut, r=cmrbors-325/+346
This is based off of @blake2-ppc's work on #9429. That PR bitrotted and I haven't been able to contact the original author so I decided to take up the cause. Overview ====== `Mut` encapsulates a mutable, non-nullable slot. The `Cell` type is currently used to do this, but `Cell` is much more commonly used as a workaround for the inability to move values into non-once functions. `Mut` provides a more robust API. `Mut` duplicates the semantics of borrowed pointers with enforcement at runtime instead of compile time. ```rust let x = Mut::new(0); { // make some immutable borrows let p = x.borrow(); let y = *p.get() + 10; // multiple immutable borrows are allowed simultaneously let p2 = x.borrow(); // this would throw a runtime failure // let p_mut = x.borrow_mut(); } // now we can mutably borrow let p = x.borrow_mut(); *p.get() = 10; ``` `borrow` returns a `Ref` type and `borrow_mut` returns a `RefMut` type, both of which are simple smart pointer types with a single method, `get`, which returns a reference to the wrapped data. This also allows `RcMut<T>` to be deleted, as it can be replaced with `Rc<Mut<T>>`. Changes ====== I've done things a little bit differently than the original proposal. * I've added `try_borrow` and `try_borrow_mut` methods that return `Option<Ref<T>>` and `Option<RefMut<T>>` respectively instead of failing on a borrow check failure. I'm not totally sure when that'd be useful, but I don't see any reason to not put them in and @cmr requested them. * `ReadPtr` and `WritePtr` have been renamed to `Ref` and `RefMut` respectively, as `Ref` is to `ref foo` and `RefMut` is to `ref mut foo` as `Mut` is to `mut foo`. * `get` on `MutRef` now takes `&self` instead of `&mut self` for consistency with `&mut`. As @alexcrichton pointed, out this violates soundness by allowing aliasing `&mut` references. * `Cell` is being left as is. It solves a different problem than `Mut` is designed to solve. * There are no longer methods implemented for `Mut<Option<T>>`. Since `Cell` isn't going away, there's less of a need for these, and I didn't feel like they provided a huge benefit, especially as that kind of `impl` is very uncommon in the standard library. Open Questions ============ * `Cell` should now be used exclusively for movement into closures. Should this be enforced by reducing its API to `new` and `take`? It seems like this use case will be completely going away once the transition to `proc` and co. finishes. * Should there be `try_map` and `try_map_mut` methods along with `map` and `map_mut`?
2013-11-23Move mutable::Mut to cell::RefCellSteven Fackler-335/+320
2013-11-22auto merge of #10611 : cmr/rust/ascii_flesh, r=pcwaltonbors-0/+68
These are super boring. I can add tests if really desired, but they'd be long and even more boring than the methods.