rust/library/core/src
Yuki Okushi fef1725c0f
Rollup merge of #81050 - yoshuawuyts:stabilize-task-ready, r=m-ou-se
Stabilize core::task::ready!

_Tracking issue: https://github.com/rust-lang/rust/issues/70922_

This PR stabilizes the `task::ready!` macro. Similar to https://github.com/rust-lang/rust/pull/80886, this PR was waiting on https://github.com/rust-lang/rust/issues/74355 to be fixed.

The `task::ready!` API has existed in the futures ecosystem for several years, and was added on nightly last year in https://github.com/rust-lang/rust/pull/70817. The motivation for this macro is the same as it was back then: virtually every single manual future implementation makes use of this; so much so that it's one of the few things included in the [futures-core](https://docs.rs/futures-core/0.3.12/futures_core) library.

r? ``@tmandry``

cc/ ``@rust-lang/wg-async-foundations`` ``@rust-lang/libs``

## Example
```rust
use core::task::{Context, Poll};
use core::future::Future;
use core::pin::Pin;

async fn get_num() -> usize {
    42
}

pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
    let mut f = get_num();
    let f = unsafe { Pin::new_unchecked(&mut f) };

    let num = ready!(f.poll(cx));
    // ... use num

    Poll::Ready(())
}
```
2021-07-29 06:11:41 +09:00
..
alloc docs: GlobalAlloc: Make example only require 4096-aligned static 2021-07-21 12:37:59 +01:00
array from review: add a comment why try_fold was chosen instead of fold 2021-07-27 00:14:19 +02:00
char Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
convert Added diagnostic items to structs and traits for Clippy 2021-07-15 23:57:02 +02:00
fmt Auto merge of #86048 - nbdd0121:no_floating_point, r=Amanieu 2021-07-04 14:18:57 +00:00
future remove cfg(bootstrap) 2021-05-24 11:07:48 -04:00
hash Add tracking issue and rename to hash_one 2021-06-24 01:30:48 -07:00
iter Rollup merge of #87034 - mgeier:doc-step_by, r=JohnTitor 2021-07-23 19:27:43 +09:00
macros Mark format_args_nl as #[doc(hidden)] 2021-07-23 19:04:07 +02:00
mem DOC: remove unnecessary feature crate attribute from example code 2021-07-24 11:27:42 +02:00
num Rollup merge of #87500 - Smittyvb:min-max-docs, r=kennytm 2021-07-28 18:28:18 +09:00
ops Update range.rs 2021-07-27 16:14:48 -04:00
prelude Move asm! and global_asm! to core::arch 2021-07-18 18:30:58 -04:00
ptr Add reference to tracking issue #86302 for const_ptr_write 2021-06-27 12:05:19 +02:00
slice Stabilize const_fn_union 2021-07-27 16:03:33 -04:00
str Stabilize const_fn_transmute 2021-07-27 16:03:09 -04:00
stream Remove Stream::next 2021-01-23 16:54:56 +01:00
sync Fix typo in core::sync::atomic::compiler_fence example 2021-07-06 10:53:14 -03:00
task Update stable version of ready!() macro. 2021-07-28 16:56:12 +02:00
unicode Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
any.rs Added diagnostic items to structs and traits for Clippy 2021-07-15 23:57:02 +02:00
ascii.rs Replace all fmt.pad with debug_struct 2021-04-21 14:38:24 +02:00
bool.rs Fix tracking issue for bool_to_option 2021-07-10 18:43:52 -04:00
borrow.rs Fix borrow and deref 2021-03-03 11:23:29 +01:00
cell.rs fix typo: whenver -> whenever 2021-07-26 22:12:35 +01:00
clone.rs Updates Clone docs for Copy comparison. 2021-06-10 11:28:26 -04:00
cmp.rs Added diagnostic items to functions for Clippy 2021-07-15 23:47:03 +02:00
default.rs Permit deriving default on enums with #[default] 2021-07-27 15:47:47 -04:00
ffi.rs Replace all fmt.pad with debug_struct 2021-04-21 14:38:24 +02:00
hint.rs Auto merge of #84725 - sebpop:arm64-isb, r=joshtriplett 2021-05-02 04:54:31 +00:00
internal_macros.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
intrinsics.rs Stabilize const_fn_transmute 2021-07-27 16:03:09 -04:00
lazy.rs Capitalize safety comments 2020-09-08 22:26:44 -04:00
lib.rs Stabilize const_fn_union 2021-07-27 16:03:33 -04:00
marker.rs Rename variable 2021-06-29 20:26:37 -04:00
option.rs Auto merge of #87196 - oxalica:option-insert-must-use, r=joshtriplett 2021-07-19 07:03:36 +00:00
panic.rs Implement new panic!() behaviour for Rust 2021. 2021-01-25 13:48:11 +01:00
panicking.rs Fix panic message of assert_failed_inner 2021-03-13 18:50:43 +08:00
pin.rs Fix overlength lines in core::pin. 2021-01-05 20:14:02 +01:00
primitive.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
result.rs Auto merge of #86211 - tlyu:option-result-overviews, r=joshtriplett 2021-07-14 05:10:57 +00:00
time.rs Added diagnostic items to structs and traits for Clippy 2021-07-15 23:57:02 +02:00
tuple.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
unit.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00