Repository navigation
test: pin read_env's completion-behavior claims for get_scheduler() (#2098) - #2338
ericniebler merged 3 commits into
Conversation
…VIDIA#2098) read_env may advertise inline completion only for the completion tags it can actually send. When it advertised more than that, a task co_awaiting get_scheduler() | let_value(schedule) was classified as completing inline, so the awaiter kept the composed operation state in its own stack frame while a nested schedule() operation was still queued. Assert that get_scheduler() claims inline completion for set_value_t alone, and that the composed expression is not treated as completing inline.
9acb47c to
ed4cb1d
Compare
|
/ok to test ed4cb1d |
…completion-behavior
|
Updated the branch with main to get a clean CI signal. Should be ready to go once the workflow approval clears. |
|
/ok to test 74c6e71 |
…heck
The final assertion named ex::__as_awaitable::__completes_inline, which is not
part of the stdexec module's exported surface: the clang-trunk modules build
rejected the name ("must be declared before it is used") and nvc++ could not
resolve the namespace at all ("name followed by '::' must be a class or
namespace name"), failing 4 CI configurations.
Replace it with assertions on the exported per-tag concept: the composition's
set_value_t completes inline (let_value forwards read_env's inline value
completion), while its set_stopped_t does not (the nested schedule()
completes asynchronously), so a co_await on it must not be treated as
completing inline. Both hold on current main and fail at 482c260.
|
All four failures traced to the last assertion, which named Pushed |
|
/ok to test 4e6d5b8 |
A regression guard for the co_await path in #2098.
read_envmay advertise inline completion only for the completion tags it canactually send. It advertised more than that before
9a301946, so a task thatco_awaits
was classified as completing inline. The awaiter then kept the composed
operation state in its own stack frame while a nested
schedule()operation wasstill queued, which is the lifetime bug reported in #2098.
These assertions pin the current behaviour:
get_scheduler()claims inline completion forset_value_t—read_envcompletes in its
start();set_error_torset_stopped_t, which it never sends;set_value_t—let_valueforwards
read_env's inline value completion — but not forset_stopped_t(the nested
schedule()completes asynchronously), which is what keeps aco_awaiton it from being treated as completing inline.All hold on current main and fail at
482c2605, so a regression of thecompletion-behaviour claim is caught at compile time rather than as a crash.
Type-level rather than a runtime test, so it needs no sanitizer to be
deterministic.
The composition is asserted with the exported per-tag
__completes_inlineconcept rather than
__as_awaitable::__completes_inline: the latter is not partof the
std.execmodule's exported surface (the modular build rejects the name,and nvc++ cannot resolve the namespace), while the exported concept is used the
same way elsewhere in the test suite. It still discriminates the composition
from the buggy state, since the stopped tag is what moves there.
Since inline completion under
co_awaitrequires every tag to complete inline,the single-tag form of the exported concept is sufficient to pin the
composition; the two
read_envclaims and the composition's tags are checkedseparately so a failure says which one moved.
Built and run with Apple clang 21,
-std=c++20, in both configurations:test.stdexecpasses 630 test cases / 50088 assertions with and withoutSTDEXEC_ENABLE_EXTRA_TYPE_CHECKINGagainst the current base, no new warnings,clang-format clean.