Skip to content

Commit a678007

Browse files
committed
Address self-review comments
* Fix up the description of what's done in `unhandled_stop` * Take @ericniebler's suggestion and make it explicitly UB for the `coroutine_handle` returned from `await_suspend` to throw from `resume()`.
1 parent 4f59b3c commit a678007

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

include/stdexec/__detail/__connect_awaitable.hpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ namespace STDEXEC
169169
{
170170
__opstate_.__on_stopped();
171171
// Returning noop_coroutine here causes the __connect_awaitable
172-
// coroutine to never resume past the point where it co_await's
173-
// the awaitable.
172+
// coroutine to never resume past its initial_suspend point
174173
return __std::noop_coroutine();
175174
}
176175

@@ -251,7 +250,17 @@ namespace STDEXEC
251250
{
252251
static_assert(__std::convertible_to<__suspend_result_t, __std::coroutine_handle<>>);
253252
auto __resume_target = __awaiter_.await_suspend(__coro_);
254-
__resume_target.resume();
253+
STDEXEC_TRY
254+
{
255+
__resume_target.resume();
256+
}
257+
STDEXEC_CATCH_ALL
258+
{
259+
STDEXEC_ASSERT(false
260+
&& "about to deliberately commit UB in response to a misbehaving "
261+
"awaitable");
262+
__std::unreachable();
263+
}
255264
return;
256265
}
257266
}

0 commit comments

Comments
 (0)