diff options
| author | bors <bors@rust-lang.org> | 2018-08-04 16:12:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-04 16:12:39 +0000 |
| commit | 215bf3abd9c0eb1fd0c6cae7c92a842732dc033d (patch) | |
| tree | ec0774a68324a0b81cc699137de200d8fb1c296d /src/libstd | |
| parent | 579adf8c727861841b4819b4913385c2782977fb (diff) | |
| parent | 396dda0a6ab57cd89c0e2c28032d05bd91caba08 (diff) | |
| download | rust-215bf3abd9c0eb1fd0c6cae7c92a842732dc033d.tar.gz rust-215bf3abd9c0eb1fd0c6cae7c92a842732dc033d.zip | |
Auto merge of #53056 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests
Successful merges:
- #51919 (Provide `{to,from}_{ne,le,be}_bytes` functions on integers)
- #52940 (Align 6-week cycle check with beta promotion instead of stable release.)
- #52968 (App-lint-cability)
- #52969 (rustbuild: fix local_rebuild)
- #52995 (Remove unnecessary local in await! generator)
- #52996 (RELEASES.md: fix the `hash_map::Entry::or_default` link)
- #53001 (privacy: Fix an ICE in `path_is_private_type`)
- #53003 (Stabilize --color and --error-format options in rustdoc)
- #53022 (volatile operations docs: clarify that this does not help wrt. concurrency)
- #53024 (Specify reentrancy gurantees of `Once::call_once`)
- #53041 (Fix invalid code css rule)
- #53047 (Make entire row of doc search results clickable)
- #53050 (Make left column of rustdoc search results narrower)
- #53062 (Remove redundant field names in structs)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/future.rs | 4 | ||||
| -rw-r--r-- | src/libstd/macros.rs | 15 | ||||
| -rw-r--r-- | src/libstd/sync/once.rs | 4 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/libstd/future.rs b/src/libstd/future.rs index c1cc36f3b41..12ea1ea9f9d 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -108,9 +108,9 @@ where #[unstable(feature = "gen_future", issue = "50547")] /// Polls a future in the current thread-local task context. -pub fn poll_in_task_cx<F>(f: &mut PinMut<F>) -> Poll<F::Output> +pub fn poll_in_task_cx<F>(f: PinMut<F>) -> Poll<F::Output> where F: Future { - get_task_cx(|cx| f.reborrow().poll(cx)) + get_task_cx(|cx| f.poll(cx)) } diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index a96e2ba2134..f15494c5fd7 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -227,14 +227,17 @@ macro_rules! eprintln { macro_rules! await { ($e:expr) => { { let mut pinned = $e; - let mut pinned = unsafe { $crate::mem::PinMut::new_unchecked(&mut pinned) }; loop { - match $crate::future::poll_in_task_cx(&mut pinned) { - // FIXME(cramertj) prior to stabilizing await, we have to ensure that this - // can't be used to create a generator on stable via `|| await!()`. - $crate::task::Poll::Pending => yield, - $crate::task::Poll::Ready(x) => break x, + if let $crate::task::Poll::Ready(x) = + $crate::future::poll_in_task_cx(unsafe { + $crate::mem::PinMut::new_unchecked(&mut pinned) + }) + { + break x; } + // FIXME(cramertj) prior to stabilizing await, we have to ensure that this + // can't be used to create a generator on stable via `|| await!()`. + yield } } } } diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 10282ecb658..3abc260b458 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -178,6 +178,10 @@ impl Once { /// happens-before relation between the closure and code executing after the /// return). /// + /// If the given closure recusively invokes `call_once` on the same `Once` + /// instance the exact behavior is not specified, allowed outcomes are + /// a panic or a deadlock. + /// /// # Examples /// /// ``` |
