Skip to content

Commit ff2737d

Browse files
snarkmasterfacebook-github-bot
authored andcommitted
PickTaskWrapper fallback for old compilers
Summary: On old compilers, we don't have `SafeTask`, so even though `coro::Future<int>` (e.g.) is safe, we have to derive `Task` instead of `SafeTask` from it in `collectAll()` and `timeout()`. Reviewed By: ispeters Differential Revision: D77839263 fbshipit-source-id: 54e514a543bc941c24755ca9ab92c9e748ba47f7
1 parent b42be16 commit ff2737d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

third-party/folly/src/folly/coro/detail/PickTaskWrapper.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ struct PickTaskWrapperImpl<Safety, /*await now*/ false> {
106106
using TaskWithExecutor = SafeTaskWithExecutor<Safety, T>;
107107
};
108108

109+
#else // no FOLLY_HAS_IMMOVABLE_COROUTINES
110+
111+
// This fallback is required because `coro::Future<SafeType>` is safe and is
112+
// available on earlier build systems. We have no choice but to emit `Task`.
113+
template <safe_alias Safety>
114+
struct PickTaskWrapperImpl<Safety, /*await now*/ false> {
115+
template <typename T>
116+
using Task = Task<T>;
117+
template <typename T>
118+
using TaskWithExecutor = TaskWithExecutor<T>;
119+
};
120+
109121
#endif // FOLLY_HAS_IMMOVABLE_COROUTINES
110122

111123
// Pass this as `AddWrapperMetaFn` to `PickTaskWrapper` to add `AsNoexcept`.

0 commit comments

Comments
 (0)