about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-12-19load_self() needs to be publicMichael Neumann-1/+1
2014-12-19hashset: Clean up and rename the HashSet iteratorsbluss-46/+83
This removes the type SetAlgebraItems and replaces it with the structs Intersection and Difference. Rename the existing HashSet iterators according to RFC #344: * SetItems -> Iter * SetMoveItems -> IntoIter * Remaining set combination iterators renamed to Union and SymmetricDifference [breaking-change]
2014-12-19Register new snapshotsAlex Crichton-108/+0
This does not yet start the movement to rustc-serialize. That detail is left to a future PR.
2014-12-19windows: remove unused importJorge Aparicio-1/+0
2014-12-19libstd: use `#[deriving(Copy)]`Jorge Aparicio-81/+30
2014-12-19librustrt: use `#[deriving(Copy)]`Jorge Aparicio-2/+1
2014-12-19iOS: fallout of runtime removalValerii Hiora-2/+2
2014-12-19Several fixes for DragonFly (rebase)Michael Neumann-1/+11
2014-12-19auto merge of #19654 : aturon/rust/merge-rt, r=alexcrichtonbors-2710/+6758
This PR substantially narrows the notion of a "runtime" in Rust, and allows calling into Rust code directly without any setup or teardown. After this PR, the basic "runtime support" in Rust will consist of: * Unwinding and backtrace support * Stack guards Other support, such as helper threads for timers or the notion of a "current thread" are initialized automatically upon first use. When using Rust in an embedded context, it should now be possible to call a Rust function directly as a C function with absolutely no setup, though in that case panics will cause the process to abort. In this regard, the C/Rust interface will look much like the C/C++ interface. In more detail, this PR: * Merges `librustrt` back into `std::rt`, undoing the facade. While doing so, it removes a substantial amount of redundant functionality (such as mutexes defined in the `rt` module). Code using `librustrt` can now call into `std::rt` to e.g. start executing Rust code with unwinding support. * Allows all runtime data to be initialized lazily, including the "current thread", the "at_exit" infrastructure, and the "args" storage. * Deprecates and largely removes `std::task` along with the widespread requirement that there be a "current task" for many APIs in `std`. The entire task infrastructure is replaced with `std::thread`, which provides a more standard API for manipulating and creating native OS threads. In particular, it's possible to join on a created thread, and to get a handle to the currently-running thread. In addition, threads are equipped with some basic blocking support in the form of `park`/`unpark` operations (following a tradition in some OSes as well as the JVM). See the `std::thread` documentation for more details. * Channels are refactored to use a new internal blocking infrastructure that itself sits on top of `park`/`unpark`. One important change here is that a Rust program ends when its main thread does, following most threading models. On the other hand, threads will often be created with an RAII-style join handle that will re-institute blocking semantics naturally (and with finer control). This is very much a: [breaking-change] Closes #18000 r? @alexcrichton
2014-12-18Disable at_exit handlersAaron Turon-1/+4
The [final step](https://github.com/rust-lang/rust/pull/19654) of runtime removal changes the threading/process model so that the process shuts down when the main thread exits. But several shared resources, like the helper thread for timeouts, are shut down when the main thread exits (but before the process ends), and they are not prepared to be used after shut down, but other threads may try to access them during the shutdown sequence of the main thread. As an interim solution, the `at_exit` cleanup routine is simply skipped. Ultimately, these resources should be made to safely handle asynchronous shutdown, usually by panicking if called from a detached thread when the main thread is ending. See issue for details https://github.com/rust-lang/rust/issues/20012 This is a [breaking-change] for anyone relying on `at_exit`.
2014-12-18Rebasing fixes.Aaron Turon-14/+22
2014-12-18Delete rest of rustrtAaron Turon-1/+2
... and address other rebasing fallout.
2014-12-18std: Move the panic flag to its own thread localAlex Crichton-27/+21
This flag is somewhat tied to the `unwind` module rather than the `thread_info` module, so this commit moves it into that module as well as allowing the same OS thread to call `unwind::try` multiple times. Previously once a thread panicked its panic flag was never reset, even after exiting the panic handler.
2014-12-18std: Lower abstractions for thread_local/at_exitAlex Crichton-46/+78
The current implementations use `std::sync` primitives, but these primitives currently end up relying on `thread_info` and a local `Thread` being available (mainly for checking the panicking flag). To get around this, this commit lowers the abstractions used by the windows thread_local implementation as well as the at_exit_imp module. Both of these modules now use a `sys::Mutex` and a `static mut` and manage the allocation/locking manually.
2014-12-18Revise std::thread API to join by defaultAaron Turon-1008/+320
This commit is part of a series that introduces a `std::thread` API to replace `std::task`. In the new API, `spawn` returns a `JoinGuard`, which by default will join the spawned thread when dropped. It can also be used to join explicitly at any time, returning the thread's result. Alternatively, the spawned thread can be explicitly detached (so no join takes place). As part of this change, Rust processes now terminate when the main thread exits, even if other detached threads are still running, moving Rust closer to standard threading models. This new behavior may break code that was relying on the previously implicit join-all. In addition to the above, the new thread API also offers some built-in support for building blocking abstractions in user space; see the module doc for details. Closes #18000 [breaking-change]
2014-12-18Update doc comment for std::rtAaron Turon-31/+6
2014-12-18Avoid .take().unwrap() with FnOnce closuresAlex Crichton-39/+27
2014-12-18Tweak the startup routine to pass on linuxAlex Crichton-68/+65
We need to be sure to init thread_info before we init args for example because args is grabbing locks which may entail looking at the local thread eventually.
2014-12-18Fix compilation on linuxAlex Crichton-9/+8
2014-12-18Fix the capture_stderr testAlex Crichton-4/+3
There's always a fun time having two sets of standard libraries when testing!
2014-12-18Disable capture_stderr test for nowAaron Turon-1/+1
2014-12-18Fallout from new thread APIAaron Turon-402/+277
2014-12-18Revise rt::unwindAaron Turon-46/+30
2014-12-18Remove rt::{mutex, exclusive}Aaron Turon-66/+73
2014-12-18Add blocking support module for channelsAaron Turon-308/+357
2014-12-18Remove rt::{local, local_data, thread_local_storage}Aaron Turon-524/+176
2014-12-18Introduce std::threadAaron Turon-720/+742
Also removes: * `std::task` * `std::rt::task` * `std::rt::thread` Notes for the new API are in a follow-up commit. Closes #18000
2014-12-18Remove rt::bookkeepingAaron Turon-72/+1
This commit removes the runtime bookkeeping previously used to ensure that all Rust tasks were joined before the runtime was shut down. This functionality will be replaced by an RAII style `Thread` API, that will also offer a detached mode. Since this changes the semantics of shutdown, it is a: [breaking-change]
2014-12-18Make at_exit initialize lazilyAaron Turon-21/+23
2014-12-18Allow args to work without rt initializationAaron Turon-18/+10
2014-12-18Refactor std::os to use sys::osAaron Turon-387/+352
2014-12-18libs: merge librustrt into libstdAaron Turon-1043/+6306
This commit merges the `rustrt` crate into `std`, undoing part of the facade. This merger continues the paring down of the runtime system. Code relying on the public API of `rustrt` will break; some of this API is now available through `std::rt`, but is likely to change and/or be removed very soon. [breaking-change]
2014-12-19auto merge of #19899 : japaric/rust/unops-by-value, r=nikomatsakisbors-0/+25
- The following operator traits now take their argument by value: `Neg`, `Not`. This breaks all existing implementations of these traits. - The unary operation `OP a` now "desugars" to `OpTrait::op_method(a)` and consumes its argument. [breaking-change] --- r? @nikomatsakis This PR is very similar to the binops-by-value PR cc @aturon
2014-12-18[collections] Adds `drain`: a way to sneak out the elements while clearing.Clark Gaebel-10/+157
It is useful to move all the elements out of some collections without deallocating the underlying buffer. It came up in IRC, and this patch implements it as `drain`. This has been discussed as part of RFC 509. r? @Gankro cc: @frankmcsherry
2014-12-18std: Remove public bool,tuple,unit modulesAlex Crichton-8/+135
This commit modifies rustdoc to not require these empty modules to be public in the standard library. The modules still remain as a location to attach documentation to, but the modules themselves are now private (don't have to commit to an API). The documentation for the standard library now shows all of the primitive types on the main index page.
2014-12-18remove TreeMap, TreeSet, TrieMap, TrieSet, LruCache. deprecate EnumSet's std ↵Alexis Beingessner-497/+13
re-export
2014-12-18libstd: convert `Duration` unops to by valueJorge Aparicio-0/+14
2014-12-18libstd: convert `BitFlags` unops to by valueJorge Aparicio-0/+11
2014-12-18auto merge of #19984 : japaric/rust/macro-expressions, r=alexcrichtonbors-463/+472
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change] --- Rebased version of #18958 r? @alexcrichton cc @pcwalton
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-463/+472
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-18auto merge of #19819 : vadimcn/rust/fix-demangle, r=alexcrichtonbors-8/+25
Windows dbghelp strips leading underscores from symbols, and I could not find a way to turn this off. So let's accept "ZN...E" form too. Also, print PC displacement from symbols. This is helpful in gauging whether the PC was indeed within the function displayed in the backtrace, or whether it just happened to be the closest public symbol in the module.
2014-12-18iOS: fallout of `marker::NoCopy` removalValerii Hiora-1/+0
2014-12-17rollup merge of #19935: cgaebel/hashmap-tuple-indexingAlex Crichton-88/+41
r? @Gankro @pczarn
2014-12-17rollup merge of #19902: alexcrichton/second-pass-memAlex Crichton-0/+8
This commit stabilizes the `mem` and `default` modules of std.
2014-12-17rollup merge of #19873: drewm1980/masterAlex Crichton-11/+11
In US english, "that" is used in restrictive clauses in place of "which", and often affects the meaning of sentences. In UK english and many dialects, no distinction is made. While Rust devs want to avoid unproductive pedanticism, it is worth at least being uniform in documentation such as: http://doc.rust-lang.org/std/iter/index.html and also in cases where correct usage of US english clarifies the sentence.
2014-12-17rollup merge of #19869: sfackler/free-stdinAlex Crichton-0/+7
r? @aturon
2014-12-17rollup merge of #19868: sourcefrog/masterAlex Crichton-3/+6
The rendered form in http://doc.rust-lang.org/nightly/std/rand/struct.OsRng.html looks wrong.
2014-12-17rollup merge of #19859: alexcrichton/flaky-testAlex Crichton-1/+2
This test would read with a timeout and then send a UDP message, expecting the message to be received. The receiving port, however, was bound in the child thread so it could be the case that the timeout and send happens before the child thread runs. To remedy this we just bind the port before the child thread runs, moving it into the child later on. cc #19120
2014-12-17rollup merge of #19832: japaric/no-nocopyAlex Crichton-14/+6
r? @aturon / @alexcrichton
2014-12-17rollup merge of #19770: csouth3/iterator-wrapperstructsAlex Crichton-57/+89
Using a type alias for iterator implementations is fragile since this exposes the implementation to users of the iterator, and any changes could break existing code. This PR changes the iterators of `BTreeMap`, `BTreeSet`, `HashMap`, and `HashSet` to use proper new types, rather than type aliases. However, since it is fair-game to treat a type-alias as the aliased type, this is a: [breaking-change].