Repository navigation
Check a type-erased query by calling it - #2364
Merged
Merged
Conversation
ericniebler
approved these changes
Oct 26, 2026
Collaborator
|
/ok to test 13c8af9 |
ericniebler
force-pushed
the
function-requires-stop-token
branch
from
October 26, 2026 23:46
13c8af9 to
06e17e9
Compare
Collaborator
|
i've merged #2361. are changes needed to this PR? |
ispeters
force-pushed
the
function-requires-stop-token
branch
from
October 27, 2026 00:38
06e17e9 to
91a54e7
Compare
Contributor
Author
Collaborator
|
/ok to test 91a54e7 |
ericniebler
force-pushed
the
function-requires-stop-token
branch
from
October 28, 2026 19:44
91a54e7 to
c352ed3
Compare
Collaborator
|
/ok to test c352ed3 |
ispeters
force-pushed
the
function-requires-stop-token
branch
from
October 29, 2026 02:27
c352ed3 to
4c98219
Compare
A type-erased receiver answers a declared query `R(Q, Args...)` by calling `Q()(get_env(rcvr), args...)` on the wrapped receiver's environment, but type erasure checks something narrower: whether the environment has a `query` member for `Q`. The two differ for a query with a default answer. For example, `get_domain(env)` answers `default_domain` for an environment with no `get_domain` member, so an `exec::any_sender` or `exec::function` declaring `default_domain(get_domain_t) noexcept` can answer the query in such an environment, but can't be connected there. This diff checks the call instead: the environment satisfies a declared query when calling the query object on it is well-formed, converts to the declared result type and, if the declaration is `noexcept`, isn't potentially throwing. For the standard queries, the two checks agree wherever the environment has its own `query` member, so every environment accepted before is still accepted; what's new is that a query's default answer now counts. Only `get_domain` and `get_stop_token` have one, and `any_sender`'s existing special cases for `get_stop_token` still decide those declarations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ispeters
force-pushed
the
function-requires-stop-token
branch
from
October 30, 2026 02:34
4c98219 to
0efe8bf
Compare
Collaborator
|
/ok to test 0efe8bf |
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.
A type-erased receiver answers a declared query
R(Q, Args...)by callingQ()(get_env(rcvr), args...)on the wrapped receiver's environment, but type erasure checks something narrower: whether the environment has aquerymember forQ. The two differ for a query with a default answer. For example,get_domain(env)answersdefault_domainfor an environment with noget_domainmember, so anexec::any_senderorexec::functiondeclaringdefault_domain(get_domain_t) noexceptcan answer the query in such an environment, but can't be connected there.This diff checks the call instead: the environment satisfies a declared query when calling the query object on it is well-formed, converts to the declared result type and, if the declaration is
noexcept, isn't potentially throwing. For the standard queries, the two checks agree wherever the environment has its ownquerymember, so every environment accepted before is still accepted; what's new is that a query's default answer now counts. Onlyget_domainandget_stop_tokenhave one, andany_sender's existing special cases forget_stop_tokenstill decide those declarations.