Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop support for P2300R5-style senders and receivers #1132

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions include/exec/__detail/__sender_facade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ namespace exec {
__declval<__data_placeholder&>(),
__declval<__receiver_placeholder<_Env>&>()));

struct __dependent_sender {
using is_sender = void;
using __t = __dependent_sender;
friend auto tag_invoke(get_completion_signatures_t, __dependent_sender, no_env)
-> dependent_completion_signatures<no_env>;
};

struct __sender_transform_failed {
using __t = __sender_transform_failed;
};
Expand All @@ -109,8 +102,6 @@ namespace exec {
} else {
if constexpr (__mvalid<__tfx_sender_, _Kernel, _Sender, _Env>) {
return __mtype<__tfx_sender_<_Kernel, _Sender, _Env>>{};
} else if constexpr (same_as<_Env, no_env>) {
return __dependent_sender{};
} else {
return __sender_transform_failed{};
}
Expand All @@ -120,7 +111,6 @@ namespace exec {

template <class _Kernel, class _Sender, class _Data, class _Receiver>
auto __transform_sender(_Kernel& __kernel, _Sender&& __sndr, _Data& __data, _Receiver& __rcvr) {
static_assert(!same_as<env_of_t<_Receiver>, no_env>);
if constexpr (__lacks_transform_sender<_Kernel>) {
return (_Sender&&) __sndr;
} else {
Expand All @@ -141,11 +131,7 @@ namespace exec {
__declval<_As>()...));

template <class _Kernel, class _Env>
using __get_env_ = decltype(__declval<_Kernel&>().get_env(__declval<_Env>()));

template <class _Kernel, class _Env>
using __env_t =
__minvoke< __if_c<same_as<_Env, no_env>, __mconst<no_env>, __q<__get_env_>>, _Kernel, _Env>;
using __env_t = decltype(__declval<_Kernel&>().get_env(__declval<_Env>()));

template <class _Kernel, class _Env, class _Tag, class... _As>
auto __completions_from_sig(_Tag (*)(_As...))
Expand Down Expand Up @@ -312,19 +298,13 @@ namespace exec {
__completions_t<_NewEnv, __pre_completions_t<_NewSender, _NewEnv>>;
if constexpr (__valid_completion_signatures<_Completions, _Env>) {
return (_Completions(*)()) nullptr;
} else if constexpr (same_as<no_env, _Env>) {
return (dependent_completion_signatures<no_env>(*)()) nullptr;
} else {
// assume this is an error message and return it directly
return (_Completions(*)()) nullptr;
}
} else if constexpr (same_as<no_env, _Env>) {
return (dependent_completion_signatures<no_env>(*)()) nullptr;
} else {
return (__diagnostic_t<_Env>(*)()) nullptr;
}
} else if constexpr (same_as<no_env, _Env>) {
return (dependent_completion_signatures<no_env>(*)()) nullptr;
} else if constexpr (same_as<_NewSender, __sender_transform_failed>) {
return (__diagnostic_t<_Env>(*)()) nullptr;
} else {
Expand Down
1 change: 1 addition & 0 deletions include/exec/any_sender_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ namespace exec {
using _Receiver = stdexec::__t<_ReceiverId>;

struct __t {
using is_receiver = void;
__operation_base<_Receiver>* __op_;

template <same_as<set_next_t> _SetNext, same_as<__t> _Self, class _Item>
Expand Down
2 changes: 1 addition & 1 deletion include/exec/env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace exec {
return {{}, ((_Self&&) __self).__default_, (_Receiver&&) __rcvr};
}

template <__none_of<no_env> _Env>
template <class _Env>
friend auto tag_invoke(get_completion_signatures_t, __sender, _Env&&)
-> __completions_t<_Env> {
return {};
Expand Down
2 changes: 1 addition & 1 deletion include/exec/finally.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ namespace exec {
(_Rec&&) __receiver};
}

template <__decays_to<__t> _Self, __none_of<no_env> _Env>
template <__decays_to<__t> _Self, class _Env>
friend auto tag_invoke(get_completion_signatures_t, _Self&&, _Env&&) noexcept
-> __completion_signatures_t<
__copy_cvref_t<_Self, _InitialSender>,
Expand Down
6 changes: 3 additions & 3 deletions include/exec/sequence/any_sequence_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace exec {
namespace __any {
namespace __next {
template <__is_completion_signatures _Sigs>
template <__valid_completion_signatures _Sigs>
struct __rcvr_next_vfun {
using __return_sigs = completion_signatures<set_value_t(), set_stopped_t()>;
using __void_sender = typename any_receiver_ref<__return_sigs>::template any_sender<>;
Expand All @@ -37,7 +37,7 @@ namespace exec {
template <class _Sigs>
using __item_sender = typename any_receiver_ref<_Sigs>::template any_sender<>;

template <__is_completion_signatures _Sigs>
template <__valid_completion_signatures _Sigs>
constexpr __void_sender (*operator()(_Sigs*) const)(void*, __item_sender<_Sigs>&&) {
return +[](void* __r, __item_sender<_Sigs>&& __sndr) noexcept -> __void_sender {
return __void_sender{
Expand Down Expand Up @@ -295,7 +295,7 @@ namespace exec {
template <
std::same_as<exec::set_next_t> _SetNext,
std::same_as<__t> _Self,
stdexec::__sender _Sender>
stdexec::sender _Sender>
requires stdexec::__callable<set_next_t, _Self&, _Sender>
friend auto tag_invoke(_SetNext, _Self& __self, _Sender&& __sender) {
return exec::set_next(__self.__receiver_, static_cast<_Sender&&>(__sender));
Expand Down
15 changes: 3 additions & 12 deletions include/exec/sequence_senders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace exec {
using _Result = __member_alias_t<_TfxSender, _Env>;
return (_Result(*)()) nullptr;
} else if constexpr (
sender<_TfxSender, _Env> && !enable_sequence_sender<stdexec::__decay_t<_TfxSender>>) {
sender_in<_TfxSender, _Env> && !enable_sequence_sender<stdexec::__decay_t<_TfxSender>>) {
using _Result = item_types<stdexec::__decay_t<_TfxSender>>;
return (_Result(*)()) nullptr;
} else if constexpr (__is_debug_env<_Env>) {
Expand Down Expand Up @@ -194,8 +194,8 @@ namespace exec {
decltype(get_item_types(stdexec::__declval<_Sender>(), stdexec::__declval<_Env>()));

template <class _Sender, class _Env>
concept sequence_sender = //
stdexec::sender<_Sender, _Env> && //
concept sequence_sender = //
stdexec::sender_in<_Sender, _Env> && //
enable_sequence_sender<stdexec::__decay_t<_Sender>>;

template <class _Sender, class _Env>
Expand Down Expand Up @@ -333,15 +333,6 @@ namespace exec {
__nothrow_callable<get_env_t, _Receiver&>
&& __nothrow_callable<transform_sender_t, _Domain, _Sender, env_of_t<_Receiver&>>;
using _TfxSender = __tfx_sndr<_Sender, _Receiver>;
if constexpr (!enable_sender<__decay_t<_Sender>>)
__connect::_PLEASE_UPDATE_YOUR_SENDER_TYPE<__decay_t<_Sender>>();

if constexpr (!enable_sender<__decay_t<_TfxSender>>)
__connect::_PLEASE_UPDATE_YOUR_SENDER_TYPE<__decay_t<_TfxSender>>();

if constexpr (!enable_receiver<__decay_t<_Receiver>>)
__connect::_PLEASE_UPDATE_YOUR_RECEIVER_TYPE<__decay_t<_Receiver>>();

if constexpr (__next_connectable_with_tag_invoke<_TfxSender, _Receiver>) {
using _Result = tag_invoke_result_t<
connect_t,
Expand Down
2 changes: 1 addition & 1 deletion include/exec/when_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace exec {
try {
__result_.emplace(std::tuple{_CPO{}, (_Args&&) __args...});
} catch (...) {
__result_.emplace(set_error_t{}, std::current_exception());
__result_.emplace(std::tuple{set_error_t{}, std::current_exception()});
}
}
// stop pending operations
Expand Down
2 changes: 1 addition & 1 deletion include/nvexec/stream/sync_wait.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { namespace _sync_wait {
using receiver_t = stdexec::__t<receiver_t<stdexec::__id<Sender>>>;

template <__single_value_variant_sender<__env> Sender>
requires sender<Sender, __env> && __receiver_from<receiver_t<Sender>, Sender>
requires sender_in<Sender, __env> && __receiver_from<receiver_t<Sender>, Sender>
auto operator()(context_state_t context_state, Sender&& __sndr) const
-> std::optional<sync_wait_result_t<Sender>> {
using state_t = state_t<stdexec::__id<Sender>>;
Expand Down
13 changes: 10 additions & 3 deletions include/nvexec/stream/when_all.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
template <class...>
using swallow_values = completion_signatures<>;

template <class Sender, class Env>
using too_many_completions = __mbool<(1 < __v<__count_of<set_value_t, Sender, Env>>)>;

template <class Env, class... Senders>
struct completions {
using __t = dependent_completion_signatures<Env>;
using InvalidArg = //
__minvoke<
__mfind_if<__mbind_back_q<too_many_completions, Env>, __q<__mfront>>,
Senders...>;

using __t = stdexec::__when_all::__too_many_value_completions_error<InvalidArg, Env>;
};

template <class... As, class TupleT>
Expand All @@ -59,11 +67,10 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS {
}

template <class Env, class... Senders>
requires((__v<__count_of<set_value_t, Senders, Env>> <= 1) && ...)
requires (!__v<too_many_completions<Senders, Env>> &&...)
struct completions<Env, Senders...> {
using non_values = //
__concat_completion_signatures_t<

completion_signatures< set_error_t(cudaError_t), set_stopped_t()>,
__try_make_completion_signatures<
Senders,
Expand Down
2 changes: 1 addition & 1 deletion include/stdexec/__detail/__meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ namespace stdexec {
struct _BAD_SUBSTITUTION_ { };

template <class... _Args>
struct _WITH_TYPES_ { };
struct _WITH_TYPES_;

template <template <class...> class _Fun>
struct _WITH_META_FUNCTION_T_ {
Expand Down
22 changes: 13 additions & 9 deletions include/stdexec/__detail/__p2300.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ namespace std {
using stop_token_of_t STDEXEC_STD_DEPRECATED = stdexec::stop_token_of_t<_StopTokenProvider>;

// [exec.env], execution environments
using no_env STDEXEC_STD_DEPRECATED = stdexec::no_env;
struct __no_env {};
using no_env STDEXEC_STD_DEPRECATED = __no_env;
using get_env_t STDEXEC_STD_DEPRECATED = stdexec::get_env_t;
//using forwarding_env_query_t STDEXEC_STD_DEPRECATED = stdexec::forwarding_env_query_t; // BUGBUG
STDEXEC_STD_DEPRECATED
Expand Down Expand Up @@ -138,44 +139,47 @@ namespace std {
inline constexpr stdexec::start_t start{};

// [exec.snd], senders
template <class _Sender, class _Env = stdexec::no_env>
template <class _Sender, class _Env = __no_env>
concept sender /*STDEXEC_STD_DEPRECATED*/ = stdexec::sender_in<_Sender, _Env>;

template <class _Sender, class _Receiver>
concept sender_to /*STDEXEC_STD_DEPRECATED*/ = stdexec::sender_to<_Sender, _Receiver>;

template <class _Sender, class _SetSig, class _Env = stdexec::no_env>
template <class _Sender, class _SetSig, class _Env = __no_env>
concept sender_of /*STDEXEC_STD_DEPRECATED*/ = stdexec::sender_of<_Sender, _SetSig, _Env>;

// [exec.sndtraits], completion signatures
using get_completion_signatures_t STDEXEC_STD_DEPRECATED = stdexec::get_completion_signatures_t;
STDEXEC_STD_DEPRECATED
inline constexpr stdexec::get_completion_signatures_t get_completion_signatures{};

template <class _Sender, class _Env = stdexec::no_env>
template <class _Sender, class _Env = __no_env>
using completion_signatures_of_t STDEXEC_STD_DEPRECATED =
stdexec::completion_signatures_of_t<_Sender, _Env>;

template <class _Env>
struct __dependent_completion_signatures { };

template <class _Env>
using dependent_completion_signatures STDEXEC_STD_DEPRECATED =
stdexec::dependent_completion_signatures<_Env>;
__dependent_completion_signatures<_Env>;

template < //
class _Sender, //
class _Env = stdexec::no_env, //
class _Env = __no_env, //
template <class...> class _Tuple = stdexec::__decayed_tuple, //
template <class...> class _Variant = stdexec::__variant>
using value_types_of_t STDEXEC_STD_DEPRECATED =
stdexec::value_types_of_t<_Sender, _Env, _Tuple, _Variant>;

template < //
class _Sender, //
class _Env = stdexec::no_env, //
class _Env = __no_env, //
template <class...> class _Variant = stdexec::__variant>
using error_types_of_t STDEXEC_STD_DEPRECATED =
stdexec::error_types_of_t<_Sender, _Env, _Variant>;

template <class _Sender, class _Env = stdexec::no_env>
template <class _Sender, class _Env = __no_env>
STDEXEC_STD_DEPRECATED inline constexpr bool sends_stopped =
stdexec::sends_stopped<_Sender, _Env>;

Expand Down Expand Up @@ -295,7 +299,7 @@ namespace std {
// [exec.utils.mkcmplsigs]
template < //
class _Sender, //
class _Env = stdexec::no_env,
class _Env = __no_env,
class _Sigs = stdexec::completion_signatures<>, //
template <class...> class _SetValue = stdexec::__compl_sigs::__default_set_value, //
template <class> class _SetError = stdexec::__compl_sigs::__default_set_error, //
Expand Down
Loading