Skip to content

Commit

Permalink
Add explanation why the Unpin impl is safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
najamelan authored and seanmonstar committed Oct 31, 2019
1 parent 5f6c014 commit 0904be2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions futures-core/src/future/future_obj.rs
Expand Up @@ -19,6 +19,9 @@ pub struct LocalFutureObj<'a, T> {
_marker: PhantomData<&'a ()>,
}

// As LocalFutureObj only holds pointers, even if we move it, the pointed to values won't move,
// so this is safe as long as we don't provide any way for a user to directly access the pointers
// and move their values.
impl<T> Unpin for LocalFutureObj<'_, T> {}

#[allow(single_use_lifetimes)]
Expand Down

0 comments on commit 0904be2

Please sign in to comment.