Skip to content

Commit d9e7aa5

Browse files
hchokshifacebook-github-bot
authored andcommitted
Replace direct usages of std coroutines with folly::coro in folly::result
Summary: Fixes compile errors when coroutines are under `experimental` in the active compiler. Reviewed By: praihan Differential Revision: D79929244 fbshipit-source-id: 8088e31088a85c2714c3300fd6fc3c9f97d3dae9
1 parent 2e821ce commit d9e7aa5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

folly/result/BUCK

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ non_fbcode_target(
4646
"//xplat/folly:expected",
4747
"//xplat/folly:operation_cancelled",
4848
"//xplat/folly:portability_gtest_prod",
49+
"//xplat/folly/coro:coroutine",
4950
"//xplat/folly/lang:align",
5051
"//xplat/folly/lang:rvalue_reference_wrapper",
5152
],
@@ -63,6 +64,7 @@ fbcode_target(
6364
"//folly:exception_wrapper",
6465
"//folly:expected",
6566
"//folly:operation_cancelled",
67+
"//folly/coro:coroutine",
6668
"//folly/lang:align",
6769
"//folly/lang:rvalue_reference_wrapper",
6870
"//folly/portability:gtest_prod",

folly/result/result.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <folly/ExceptionWrapper.h>
2020
#include <folly/Expected.h>
2121
#include <folly/OperationCancelled.h>
22+
#include <folly/coro/Coroutine.h>
2223
#include <folly/lang/Align.h> // for `hardware_constructive_interference_size`
2324
#include <folly/lang/RValueReferenceWrapper.h>
2425
#include <folly/portability/GTestProd.h>
@@ -739,10 +740,10 @@ struct result_promise_base {
739740
void operator=(result_promise_base&&) = delete;
740741
~result_promise_base() = default;
741742

742-
FOLLY_NODISCARD std::suspend_never initial_suspend() const noexcept {
743+
FOLLY_NODISCARD folly::coro::suspend_never initial_suspend() const noexcept {
743744
return {};
744745
}
745-
FOLLY_NODISCARD std::suspend_never final_suspend() const noexcept {
746+
FOLLY_NODISCARD folly::coro::suspend_never final_suspend() const noexcept {
746747
return {};
747748
}
748749
void unhandled_exception() noexcept {
@@ -778,7 +779,7 @@ struct result_promise<T, typename std::enable_if<std::is_void_v<T>>::type>
778779
};
779780

780781
template <typename T>
781-
using result_promise_handle = std::coroutine_handle<result_promise<T>>;
782+
using result_promise_handle = folly::coro::coroutine_handle<result_promise<T>>;
782783

783784
// This is separate to let `result_generator` reuse the awaitables below.
784785
struct result_await_suspender {

0 commit comments

Comments
 (0)