summary refs log tree commit diff
path: root/src/libstd/rt
AgeCommit message (Collapse)AuthorLines
2013-11-01Reordered the methods in std::Option and std::ResultMarvin Löbel-1/+1
Cleaned up the source in a few places Renamed `map_move` to `map`, removed other `map` methods Added `as_ref` and `as_mut` adapters to `Result` Added `fmt::Default` impl
2013-10-31Provide a sound method of flushing stdoutAlex Crichton-14/+27
The previous method was unsound because you could very easily create two mutable pointers which alias the same location (not sound behavior). This hides the function which does so and then exports an explicit flush() function (with documentation about how it works).
2013-10-31libstd: Remove mocks.Patrick Walton-181/+131
2013-10-31auto merge of #10180 : alexcrichton/rust/flush-default, r=brsonbors-31/+6
Closes #9126
2013-10-30auto merge of #10120 : Kimundi/rust/remove_sys, r=alexcrichtonbors-24/+57
- `begin_unwind` and `fail!` is now generic over any `T: Any + Send`. - Every value you fail with gets boxed as an `~Any`. - Because of implementation issues, `&'static str` and `~str` are still handled specially behind the scenes. - Changed the big macro source string in libsyntax to a raw string literal, and enabled doc comments there.
2013-10-30Make Writer::flush a no-op default methodAlex Crichton-31/+6
Closes #9126
2013-10-30Prepared `std::sys` for removal, and made `begin_unwind` simplerMarvin Löbel-24/+57
- `begin_unwind` is now generic over any `T: Any + Send`. - Every value you fail with gets boxed as an `~Any`. - Because of implementation details, `&'static str` and `~str` are still handled specially behind the scenes. - Changed the big macro source string in libsyntax to a raw string literal, and enabled doc comments there.
2013-10-30auto merge of #10168 : reedlepee123/rust/priv_fields, r=brsonbors-21/+21
....rs #8180
2013-10-30auto merge of #9613 : jld/rust/enum-discrim-size.r0, r=alexcrichtonbors-0/+1
Allows an enum with a discriminant to use any of the primitive integer types to store it. By default the smallest usable type is chosen, but this can be overridden with an attribute: `#[repr(int)]` etc., or `#[repr(C)]` to match the target's C ABI for the equivalent C enum. Also adds a lint pass for using non-FFI safe enums in extern declarations, checks that specified discriminants can be stored in the specified type if any, and fixes assorted code that was assuming int.
2013-10-30changed all the impl<T> to impl<T: Send> in rt::comm.rs and libstd::comm.rs ↵reedlepee-21/+21
#8180
2013-10-29Register new snapshotsAlex Crichton-6760/+0
2013-10-29auto merge of #10140 : brson/rust/comm, r=alexcrichtonbors-7/+1
Just putting this public trait into the correct module.
2013-10-29auto merge of #10132 : pcwalton/rust/proc, r=pcwaltonbors-7/+9
the feature gate for `once fn` if used with the `~` sigil. r? @brson
2013-10-29librustc: Implement the `proc` type as sugar for `~once fn` and `proc`Patrick Walton-7/+9
notation for closures, and disable the feature gate for `once fn` if used with the `~` sigil.
2013-10-29auto merge of #10058 : alexcrichton/rust/uv-crate, r=brsonbors-41/+87
This is one of the final steps needed to complete #9128. It still needs a little bit of polish before closing that issue, but it's in a pretty much "done" state now. The idea here is that the entire event loop implementation using libuv is now housed in `librustuv` as a completely separate library. This library is then injected (via `extern mod rustv`) into executable builds (similarly to how libstd is injected, tunable via `#[no_uv]`) to bring in the "rust blessed event loop implementation." Codegen-wise, there is a new `event_loop_factory` language item which is tagged on a function with 0 arguments returning `~EventLoop`. This function's symbol is then inserted into the crate map for an executable crate, and if there is no definition of the `event_loop_factory` language item then the value is null. What this means is that embedding rust as a library in another language just got a little harder. Libraries don't have crate maps, which means that there's no way to find the event loop implementation to spin up the runtime. That being said, it's always possible to build the runtime manually. This request also makes more runtime components public which should probably be public anyway. This new public-ness should allow custom scheduler setups everywhere regardless of whether you follow the `rt::start `path.
2013-10-29Add repr attributes in various places that need them.Jed Davis-0/+1
2013-10-29Move rust's uv implementation to its own crateAlex Crichton-18/+72
There are a few reasons that this is a desirable move to take: 1. Proof of concept that a third party event loop is possible 2. Clear separation of responsibility between rt::io and the uv-backend 3. Enforce in the future that the event loop is "pluggable" and replacable Here's a quick summary of the points of this pull request which make this possible: * Two new lang items were introduced: event_loop, and event_loop_factory. The idea of a "factory" is to define a function which can be called with no arguments and will return the new event loop as a trait object. This factory is emitted to the crate map when building an executable. The factory doesn't have to exist, and when it doesn't then an empty slot is in the crate map and a basic event loop with no I/O support is provided to the runtime. * When building an executable, then the rustuv crate will be linked by default (providing a default implementation of the event loop) via a similar method to injecting a dependency on libstd. This is currently the only location where the rustuv crate is ever linked. * There is a new #[no_uv] attribute (implied by #[no_std]) which denies implicitly linking to rustuv by default Closes #5019
2013-10-29auto merge of #10141 : kmcallister/rust/current_stack_segment, r=alexcrichtonbors-1/+4
This was done in 2145de8c and reverted in 0ada7c7f, but Servo needs it. Closes #10065. r? @brson
2013-10-29auto merge of #10135 : alexcrichton/rust/snapshots, r=thestingerbors-110/+83
Plus some migration from `let mut this = self` to `mut self` (yay!)
2013-10-28auto merge of #10127 : thestinger/rust/cold, r=pcwaltonbors-0/+1
This allows a function to marked as infrequently called, resulting in any branch calling it to be considered colder.
2013-10-28rt::task: Make current_stack_segment public againKeegan McAllister-1/+4
This was done in 2145de8c and reverted in 0ada7c7f, but Servo needs it. Closes #10065.
2013-10-28std: Move the SendDeferred trait to std::commBrian Anderson-7/+1
2013-10-28auto merge of #10133 : alexcrichton/rust/another-error, r=thestingerbors-1/+2
This cropped up on the bsd bot, and if it's an error that gets thrown then it's fine to just whitelist another type of error in the test.
2013-10-28Register new snapshotsAlex Crichton-110/+83
2013-10-28Make some more rt components publicAlex Crichton-23/+15
Primarily this makes the Scheduler and all of its related interfaces public. The reason for doing this is that currently any extern event loops had no access to the scheduler at all. This allows third-party event loops to manipulate the scheduler, along with allowing the uv event loop to live inside of its own crate.
2013-10-28add support for the `cold` function attributeDaniel Micay-0/+1
This allows a function to marked as infrequently called, resulting in any branch calling it to be considered colder.
2013-10-28Handle another possible error in a unix pipe testAlex Crichton-1/+2
This cropped up on the bsd bot, and if it's an error that gets thrown then it's fine to just whitelist another type of error in the test.
2013-10-28Remove the extension traits for Readers/WritersAlex Crichton-606/+487
These methods are all excellent candidates for default methods, so there's no need to require extra imports of various traits.
2013-10-28auto merge of #10094 : alexcrichton/rust/issue-8704, r=pcwaltonbors-65/+248
This drops more of the old C++ runtime to rather be written in rust. A few features were lost along the way, but hopefully not too many. The main loss is that there are no longer backtraces associated with allocations (rust doesn't have a way of acquiring those just yet). Other than that though, I believe that the rest of the debugging utilities made their way over into rust. Closes #8704
2013-10-28auto merge of #10093 : alexcrichton/rust/issue-8811, r=pcwaltonbors-6/+15
Closes #8811
2013-10-28auto merge of #10083 : alexcrichton/rust/timer-port, r=pcwaltonbors-6/+170
In addition to being able to sleep the current task, timers should be able to create ports which get notified after a period of time. Closes #10014
2013-10-28Allow fail messages to be caught, and introduce the Any traitMarvin Löbel-100/+192
Some code cleanup, sorting of import blocks Removed std::unstable::UnsafeArc's use of Either Added run-fail tests for the new FailWithCause impls Changed future_result and try to return Result<(), ~Any>. - Internally, there is an enum of possible fail messages passend around. - In case of linked failure or a string message, the ~Any gets lazyly allocated in future_results recv method. - For that, future result now returns a wrapper around a Port. - Moved and renamed task::TaskResult into rt::task::UnwindResult and made it an internal enum. - Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
2013-10-27auto merge of #10080 : brson/rust/sched_queue, r=brsonbors-105/+444
Rebase and update of #9710
2013-10-27Ignore a test which never completes on windowsAlex Crichton-0/+1
I'm not entirely sure why this is happening, but the server task is never seeing the second send of the client task, and this test will very reliably fail to complete on windows.
2013-10-26Fix a typo in a rt::io::signal testAlex Crichton-1/+1
It was pretty much a miracle that these tests were ever passing. They would never have passed in the single threaded case because only one sigint in the tests is ever generated, but when run in parallel two sigints will be generated.
2013-10-26Implement another error code found on windows.Alex Crichton-6/+15
Closes #8811
2013-10-26Rewrite boxed_region/memory_region in RustAlex Crichton-65/+248
This drops more of the old C++ runtime to rather be written in rust. A few features were lost along the way, but hopefully not too many. The main loss is that there are no longer backtraces associated with allocations (rust doesn't have a way of acquiring those just yet). Other than that though, I believe that the rest of the debugging utilities made their way over into rust. Closes #8704
2013-10-26auto merge of #10070 : alexcrichton/rust/fewer-missiles, r=brsonbors-36/+49
This optimizes the `home_for_io` code path by requiring fewer scheduler operations in some situtations. When moving to your home scheduler, this no longer forces a context switch if you're already on the home scheduler. Instead, the homing code now simply pins you to your current scheduler (making it so you can't be stolen away). If you're not on your home scheduler, then we context switch away, sending you to your home scheduler. When the I/O operation is done, then we also no longer forcibly trigger a context switch. Instead, the action is cased on whether the task is homed or not. If a task does not have a home, then the task is re-flagged as not having a home and no context switch is performed. If a task is homed to the current scheduler, then we don't do anything, and if the task is homed to a foreign scheduler, then it's sent along its merry way. I verified that there are about a third as many `write` syscalls done in print operations now. Libuv uses write to implement async handles, and the homing before and after each I/O operation was triggering a write on these async handles. Additionally, using the terrible benchmark of printing 10k times in a loop, this drives the runtime from 0.6s down to 0.3s (yay!).
2013-10-25Enhance timers to create portsAlex Crichton-6/+170
In addition to being able to sleep the current task, timers should be able to create ports which get notified after a period of time. Closes #10014
2013-10-25Encapsulate the lock-free mpsc queue in the MessageQueue typeBrian Anderson-57/+15
2013-10-25Add links to original mpmc and mpsc implementationsBrian Anderson-0/+3
2013-10-25TidyBrian Anderson-6/+6
2013-10-25minorJason Toffaletti-2/+6
2013-10-25minorJason Toffaletti-2/+2
2013-10-25fix bug introduced by previous clean up. more clean up.Jason Toffaletti-23/+19
2013-10-25clean upJason Toffaletti-36/+38
2013-10-25add padding to prevent false sharingJason Toffaletti-0/+8
2013-10-25add multi-producer multi-consumer bounded queue to use for sleeper listJason Toffaletti-56/+211
2013-10-25add cache line paddingJason Toffaletti-4/+11
2013-10-25lock-free queue for scheduler message queueJason Toffaletti-4/+210