Repository navigation
Say so when a sender adaptor closure is used as a sender - #2378
Open
veljjanoski wants to merge 1 commit into
Open
veljjanoski wants to merge 1 commit into
veljjanoski wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Part of #709.
What
Passing a sender adaptor closure where a sender is expected, for example
gives the generic message that the type is not a sender because
enable_senderis false, with advice to add asender_conceptor specializeenable_sender. That advice does not help here. This PR adds a branch for closures to__diagnose_sender_concept_failure. With Clang 21:It also adds the missing space in the existing message (
enable_sender<Sender>is false).The check is a small concept in
__detail, not the existing__sender_adaptor_closure. That header includes__sender_concepts.hpp(through__completion_signatures_of.hpp), so it cannot be included here. A concept is also needed becausesender_adaptor_closure<T>only accepts class types: with a plainif constexpr,sync_wait(42)would become a hard error. The branch only runs whenenable_senderis false, so a type that is both a closure and a sender is not affected.Not covered, hence "part of":
sync_wait(stdexec::then). There is no common trait for adaptor objects, so it still gets the generic message.stdexec::then(closure, f)orspawn(closure, token). These fail the algorithm's ownsenderconstraint before this diagnostic runs.Verification
Docker (Debian 12), GCC 12.2 and Clang 21.1 with libstdc++ 12. The message for
sync_wait(x):xconst, composedthen(f) | then(g)enable_sendermessagesender_adaptor_closure42,stdexec::thenValid uses still build and run:
just(1) | closure, and a sequence throughexec::iterate | exec::ignore_all_values().test.stdexecandtest.exec(Debug) build and pass with both compilers: 644 and 454 test cases with Clang, 643 and 454 with GCC. clang-format 21 is clean.There is no new test, because the repo has no compile-fail test support yet (#1260).
AI-usage disclosure: Claude (Anthropic) was used as assistant.