From 0904be24a60290dab6a25a27b81360897b00c10c Mon Sep 17 00:00:00 2001 From: Naja Melan Date: Thu, 31 Oct 2019 15:03:33 +0100 Subject: [PATCH] Add explanation why the Unpin impl is safe. --- futures-core/src/future/future_obj.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/futures-core/src/future/future_obj.rs b/futures-core/src/future/future_obj.rs index 0f678ee4de..fe4dcf6cfc 100644 --- a/futures-core/src/future/future_obj.rs +++ b/futures-core/src/future/future_obj.rs @@ -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 Unpin for LocalFutureObj<'_, T> {} #[allow(single_use_lifetimes)]