Commit Graph

195 Commits

Author SHA1 Message Date
Andy Russell
4e35cbb22e
fix various typos in doc comments 2018-11-13 14:45:31 -05:00
Son
35391326a6 Update comment based on suggestion. 2018-10-24 09:28:04 +11:00
Son
a70ef6a20b Seems like we don't have to refer the file anymore. 2018-10-17 08:03:12 +11:00
Son
f8550a499f Add doc for impl From for Waker 2018-10-17 07:59:38 +11:00
Taylor Cramer
00e0565c38 LocalWaker and Waker cleanups 2018-10-01 15:16:06 -07:00
Taylor Cramer
1b00f0b9fa Remove spawning from task::Context 2018-09-19 15:01:19 -07:00
Josef Reinhard Brandl
60aa11df4c Rename Executor trait to Spawn 2018-08-06 12:18:47 +02:00
ljedrz
d46dca66c9 Remove redundant field names in structs 2018-08-04 14:58:20 +02:00
Josef Reinhard Brandl
ea25cf1cc6 Fix From<LocalWaker> 2018-07-29 10:45:17 +02:00
bors
4f1e235744 Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrum
Rollup of bare_trait_objects PRs

All deny attributes were moved into bootstrap so they can be disabled with a line of config.

Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free.

r? @Mark-Simulacrum
cc @ljedrz @kennytm
2018-07-27 20:27:40 +00:00
Mark Rousskov
858adfe21d
Rollup merge of #52721 - cramertj:try-poll, r=aturon
std::ops::Try impl for std::task::Poll

I originally left out the `Try` impl for `Poll` because I was curious if we needed it, and @MajorBreakfast and I had discussed the potential for it to introduce confusion about exactly what control-flow was happening at different points. However, after porting a pretty significant chunk of Fuchsia over to futures 0.3, I discovered that I was *constantly* having to do repetitive matching on `Poll<Result<...>>` or `Poll<Option<Result<...>>>` in order to propagate errors correctly. `try_poll` (propagate `Poll::Ready(Err(..))`s) helped in some places, but it was far more common to need some form of conversion between `Result`, `Poll<Result<...>>`, and `Poll<Option<Result<...>>>`. The `Try` trait conveniently provides all of these conversions in addition to a more concise syntax (`?`), so I'd like to experiment with using these instead.

cc @seanmonstar

r? @aturon

Note: this change means that far more futures 0.1 code can work without significant changes since it papers over the fact that `Result` is no longer at the top-level when using `Stream` and `Future` (since it's now `Poll<Result<...>>` or `Poll<Option<Result<...>>>` instead of `Result<Poll<..>>` and `Result<Poll<Option<...>>>`).
2018-07-26 09:18:40 -06:00
Mark Rousskov
0127704c98
Rollup merge of #52610 - MajorBreakfast:task-terminology, r=cramertj
Clarify what a task is

Currently we call two distinct concepts "task":
1. The top-level future that is polled until completion
2. The lightweight "thread" that is responsible for polling the top-level future. What additional data beside the future is stored in this type varies between different `Executor` implementations.

I'd prefer to return to the old formulation by @alexcrichton:
```rust
/// A handle to a "task", which represents a single lightweight "thread" of
/// execution driving a future to completion.
pub struct Task {
```
Source: [`task_impl/mod.rs` in futures-rs 0.1](1328fc9e8a/src/task_impl/mod.rs (L49-L50))

I think that this change will make it much easier to explain everything.

r? @aturon
@cramertj
2018-07-26 09:18:25 -06:00
Taylor Cramer
bce8a91f34 std::ops::Try impl for std::task::Poll 2018-07-25 17:26:12 -07:00
Josef Reinhard Brandl
eacfd72522 Clarify what a task is 2018-07-25 13:39:14 +02:00
ljedrz
8646a17143 Enforce #![deny(bare_trait_objects)] in src/libcore 2018-07-25 10:21:41 +09:00
Thomas de Zeeuw
89495f3ca3 Forget Waker when cloning LocalWaker
Since NonNull is Copy the inner field of the cloned Waker was copied for
use in the new LocalWaker, however this left Waker to be dropped. Which
means that when cloning LocalWaker would also erroneously call drop_raw.

This change forgets the Waker, rather then dropping it, leaving the
inner field to be used by the returned LocalWaker.

Closes #52629.
2018-07-23 13:45:25 +02:00
Sean McArthur
4f4e91a69d task: remove wrong comments about non-existent LocalWake trait 2018-07-12 15:43:57 -07:00
bors
a22bcd8aab Auto merge of #51935 - cramertj:unpin-references, r=withoutboats
Unpin references

I also considered adding an impl for raw pointers as well, but that makes it easy to accidentally have unsound owning-collections that might otherwise be able to project pinned-ness (e.g. `Box`).

cc @RalfJung

r? @withoutboats
2018-07-04 11:32:40 +00:00
Josef Reinhard Brandl
d8bf222367 Add lifetime to FutureObj 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl
3d43f828f5 Make custom trait object for Future generic 2018-07-02 13:59:39 +02:00
Taylor Cramer
a2b21e5819 Make Waker and LocalWaker Unpin
These types never project pinned-ness into their contents,
so it is safe for them to be `Unpin`.
2018-06-29 19:33:16 -07:00
Josef Reinhard Brandl
b39ea1d18f Move spawn errors into executor.rs 2018-06-26 21:13:36 +02:00
Josef Reinhard Brandl
c055fef010 Nested LocalTaskObj in TaskObj, remove SpawnErrorObj conversions 2018-06-26 21:06:20 +02:00
Josef Reinhard Brandl
433e6b31a7 Add LocalTaskObj 2018-06-26 17:06:20 +02:00
Josef Reinhard Brandl
1f9aa1332f Split libcore/task.rs into submodules 2018-06-26 16:40:42 +02:00
Patrick Walton
0c820d4123 libstd: Rename libcore to libstd and libstd to libextra; update makefiles.
This only changes the directory names; it does not change the "real"
metadata names.
2013-05-22 21:57:05 -07:00
Brian Anderson
2042696236 core::rt: Implement Local for Task 2013-05-20 15:21:29 -07:00
Brian Anderson
06f1a64bd6 core::rt: Convert users of local_sched to Local trait 2013-05-20 15:21:09 -07:00
Brian Anderson
b0722c55f8 core:rt:: Rename LocalServices to Task 2013-05-20 15:20:49 -07:00
Brian Anderson
66319b0278 Register snapshots 2013-05-19 23:34:32 -07:00
bors
9f671698e6 auto merge of #6106 : thestinger/rust/iter, r=bstrie
I don't have a strong opinion on the function vs. method, but there's no point in having both. I'd like to make a `repeat` adaptor like Python/Haskell for turning a value into an infinite stream of the value, so this has to at least be renamed.
2013-05-19 08:13:30 -07:00
Corey Richardson
cc57ca012a Use assert_eq! rather than assert! where possible 2013-05-19 08:16:02 -04:00
Daniel Micay
d953a5ce43 replace old_iter::repeat with the Times trait 2013-05-18 04:57:21 -04:00
Brian Anderson
0d1331f4a0 Merge remote-tracking branch 'brson/io' into incoming 2013-05-15 12:09:15 -07:00
Brian Anderson
390dde571e core::rt: Rename Task to Coroutine 2013-05-15 12:19:16 -07:00
Brian Anderson
013b7760b7 core: Turn task::unkillable, etc. into no-ops in newsched. #6377
Not necessary just yet but they make ARC not work.
2013-05-15 12:19:15 -07:00
bors
bcec83aaee auto merge of #6493 : brson/rust/tls, r=thestinger 2013-05-15 10:14:04 -07:00
Brian Anderson
5af8646a8b core: Fix leak in TLS. #6231 2013-05-14 20:50:43 -07:00
Brian Anderson
b04fce6a90 Merge remote-tracking branch 'brson/io-upstream' into incoming
Conflicts:
	src/libcore/logging.rs
	src/libcore/rt/local_services.rs
	src/libcore/rt/uv/mod.rs
	src/libcore/rt/uv/net.rs
	src/libcore/rt/uv/uvio.rs
	src/libcore/unstable.rs
2013-05-14 15:30:01 -07:00
Brian Anderson
01b7b7d5a0 core::rt: Use unsafe pointers instead of transmuted regions 2013-05-14 14:52:02 -07:00
Björn Steinbrink
bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
Alex Crichton
66e1e51701 Remove re-exports from libcore/core.rc
Also fix up all the fallout elsewhere throughout core. It's really nice being
able to have the prelude.
2013-05-13 18:51:40 -04:00
Brian Anderson
fa1d0477ed core: Move locks, atomic rc to unstable::sync 2013-05-13 12:13:56 -07:00
Tim Chevalier
ed41864464 Warning police 2013-05-11 20:36:44 -07:00
bors
3e0400fb86 auto merge of #6223 : alexcrichton/rust/issue-6183, r=pcwalton
Closes #6183.

The first commit changes the compiler's method of treating a `for` loop, and all the remaining commits are just dealing with the fallout.

The biggest fallout was the `IterBytes` trait, although it's really a whole lot nicer now because all of the `iter_bytes_XX` methods are just and-ed together. Sadly there was a huge amount of stuff that's `cfg(stage0)` gated, but whoever lands the next snapshot is going to have a lot of fun deleting all this code!
2013-05-10 17:56:02 -07:00
Alex Crichton
28256052a4 core: Use the new for protocol 2013-05-10 02:46:18 -04:00
Youngsoo Son
c8e93edf55 Move core::task::local_data to core::local_data 2013-05-10 11:42:45 +09:00
bors
ca95e7f94e auto merge of #6345 : seanmoon/rust/fix-typos, r=sanxiyn
Hi there,

Really enjoying Rust. Noticed a few typos so I searched around for a few more--here's some fixes.

Ran `make check` and got `summary of 24 test runs: 4868 passed; 0 failed; 330 ignored`.

Thanks!

Sean
2013-05-09 03:51:32 -07:00
Patrick Walton
16a0125e41 libcore: Fix tests. 2013-05-08 17:04:01 -07:00
Patrick Walton
49a66a5c5a librustc: Stop parsing modes and remove them entirely from the language 2013-05-08 17:04:01 -07:00