diff options
Diffstat (limited to 'library/core/src/task/wake.rs')
-rw-r--r-- | library/core/src/task/wake.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 60ecc9c0b..0cff972df 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -186,17 +186,19 @@ pub struct Context<'a> { impl<'a> Context<'a> { /// Create a new `Context` from a [`&Waker`](Waker). #[stable(feature = "futures_api", since = "1.36.0")] + #[rustc_const_unstable(feature = "const_waker", issue = "102012")] #[must_use] #[inline] - pub fn from_waker(waker: &'a Waker) -> Self { + pub const fn from_waker(waker: &'a Waker) -> Self { Context { waker, _marker: PhantomData } } /// Returns a reference to the [`Waker`] for the current task. #[stable(feature = "futures_api", since = "1.36.0")] + #[rustc_const_unstable(feature = "const_waker", issue = "102012")] #[must_use] #[inline] - pub fn waker(&self) -> &'a Waker { + pub const fn waker(&self) -> &'a Waker { &self.waker } } @@ -311,7 +313,8 @@ impl Waker { #[inline] #[must_use] #[stable(feature = "futures_api", since = "1.36.0")] - pub unsafe fn from_raw(waker: RawWaker) -> Waker { + #[rustc_const_unstable(feature = "const_waker", issue = "102012")] + pub const unsafe fn from_raw(waker: RawWaker) -> Waker { Waker { waker } } |