Skip to content

Commit 4145d59

Browse files
LunaBorowskataiki-e
authored andcommitted
Inline WakerRef functions (#2626)
Those functions are trivial and non-generic. It's necessary to use `#[inline]` to enable cross-crate inlining for non-generic functions when LTO is disabled.
1 parent 0f4d34c commit 4145d59

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

futures-task/src/waker_ref.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct WakerRef<'a> {
1818

1919
impl<'a> WakerRef<'a> {
2020
/// Create a new [`WakerRef`] from a [`Waker`] reference.
21+
#[inline]
2122
pub fn new(waker: &'a Waker) -> Self {
2223
// copy the underlying (raw) waker without calling a clone,
2324
// as we won't call Waker::drop either.
@@ -31,6 +32,7 @@ impl<'a> WakerRef<'a> {
3132
/// an unsafe way (that will be valid only for a lifetime to be determined
3233
/// by the caller), and the [`Waker`] doesn't need to or must not be
3334
/// destroyed.
35+
#[inline]
3436
pub fn new_unowned(waker: ManuallyDrop<Waker>) -> Self {
3537
Self { waker, _marker: PhantomData }
3638
}
@@ -39,6 +41,7 @@ impl<'a> WakerRef<'a> {
3941
impl Deref for WakerRef<'_> {
4042
type Target = Waker;
4143

44+
#[inline]
4245
fn deref(&self) -> &Waker {
4346
&self.waker
4447
}

0 commit comments

Comments
 (0)