Skip to content

Commit

Permalink
Rollup merge of rust-lang#76853 - denisvasilik:intra-doc-links-core-w…
Browse files Browse the repository at this point in the history
…ake, r=jyn514

Use intra-doc links in library/core/src/task/wake.rs

Helps with rust-lang#75080.

@rustbot modify labels: T-doc, A-intra-doc-links
  • Loading branch information
Dylan-DPC authored Sep 19, 2020
2 parents e0f9cd8 + 8e9ad31 commit 099b738
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ use crate::marker::{PhantomData, Unpin};
///
/// [vtable]: https://en.wikipedia.org/wiki/Virtual_method_table
///
/// It consists of a data pointer and a [virtual function pointer table (vtable)][vtable] that
/// customizes the behavior of the `RawWaker`.
///
/// [`Waker`]: struct.Waker.html
/// 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 {
Expand Down Expand Up @@ -52,12 +50,10 @@ impl RawWaker {
/// The pointer passed to all functions inside the vtable is the `data` pointer
/// from the enclosing [`RawWaker`] object.
///
/// The functions inside this struct are only intended be called on the `data`
/// The functions inside this struct are only intended to be called on the `data`
/// 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.
///
/// [`RawWaker`]: struct.RawWaker.html
#[stable(feature = "futures_api", since = "1.36.0")]
#[derive(PartialEq, Copy, Clone, Debug)]
pub struct RawWakerVTable {
Expand All @@ -68,9 +64,6 @@ pub struct RawWakerVTable {
/// required for this additional instance of a [`RawWaker`] and associated
/// task. Calling `wake` on the resulting [`RawWaker`] should result in a wakeup
/// of the same task that would have been awoken by the original [`RawWaker`].
///
/// [`Waker`]: struct.Waker.html
/// [`RawWaker`]: struct.RawWaker.html
clone: unsafe fn(*const ()) -> RawWaker,

/// This function will be called when `wake` is called on the [`Waker`].
Expand All @@ -79,28 +72,20 @@ pub struct RawWakerVTable {
/// The implementation of this function must make sure to release any
/// resources that are associated with this instance of a [`RawWaker`] and
/// associated task.
///
/// [`Waker`]: struct.Waker.html
/// [`RawWaker`]: struct.RawWaker.html
wake: unsafe fn(*const ()),

/// This function will be called when `wake_by_ref` is called on the [`Waker`].
/// It must wake up the task associated with this [`RawWaker`].
///
/// This function is similar to `wake`, but must not consume the provided data
/// pointer.
///
/// [`Waker`]: struct.Waker.html
/// [`RawWaker`]: struct.RawWaker.html
wake_by_ref: unsafe fn(*const ()),

/// This function gets called when a [`RawWaker`] gets dropped.
///
/// The implementation of this function must make sure to release any
/// resources that are associated with this instance of a [`RawWaker`] and
/// associated task.
///
/// [`RawWaker`]: struct.RawWaker.html
drop: unsafe fn(*const ()),
}

Expand Down Expand Up @@ -142,9 +127,6 @@ impl RawWakerVTable {
/// The implementation of this function must make sure to release any
/// resources that are associated with this instance of a [`RawWaker`] and
/// associated task.
///
/// [`Waker`]: struct.Waker.html
/// [`RawWaker`]: struct.RawWaker.html
#[rustc_promotable]
#[stable(feature = "futures_api", since = "1.36.0")]
// `rustc_allow_const_fn_ptr` is a hack that should not be used anywhere else
Expand Down Expand Up @@ -208,8 +190,6 @@ impl fmt::Debug for Context<'_> {
/// executor-specific wakeup behavior.
///
/// Implements [`Clone`], [`Send`], and [`Sync`].
///
/// [`RawWaker`]: struct.RawWaker.html
#[repr(transparent)]
#[stable(feature = "futures_api", since = "1.36.0")]
pub struct Waker {
Expand Down Expand Up @@ -275,9 +255,6 @@ impl Waker {
/// The behavior of the returned `Waker` is undefined if the contract defined
/// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
/// Therefore this method is unsafe.
///
/// [`RawWaker`]: struct.RawWaker.html
/// [`RawWakerVTable`]: struct.RawWakerVTable.html
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub unsafe fn from_raw(waker: RawWaker) -> Waker {
Expand Down

0 comments on commit 099b738

Please sign in to comment.