about summary refs log tree commit diff
path: root/src/libstd/rt
AgeCommit message (Collapse)AuthorLines
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.
2014-11-26rollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plusAlex Crichton-1/+1
Implements RFC 438. Fixes #19092. This is a [breaking-change]: change types like `&Foo+Send` or `&'a mut Foo+'a` to `&(Foo+Send)` and `&'a mut (Foo+'a)`, respectively. r? @brson
2014-11-26auto merge of #19176 : aturon/rust/stab-iter, r=alexcrichtonbors-2/+2
This is an initial pass at stabilizing the `iter` module. The module is fairly large, but is also pretty polished, so most of the stabilization leaves things as they are. Some changes: * Due to the new object safety rules, various traits needs to be split into object-safe traits and extension traits. This includes `Iterator` itself. While splitting up the traits adds some complexity, it will also increase flexbility: once we have automatic impls of `Trait` for trait objects over `Trait`, then things like the iterator adapters will all work with trait objects. * Iterator adapters that use up the entire iterator now take it by value, which makes the semantics more clear and helps catch bugs. Due to the splitting of Iterator, this does not affect trait objects. If the underlying iterator is still desired for some reason, `by_ref` can be used. (Note: this change had no fallout in the Rust distro except for the useless mut lint.) * In general, extension traits new and old are following an [in-progress convention](rust-lang/rfcs#445). As such, they are marked `unstable`. * As usual, anything involving closures is `unstable` pending unboxed closures. * A few of the more esoteric/underdeveloped iterator forms (like `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with various unfolds) are left experimental for now. * The `order` submodule is left `experimental` because it will hopefully be replaced by generalized comparison traits. * "Leaf" iterators (like `Repeat` and `Counter`) are uniformly constructed by free fns at the module level. That's because the types are not otherwise of any significance (if we had `impl Trait`, you wouldn't want to define a type at all). Closes #17701 Due to renamings and splitting of traits, this is a: [breaking-change]
2014-11-26Fixup various places that were doing `&T+'a` and do `&(T+'a)`Niko Matsakis-1/+1
2014-11-25Fallout from stabilizationAaron Turon-2/+2
2014-11-25Deprecate MaybeOwned[Vector] in favor of CowJorge Aparicio-2/+2
2014-11-21unicode: Rename UnicodeChar::is_digit to is_numericBrian Anderson-2/+2
'Numeric' is the proper name of the unicode character class, and this frees up the word 'digit' for ascii use in libcore. Since I'm going to rename `Char::is_digit_radix` to `is_digit`, I am not leaving a deprecated method in place, because that would just cause name clashes, as both `Char` and `UnicodeChar` are in the prelude. [breaking-change]
2014-11-20Make most of std::rt privateAaron Turon-10/+8
Previously, the entire runtime API surface was publicly exposed, but that is neither necessary nor desirable. This commit hides most of the module, using librustrt directly as needed. The arrangement will need to be revisited when rustrt is pulled into std. [breaking-change]