fn test<T: Unpin>(t: T) { } fn main() { let a = 1; let b = async { 1 }; test(b) // the trait `Unpin` is not implemented for `[async block]` }
Future 不是 Unpin,那么为什么固定它(pin_mut、Box::pin 等,用 Pin<..> 包装它)使其实现 Unpin?