Skip to content
Permalink
Browse files

Auto merge of #60208 - Centril:rollup-vg8gl67, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #59739 (Stabilize futures_api)
 - #59839 (Warn on unused results for operation methods on nums)
 - #60146 (Update fonts used by rustdoc)
 - #60169 (Warn when ignore-tidy-linelength is present, but no lines are too long)
 - #60177 (Promote rust comments to rustdoc)
 - #60191 (Add f16c target_feature)

Failed merges:

r? @ghost
  • Loading branch information...
bors committed Apr 23, 2019
2 parents 4eff852 + 97b74a5 commit ab6e5a2a5178c9044b73c5795561e3feb978604b
Showing with 673 additions and 486 deletions.
  1. +0 −1 src/ci/docker/dist-various-1/install-x86_64-redox.sh
  2. +0 −2 src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh
  3. +1 −1 src/liballoc/boxed.rs
  4. +0 −1 src/liballoc/lib.rs
  5. +6 −3 src/libcore/future/future.rs
  6. +2 −3 src/libcore/future/mod.rs
  7. +156 −0 src/libcore/num/mod.rs
  8. +3 −3 src/libcore/task/mod.rs
  9. +16 −4 src/libcore/task/poll.rs
  10. +27 −9 src/libcore/task/wake.rs
  11. +1 −0 src/librustc/ich/impls_syntax.rs
  12. +134 −137 src/librustc/infer/mod.rs
  13. +1 −0 src/librustc/middle/stability.rs
  14. +2 −0 src/librustc/query/mod.rs
  15. +7 −0 src/librustc/ty/constness.rs
  16. +7 −7 src/librustc/ty/mod.rs
  17. +4 −4 src/librustc/ty/subst.rs
  18. +1 −0 src/librustc_codegen_llvm/llvm_util.rs
  19. +6 −2 src/librustc_mir/transform/qualify_min_const_fn.rs
  20. +2 −2 src/librustdoc/html/render.rs
  21. +3 −8 src/librustdoc/html/static/FiraSans-LICENSE.txt
  22. BIN src/librustdoc/html/static/FiraSans-Medium.woff
  23. BIN src/librustdoc/html/static/FiraSans-Regular.woff
  24. +1 −1 src/librustdoc/html/static/{SourceCodePro-LICENSE.txt → SourceCodePro-LICENSE.md}
  25. BIN src/librustdoc/html/static/SourceCodePro-Regular.woff
  26. BIN src/librustdoc/html/static/SourceCodePro-Semibold.woff
  27. BIN src/librustdoc/html/static/SourceSerifPro-Bold.ttf.woff
  28. BIN src/librustdoc/html/static/SourceSerifPro-It.ttf.woff
  29. +1 −1 src/librustdoc/html/static/{SourceSerifPro-LICENSE.txt → SourceSerifPro-LICENSE.md}
  30. BIN src/librustdoc/html/static/SourceSerifPro-Regular.ttf.woff
  31. +2 −2 src/librustdoc/html/static_files.rs
  32. +1 −0 src/libstd/future.rs
  33. +3 −7 src/libstd/lib.rs
  34. +1 −1 src/libstd/panic.rs
  35. +14 −4 src/libsyntax/attr/builtin.rs
  36. +3 −3 src/libsyntax_pos/hygiene.rs
  37. +0 −1 src/test/codegen-units/item-collection/cross-crate-closures.rs
  38. +0 −1 src/test/codegen-units/item-collection/cross-crate-generic-functions.rs
  39. +0 −1 src/test/codegen-units/item-collection/cross-crate-trait-method.rs
  40. +0 −1 src/test/codegen-units/item-collection/function-as-argument.rs
  41. +0 −1 src/test/codegen-units/item-collection/generic-functions.rs
  42. +0 −1 src/test/codegen-units/item-collection/generic-impl.rs
  43. +0 −1 src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs
  44. +0 −1 src/test/codegen-units/item-collection/items-within-generic-items.rs
  45. +0 −1 src/test/codegen-units/item-collection/non-generic-functions.rs
  46. +0 −1 src/test/codegen-units/item-collection/overloaded-operators.rs
  47. +0 −1 src/test/codegen-units/item-collection/static-init.rs
  48. +0 −1 src/test/codegen-units/item-collection/statics-and-consts.rs
  49. +0 −1 src/test/codegen-units/item-collection/trait-implementations.rs
  50. +0 −1 src/test/codegen-units/item-collection/trait-method-as-argument.rs
  51. +0 −1 src/test/codegen-units/item-collection/trait-method-default-impl.rs
  52. +0 −1 src/test/codegen-units/item-collection/unreferenced-const-fn.rs
  53. +0 −1 src/test/codegen-units/item-collection/unreferenced-inline-function.rs
  54. +0 −1 src/test/codegen-units/item-collection/unsizing.rs
  55. +0 −1 src/test/codegen-units/item-collection/unused-traits-and-generics.rs
  56. +0 −1 src/test/codegen-units/partitioning/statics.rs
  57. +0 −1 src/test/codegen/adjustments.rs
  58. +0 −1 src/test/codegen/enum-debug-niche.rs
  59. +0 −1 src/test/codegen/enum-debug-tagged.rs
  60. +0 −1 src/test/codegen/generic-debug.rs
  61. +0 −1 src/test/codegen/mainsubprogram.rs
  62. +0 −1 src/test/codegen/mainsubprogramstart.rs
  63. +0 −1 src/test/codegen/noreturn-uninhabited.rs
  64. +0 −1 src/test/codegen/noreturnflag.rs
  65. +0 −2 src/test/codegen/panic-abort-windows.rs
  66. +0 −1 src/test/codegen/refs.rs
  67. +0 −1 src/test/codegen/remap_path_prefix/xcrate-generic.rs
  68. +0 −1 src/test/codegen/vtabletype.rs
  69. +1 −1 src/test/compile-fail/must_use-in-stdlib-traits.rs
  70. +0 −2 src/test/debuginfo/enum-thinlto.rs
  71. +0 −1 src/test/debuginfo/generic-enum-with-different-disr-sizes.rs
  72. +0 −1 src/test/debuginfo/recursive-struct.rs
  73. +0 −2 src/test/debuginfo/unique-enum.rs
  74. +0 −2 src/test/incremental/remapped_paths_cc/auxiliary/extern_crate.rs
  75. +0 −2 src/test/mir-opt/basic_assignment.rs
  76. +0 −1 src/test/mir-opt/nll/named-lifetimes-basic.rs
  77. +0 −2 src/test/mir-opt/storage_ranges.rs
  78. +1 −1 src/test/run-pass/async-await.rs
  79. +0 −2 src/test/run-pass/auxiliary/arc_wake.rs
  80. +1 −1 src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs
  81. +0 −2 src/test/run-pass/futures-api.rs
  82. +1 −1 src/test/run-pass/issue-55809.rs
  83. +2 −2 src/test/run-pass/issues/issue-16278.rs
  84. +0 −2 src/test/rustdoc-ui/intra-link-span-ice-55723.rs
  85. +2 −2 src/test/rustdoc-ui/intra-link-span-ice-55723.stderr
  86. +1 −1 src/test/rustdoc/async-fn.rs
  87. +0 −1 src/test/rustdoc/empty-mod-private.rs
  88. +0 −2 src/test/rustdoc/extern-html-root-url.rs
  89. +0 −2 src/test/rustdoc/method-list.rs
  90. +0 −1 src/test/rustdoc/pub-method.rs
  91. +1 −1 src/test/ui/async-fn-multiple-lifetimes.rs
  92. +4 −4 src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr
  93. +0 −2 src/test/ui/borrowck/two-phase-activation-sharing-interference.rs
  94. +0 −2 src/test/ui/consts/const-array-oob.rs
  95. +1 −1 src/test/ui/consts/const-array-oob.stderr
  96. +10 −0 src/test/ui/consts/min_const_fn/allow_const_fn_ptr.rs
  97. +11 −0 src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr
  98. +11 −0 src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs
  99. +12 −0 src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr
  100. +18 −0 src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs
  101. +0 −2 src/test/ui/deprecation/deprecation-in-future.rs
  102. +1 −1 src/test/ui/deprecation/deprecation-in-future.stderr
  103. +0 −2 src/test/ui/derives/deriving-meta-unknown-trait.rs
  104. +1 −1 src/test/ui/derives/deriving-meta-unknown-trait.stderr
  105. +0 −2 src/test/ui/discrim/discrim-overflow-2.rs
  106. +8 −8 src/test/ui/discrim/discrim-overflow-2.stderr
  107. +0 −2 src/test/ui/discrim/discrim-overflow.rs
  108. +8 −8 src/test/ui/discrim/discrim-overflow.stderr
  109. +1 −1 src/test/ui/editions/edition-deny-async-fns-2015.rs
  110. +0 −1 src/test/ui/editions/edition-raw-pointer-method-2015.rs
  111. +2 −2 src/test/ui/editions/edition-raw-pointer-method-2015.stderr
  112. +0 −1 src/test/ui/editions/edition-raw-pointer-method-2018.rs
  113. +1 −1 src/test/ui/editions/edition-raw-pointer-method-2018.stderr
  114. +0 −2 src/test/ui/error-codes/E0375.rs
  115. +1 −1 src/test/ui/error-codes/E0375.stderr
  116. +0 −2 src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs
  117. +4 −4 src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr
  118. +0 −2 src/test/ui/feature-gates/feature-gate-async-await.rs
  119. +6 −6 src/test/ui/feature-gates/feature-gate-async-await.stderr
  120. +0 −1 src/test/ui/feature-gates/feature-gate-ffi_returns_twice.rs
  121. +1 −1 src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr
  122. +0 −1 src/test/ui/ffi_returns_twice.rs
  123. +1 −1 src/test/ui/ffi_returns_twice.stderr
  124. +0 −2 src/test/ui/impl-trait/auto-trait-leak.rs
  125. +12 −12 src/test/ui/impl-trait/auto-trait-leak.stderr
  126. +0 −2 src/test/ui/impl-trait/auto-trait-leak2.rs
  127. +6 −6 src/test/ui/impl-trait/auto-trait-leak2.stderr
  128. +0 −2 src/test/ui/impl-trait/method-suggestion-no-duplication.rs
  129. +1 −1 src/test/ui/impl-trait/method-suggestion-no-duplication.stderr
  130. +1 −1 src/test/ui/impl-trait/recursive-async-impl-trait-type.rs
  131. +1 −1 src/test/ui/impl-trait/recursive-impl-trait-type.rs
  132. +0 −2 src/test/ui/invalid-module-declaration/invalid-module-declaration.rs
  133. +0 −2 src/test/ui/issues/issue-21950.rs
  134. +2 −2 src/test/ui/issues/issue-21950.stderr
  135. +0 −2 src/test/ui/issues/issue-22370.rs
  136. +1 −1 src/test/ui/issues/issue-22370.stderr
  137. +0 −2 src/test/ui/issues/issue-22560.rs
  138. +4 −4 src/test/ui/issues/issue-22560.stderr
  139. +1 −3 src/test/ui/issues/issue-23080-2.rs
  140. +1 −1 src/test/ui/issues/issue-23080-2.stderr
  141. +0 −2 src/test/ui/issues/issue-23080.rs
  142. +1 −1 src/test/ui/issues/issue-23080.stderr
  143. +0 −2 src/test/ui/issues/issue-23281.rs
  144. +1 −1 src/test/ui/issues/issue-23281.stderr
  145. +1 −1 src/test/ui/issues/issue-54974.rs
  146. +1 −1 src/test/ui/issues/issue-55324.rs
  147. +1 −1 src/test/ui/issues/issue-58885.rs
  148. +1 −1 src/test/ui/issues/issue-59001.rs
  149. +0 −2 src/test/ui/issues/issue-59488.rs
  150. +10 −10 src/test/ui/issues/issue-59488.stderr
  151. +0 −2 src/test/ui/lint/lint-incoherent-auto-trait-objects.rs
  152. +3 −3 src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr
  153. +0 −2 src/test/ui/moves/moves-based-on-type-block-bad.rs
  154. +2 −2 src/test/ui/moves/moves-based-on-type-block-bad.stderr
  155. +1 −1 src/test/ui/no-args-non-move-async-closure.rs
  156. +0 −2 src/test/ui/on-unimplemented/auxiliary/no_debug.rs
  157. +0 −3 src/test/ui/on-unimplemented/slice-index.rs
  158. +2 −2 src/test/ui/on-unimplemented/slice-index.stderr
  159. +0 −3 src/test/ui/parser/byte-string-literals.rs
  160. +5 −5 src/test/ui/parser/byte-string-literals.stderr
  161. +0 −2 src/test/ui/rfc-2093-infer-outlives/dont-infer-static.rs
  162. +2 −2 src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr
  163. +0 −2 src/test/ui/rfc-2093-infer-outlives/enum.rs
  164. +3 −3 src/test/ui/rfc-2093-infer-outlives/enum.stderr
  165. +0 −2 src/test/ui/span/issue-24356.rs
  166. +1 −1 src/test/ui/span/issue-24356.stderr
  167. +0 −2 src/test/ui/span/issue-7575.rs
  168. +8 −8 src/test/ui/span/issue-7575.stderr
  169. +0 −2 src/test/ui/stability-attribute/stability-attribute-issue.rs
  170. +2 −2 src/test/ui/stability-attribute/stability-attribute-issue.stderr
  171. +0 −1 src/test/ui/try-poll.rs
  172. +0 −2 src/test/ui/typeck/typeck-default-trait-impl-negation-sync.rs
  173. +6 −6 src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr
  174. +75 −22 src/tools/tidy/src/style.rs
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
# ignore-tidy-linelength

set -ex

@@ -1,7 +1,5 @@
#!/usr/bin/env bash

# ignore-tidy-linelength

set -ex
source shared.sh

@@ -911,7 +911,7 @@ impl<G: ?Sized + Generator> Generator for Pin<Box<G>> {
}
}

#[unstable(feature = "futures_api", issue = "50547")]
#[stable(feature = "futures_api", since = "1.36.0")]
impl<F: ?Sized + Future + Unpin> Future for Box<F> {
type Output = F::Output;

@@ -85,7 +85,6 @@
#![feature(fmt_internals)]
#![feature(fn_traits)]
#![feature(fundamental)]
#![feature(futures_api)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(needs_allocator)]
@@ -1,6 +1,4 @@
#![unstable(feature = "futures_api",
reason = "futures in libcore are unstable",
issue = "50547")]
#![stable(feature = "futures_api", since = "1.36.0")]

use crate::marker::Unpin;
use crate::ops;
@@ -26,8 +24,10 @@ use crate::task::{Context, Poll};
/// `await!` the value.
#[doc(spotlight)]
#[must_use = "futures do nothing unless polled"]
#[stable(feature = "futures_api", since = "1.36.0")]
pub trait Future {
/// The type of value produced on completion.
#[stable(feature = "futures_api", since = "1.36.0")]
type Output;

/// Attempt to resolve the future to a final value, registering
@@ -92,9 +92,11 @@ pub trait Future {
/// [`Context`]: ../task/struct.Context.html
/// [`Waker`]: ../task/struct.Waker.html
/// [`Waker::wake`]: ../task/struct.Waker.html#method.wake
#[stable(feature = "futures_api", since = "1.36.0")]
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl<F: ?Sized + Future + Unpin> Future for &mut F {
type Output = F::Output;

@@ -103,6 +105,7 @@ impl<F: ?Sized + Future + Unpin> Future for &mut F {
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl<P> Future for Pin<P>
where
P: Unpin + ops::DerefMut,
@@ -1,8 +1,7 @@
#![unstable(feature = "futures_api",
reason = "futures in libcore are unstable",
issue = "50547")]
#![stable(feature = "futures_api", since = "1.36.0")]

//! Asynchronous values.

mod future;
#[stable(feature = "futures_api", since = "1.36.0")]
pub use self::future::Future;

Large diffs are not rendered by default.

@@ -1,11 +1,11 @@
#![unstable(feature = "futures_api",
reason = "futures in libcore are unstable",
issue = "50547")]
#![stable(feature = "futures_api", since = "1.36.0")]

//! Types and Traits for working with asynchronous tasks.

mod poll;
#[stable(feature = "futures_api", since = "1.36.0")]
pub use self::poll::Poll;

mod wake;
#[stable(feature = "futures_api", since = "1.36.0")]
pub use self::wake::{Context, Waker, RawWaker, RawWakerVTable};
@@ -1,6 +1,4 @@
#![unstable(feature = "futures_api",
reason = "futures in libcore are unstable",
issue = "50547")]
#![stable(feature = "futures_api", since = "1.36.0")]

use crate::ops::Try;
use crate::result::Result;
@@ -9,20 +7,27 @@ use crate::result::Result;
/// scheduled to receive a wakeup instead.
#[must_use = "this `Poll` may be a `Pending` variant, which should be handled"]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[stable(feature = "futures_api", since = "1.36.0")]
pub enum Poll<T> {
/// Represents that a value is immediately ready.
Ready(T),
#[stable(feature = "futures_api", since = "1.36.0")]
Ready(
#[stable(feature = "futures_api", since = "1.36.0")]
T
),

/// Represents that a value is not ready yet.
///
/// When a function returns `Pending`, the function *must* also
/// ensure that the current task is scheduled to be awoken when
/// progress can be made.
#[stable(feature = "futures_api", since = "1.36.0")]
Pending,
}

impl<T> Poll<T> {
/// Changes the ready value of this `Poll` with the closure provided.
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn map<U, F>(self, f: F) -> Poll<U>
where F: FnOnce(T) -> U
{
@@ -34,6 +39,7 @@ impl<T> Poll<T> {

/// Returns `true` if this is `Poll::Ready`
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn is_ready(&self) -> bool {
match *self {
Poll::Ready(_) => true,
@@ -43,13 +49,15 @@ impl<T> Poll<T> {

/// Returns `true` if this is `Poll::Pending`
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn is_pending(&self) -> bool {
!self.is_ready()
}
}

impl<T, E> Poll<Result<T, E>> {
/// Changes the success value of this `Poll` with the closure provided.
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>>
where F: FnOnce(T) -> U
{
@@ -61,6 +69,7 @@ impl<T, E> Poll<Result<T, E>> {
}

/// Changes the error value of this `Poll` with the closure provided.
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>>
where F: FnOnce(E) -> U
{
@@ -72,12 +81,14 @@ impl<T, E> Poll<Result<T, E>> {
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl<T> From<T> for Poll<T> {
fn from(t: T) -> Poll<T> {
Poll::Ready(t)
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl<T, E> Try for Poll<Result<T, E>> {
type Ok = Poll<T>;
type Error = E;
@@ -102,6 +113,7 @@ impl<T, E> Try for Poll<Result<T, E>> {
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl<T, E> Try for Poll<Option<Result<T, E>>> {
type Ok = Poll<Option<T>>;
type Error = E;
@@ -1,6 +1,4 @@
#![unstable(feature = "futures_api",
reason = "futures in libcore are unstable",
issue = "50547")]
#![stable(feature = "futures_api", since = "1.36.0")]

use crate::fmt;
use crate::marker::{PhantomData, Unpin};
@@ -13,6 +11,7 @@ use crate::marker::{PhantomData, Unpin};
/// It consists of a data pointer and a [virtual function pointer table (vtable)][vtable] that
/// customizes the behavior of the `RawWaker`.
#[derive(PartialEq, Debug)]
#[stable(feature = "futures_api", since = "1.36.0")]
pub struct RawWaker {
/// A data pointer, which can be used to store arbitrary data as required
/// by the executor. This could be e.g. a type-erased pointer to an `Arc`
@@ -37,9 +36,7 @@ impl RawWaker {
/// from a `RawWaker`. For each operation on the `Waker`, the associated
/// function in the `vtable` of the underlying `RawWaker` will be called.
#[rustc_promotable]
#[unstable(feature = "futures_api",
reason = "futures in libcore are unstable",
issue = "50547")]
#[stable(feature = "futures_api", since = "1.36.0")]
pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker {
RawWaker {
data,
@@ -58,6 +55,7 @@ impl RawWaker {
/// pointer of a properly constructed [`RawWaker`] object from inside the
/// [`RawWaker`] implementation. Calling one of the contained functions using
/// any other `data` pointer will cause undefined behavior.
#[stable(feature = "futures_api", since = "1.36.0")]
#[derive(PartialEq, Copy, Clone, Debug)]
pub struct RawWakerVTable {
/// This function will be called when the [`RawWaker`] gets cloned, e.g. when
@@ -131,9 +129,14 @@ impl RawWakerVTable {
/// resources that are associated with this instance of a [`RawWaker`] and
/// associated task.
#[rustc_promotable]
#[unstable(feature = "futures_api",
reason = "futures in libcore are unstable",
issue = "50547")]
#[cfg_attr(stage0, unstable(feature = "futures_api_const_fn_ptr", issue = "50547"))]
#[cfg_attr(not(stage0), stable(feature = "futures_api", since = "1.36.0"))]
// `rustc_allow_const_fn_ptr` is a hack that should not be used anywhere else
// without first consulting with T-Lang.
//
// FIXME: remove whenever we have a stable way to accept fn pointers from const fn
// (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062)
#[cfg_attr(not(stage0), rustc_allow_const_fn_ptr)]
pub const fn new(
clone: unsafe fn(*const ()) -> RawWaker,
wake: unsafe fn(*const ()),
@@ -153,6 +156,7 @@ impl RawWakerVTable {
///
/// Currently, `Context` only serves to provide access to a `&Waker`
/// which can be used to wake the current task.
#[stable(feature = "futures_api", since = "1.36.0")]
pub struct Context<'a> {
waker: &'a Waker,
// Ensure we future-proof against variance changes by forcing
@@ -164,6 +168,7 @@ pub struct Context<'a> {

impl<'a> Context<'a> {
/// Create a new `Context` from a `&Waker`.
#[stable(feature = "futures_api", since = "1.36.0")]
#[inline]
pub fn from_waker(waker: &'a Waker) -> Self {
Context {
@@ -173,12 +178,14 @@ impl<'a> Context<'a> {
}

/// Returns a reference to the `Waker` for the current task.
#[stable(feature = "futures_api", since = "1.36.0")]
#[inline]
pub fn waker(&self) -> &'a Waker {
&self.waker
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl fmt::Debug for Context<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Context")
@@ -195,17 +202,22 @@ impl fmt::Debug for Context<'_> {
///
/// Implements [`Clone`], [`Send`], and [`Sync`].
#[repr(transparent)]
#[stable(feature = "futures_api", since = "1.36.0")]
pub struct Waker {
waker: RawWaker,
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl Unpin for Waker {}
#[stable(feature = "futures_api", since = "1.36.0")]
unsafe impl Send for Waker {}
#[stable(feature = "futures_api", since = "1.36.0")]
unsafe impl Sync for Waker {}

impl Waker {
/// Wake up the task associated with this `Waker`.
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn wake(self) {
// The actual wakeup call is delegated through a virtual function call
// to the implementation which is defined by the executor.
@@ -227,6 +239,7 @@ impl Waker {
/// where an owned `Waker` is available. This method should be preferred to
/// calling `waker.clone().wake()`.
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn wake_by_ref(&self) {
// The actual wakeup call is delegated through a virtual function call
// to the implementation which is defined by the executor.
@@ -243,6 +256,7 @@ impl Waker {
///
/// This function is primarily used for optimization purposes.
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn will_wake(&self, other: &Waker) -> bool {
self.waker == other.waker
}
@@ -253,13 +267,15 @@ impl Waker {
/// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
/// Therefore this method is unsafe.
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub unsafe fn from_raw(waker: RawWaker) -> Waker {
Waker {
waker,
}
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl Clone for Waker {
#[inline]
fn clone(&self) -> Self {
@@ -272,6 +288,7 @@ impl Clone for Waker {
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl Drop for Waker {
#[inline]
fn drop(&mut self) {
@@ -282,6 +299,7 @@ impl Drop for Waker {
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl fmt::Debug for Waker {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let vtable_ptr = self.waker.vtable as *const RawWakerVTable;
@@ -121,6 +121,7 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability {
feature,
rustc_depr,
promotable,
allow_const_fn_ptr,
const_stability
});

0 comments on commit ab6e5a2

Please sign in to comment.
You can’t perform that action at this time.