Fix run_loop sender's zero-environment completion signatures - #321
Open
steve-downey wants to merge 1 commit into
Open
steve-downey wants to merge 1 commit into
steve-downey wants to merge 1 commit into
Conversation
`run_loop::sender::get_completion_signatures<Self, Env...>()` evaluates
`get_stop_token(std::declval<Env>()...)`. For an empty `Env` pack that is
`get_stop_token()` with no argument, which is ill-formed. Because the
member's return type is deduced, determining the type of the call requires
instantiating the body, so the error is not in the immediate context: it is
a hard error rather than a substitution failure.
[exec.getcomplsigs] constrains `sizeof...(Env) <= 1`, so the
zero-environment query is well-formed and has to be answered. Two
consequences of it not being:
* `get_completion_signatures<decltype(schedule(sched))>()` fails to
compile.
* `dependent_sender` is itself spelled in terms of that query inside a
requires-expression, so `dependent_sender<run-loop-sender>` is
ill-formed rather than false -- and every algorithm that reaches for
it fails with it. `when_all` over two `run_loop` senders does not
compile today for this reason.
Answer the empty pack as for `env<>`. That is what [exec.run.loop]'s own
formula gives for `E = env<>`, whose stop token is unstoppable, and it is
how the other environment-sensitive senders here already handle the empty
pack -- `then_t` and `into_variant_t` both carry
template <typename Sender>
struct get_signatures<Sender> : get_signatures<Sender, env<>> {};
The header branch also gains `#include <detail/env.hpp>`; the modules
branch already imported `beman.execution.detail.env`.
Both new assertions in `exec-run-loop-types.test.cpp` fail to compile
against the unfixed header, which is what makes them a regression test
rather than a restatement.
steve-downey
commented
Sep 21, 2026
| static consteval auto get_completion_signatures() noexcept { | ||
| if constexpr (::beman::execution::unstoppable_token<decltype(::beman::execution::get_stop_token( | ||
| std::declval<Env>()...))>) | ||
| // [exec.getcomplsigs] permits sizeof...(Env) == 0. Answering that |
Member
Author
There was a problem hiding this comment.
This amount of comment is probably not actually warranted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
run_loop::sender::get_completion_signatures<Self, Env...>()evaluatesget_stop_token(std::declval<Env>()...). For an emptyEnvpack that isget_stop_token()with no argument, which is ill-formed. Because the member's return type is deduced, determining the type of the call requires instantiating the body, so the error is not in the immediate context: it is a hard error rather than a substitution failure.[exec.getcomplsigs] constrains
sizeof...(Env) <= 1, so the zero-environment query is well-formed and has to be answered. Two consequences of it not being:get_completion_signatures<decltype(schedule(sched))>()fails to compile.dependent_senderis itself spelled in terms of that query inside a requires-expression, sodependent_sender<run-loop-sender>is ill-formed rather than false -- and every algorithm that reaches for it fails with it.when_allover tworun_loopsenders does not compile today for this reason.Answer the empty pack as for
env<>. That is what [exec.run.loop]'s own formula gives forE = env<>, whose stop token is unstoppable, and it is how the other environment-sensitive senders here already handle the empty pack --then_tandinto_variant_tboth carryThe header branch also gains
#include <detail/env.hpp>; the modules branch already importedbeman.execution.detail.env.Both new assertions in
exec-run-loop-types.test.cppfail to compile against the unfixed header, which is what makes them a regression test rather than a restatement.