Commit Graph

223 Commits

Author SHA1 Message Date
Igor Aleksanov f720469fd0 Use matches macro in libcore and libstd 2020-01-08 07:10:28 +03:00
Mark Rousskov 82184440ec Propagate cfg bootstrap 2019-12-18 12:16:19 -05:00
Oliver Scherer 5e17e39881 Require stable/unstable annotations for the constness of all stable functions with a const modifier 2019-12-13 11:27:02 +01:00
David Tolnay 95e00bfed8 Format libcore with rustfmt
This commit applies rustfmt with default settings to files in
src/libcore *that are not involved in any currently open PR* to minimize
merge conflicts. The list of files involved in open PRs was determined
by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8

With the list of files from the script in `outstanding_files`, the
relevant commands were:

    $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018
    $ rg libcore outstanding_files | xargs git checkout --

Repeating this process several months apart should get us coverage of
most of the rest of libcore.
2019-11-26 23:02:11 -08:00
BO41 e5daab8c80 Fix typo 2019-10-12 15:18:17 +02:00
Gurwinder Singh 84cab928db Provide map_ok and map_err method for Poll<Option<Result<T, E>>> 2019-08-13 15:15:33 +05:30
Vadim Petrochenkov 8eaf17bca2 Introduce built-in macros through libcore 2019-07-26 13:09:54 +03:00
0e4ef622 04cb314ab9 Fix typo in RawWaker::new documentation
poiner -> pointer
2019-07-15 10:03:53 -05:00
Pietro Albini 924cdd4532 bump nightly to 1.37.0 2019-05-23 12:27:58 +02:00
Taiki Endo ccb9dac5ed Fix intra-doc link resolution failure on re-exporting libstd 2019-05-04 23:48:57 +09:00
Taylor Cramer 3f966dcd53 Stabilize futures_api 2019-04-23 16:13:53 -07:00
Mazdak Farrokhzad dbfbadeac4 libcore: deny more... 2019-04-19 01:37:12 +02:00
Taiki Endo 360432f1e8 libcore => 2018 2019-04-18 14:47:35 +09:00
Taylor Cramer 6786fa7795 Rename Waker::new_unchecked to Waker::from_raw 2019-04-08 14:22:31 -07:00
Taylor Cramer 01be78d69f Add Waker::wake_by_ref and make Waker::wake consume the Waker 2019-04-08 14:22:31 -07:00
Taylor Cramer 1691e06db6 Future-proof the Futures API 2019-04-05 15:03:33 -07:00
Alexander Regueiro 8629fd3e4e Improvements to comments in libstd, libcore, liballoc. 2019-03-11 02:25:44 +00:00
Matthias Einwag 871338c3ae Merging master 2019-02-12 22:46:14 -08:00
Alexander Regueiro 99ed06eb88 libs: doc comments 2019-02-10 23:57:25 +00:00
Matthias Einwag a1c4cf6889 Change RawWaker constructor to const fn 2019-02-06 22:56:33 -08:00
Matthias Einwag 363e992b98 review suggestions 2019-02-05 01:30:00 -08:00
Matthias Einwag e1ec81459d Apply more review suggestions 2019-02-05 01:14:09 -08:00
Taiki Endo 4847c097b4 Add #[must_use] to core::task::Poll 2019-02-04 22:41:39 +09:00
Matthias Einwag 9e6bc3c438 Apply review suggestions and fix tests 2019-02-03 13:46:53 -08:00
Mazdak Farrokhzad 01a704cf36 Apply suggestions from code review
Co-Authored-By: Matthias247 <matthias.einwag@live.com>
2019-02-03 13:46:53 -08:00
Matthias Einwag d9a4b22d32 Update the future/task API
This change updates the future and task API as discussed in the stabilization RFC at https://github.com/rust-lang/rfcs/pull/2592.

Changes:
- Replacing UnsafeWake with RawWaker and RawWakerVtable
- Removal of LocalWaker
- Removal of Arc-based Wake trait
2019-02-03 13:46:53 -08:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alexander Regueiro ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
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](https://github.com/rust-lang-nursery/futures-rs/blob/1328fc9e8af5737183df477c7501e6ea24ff2053/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