summary refs log tree commit diff
path: root/src/libstd/rt
AgeCommit message (Collapse)AuthorLines
2014-12-31Revert "std: Re-enable at_exit()"Alex Crichton-23/+23
This reverts commit 9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7. Conflicts: src/libstd/sys/windows/os.rs
2014-12-30rollup merge of #20061: aturon/stab-2-vec-sliceAlex Crichton-2/+2
Conflicts: src/libcollections/slice.rs src/libcollections/vec.rs src/libstd/sys/windows/os.rs
2014-12-30Fallout from stabilizationAaron Turon-2/+2
2014-12-30rollup merge of #20353: alexcrichton/snapshotsAlex Crichton-80/+1
2014-12-30Register new snapshotsAlex Crichton-80/+1
2014-12-30std: Re-enable at_exit()Alex Crichton-23/+23
The new semantics of this function are that the callbacks are run when the *main thread* exits, not when all threads have exited. This implies that other threads may still be running when the `at_exit` callbacks are invoked and users need to be prepared for this situation. Users in the standard library have been audited in accordance to these new rules as well. Closes #20012
2014-12-29Test fixes and rebase conflictsAlex Crichton-3/+3
2014-12-29rollup merge of #20248: steveklabnik/gh20038Alex Crichton-79/+79
A part of #20038 This is just the beginning of what needs to be done, but it's some of it. /cc @aturon
2014-12-30Fallout from mut slicesNick Cameron-1/+1
2014-12-27Fallout of changing format_args!(f, args) to f(format_args!(args)).Eduard Burtescu-2/+80
2014-12-26s/task/thread/gSteve Klabnik-79/+79
A part of #20038
2014-12-26Make Send and Sync traits unsafeFlavio Percoco-2/+2
2014-12-26Require types to opt-in SyncFlavio Percoco-0/+4
2014-12-21Fallout of std::str stabilizationAlex Crichton-15/+15
2014-12-21std: Don't parse argv as a StringAlex Crichton-5/+8
Instead, just pass everything through as a Vec<u8> to get worried about later. Closes #20091
2014-12-20Fix the fallout of removing feature(import_shadowing).Eduard Burtescu-2/+1
2014-12-19windows: remove unused importJorge Aparicio-1/+0
2014-12-19librustrt: use `#[deriving(Copy)]`Jorge Aparicio-2/+1
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-1/+1
2014-12-18std: Move the panic flag to its own thread localAlex Crichton-4/+15
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-26/+36
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-710/+6
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-20/+8
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-7/+7
2014-12-18Fallout from new thread APIAaron Turon-56/+33
2014-12-18Revise rt::unwindAaron Turon-40/+6
2014-12-18Remove rt::{mutex, exclusive}Aaron Turon-10/+5
2014-12-18Remove rt::{local, local_data, thread_local_storage}Aaron Turon-524/+176
2014-12-18Introduce std::threadAaron Turon-191/+15
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-70/+0
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-20/+23
2014-12-18Allow args to work without rt initializationAaron Turon-13/+9
2014-12-18libs: merge librustrt into libstdAaron Turon-993/+3227
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-18auto merge of #19984 : japaric/rust/macro-expressions, r=alexcrichtonbors-6/+9
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-6/+9
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-16Fix typoVadim Chugunov-1/+1
2014-12-14std: Collapse SlicePrelude traitsAlex Crichton-11/+4
This commit collapses the various prelude traits for slices into just one trait: * SlicePrelude/SliceAllocPrelude => SliceExt * CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt * OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt * PartialEqSlicePrelude => PartialEqSliceExt
2014-12-14Rewrite threading infrastructure, introducing `Thunk` to representNiko Matsakis-4/+5
boxed `FnOnce` closures.
2014-12-13Windows dbghelp strips leading underscores from symbols, so let's accept ↵Vadim Chugunov-8/+25
"ZN...E" form too. Also, print PC displacement from symbols.
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-1/+1
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-06libstd: remove unnecessary `to_string()` callsJorge Aparicio-1/+1
2014-12-05Utilize fewer reexportsCorey Farwell-7/+9
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05Fall out of the std::sync rewriteAlex Crichton-8/+8
2014-11-27Fixed iOS build after Iter stabValerii Hiora-1/+1
2014-11-26rollup merge of #19329: steveklabnik/doc_style_cleanup2Alex Crichton-40/+32
2014-11-26/*! -> //!Steve Klabnik-40/+32
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.