Skip to content

Commit f2f0f2e

Browse files
committed
Waker and LocalWaker docs: Make the warning much more specific.
1 parent 2329601 commit f2f0f2e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

library/core/src/task/wake.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,12 @@ impl Waker {
543543
///
544544
/// # Warning
545545
///
546-
/// Do not use this function as a way to be able to call `poll` methods in production code
547-
/// from within a non-`async`, non-`poll`, function.
546+
/// When implementing a runtime-agnostic future which wraps other future(s),
547+
/// do not use this function as a way to be able to call `poll` methods
548+
/// when you don't have your caller's `Context` available.
548549
///
549550
/// Using a no-op waker for that purpose would cause wakeups to be lost:
550-
/// the future would store only the no-op waker,
551+
/// the inner future would store only the no-op waker,
551552
/// replacing the proper waker for the waiting task.
552553
///
553554
/// # Examples
@@ -809,12 +810,12 @@ impl LocalWaker {
809810
///
810811
/// # Warning
811812
///
812-
/// Do not use this function as a way to be able to call `poll` methods,
813-
/// in production code,
814-
/// from within a non-`async`, non-`poll`, function.
813+
/// When implementing a runtime-agnostic future which wraps other future(s),
814+
/// do not use this function as a way to be able to call `poll` methods
815+
/// when you don't have your caller's `Context` available.
815816
///
816817
/// Using a no-op waker for that purpose would cause wakeups to be lost:
817-
/// the future would store only the no-op waker,
818+
/// the inner future would store only the no-op waker,
818819
/// replacing the proper waker for the waiting task.
819820
///
820821
/// # Examples

0 commit comments

Comments
 (0)