@@ -204,6 +204,12 @@ namespace STDEXEC
204204 return __completions_t {};
205205 }
206206
207+ [[nodiscard]]
208+ constexpr auto get_env () const noexcept
209+ {
210+ return __env{};
211+ }
212+
207213 private:
208214 using __on_stopped_t = __task::__on_stopped<stop_source_type>;
209215
@@ -221,6 +227,16 @@ namespace STDEXEC
221227 static constexpr bool __needs_stop_callback =
222228 __not_same_as<stop_token_type, stop_token_of_t <env_of_t <_Rcvr>>>;
223229
230+ struct __env
231+ {
232+ template <class _Tag >
233+ [[nodiscard]]
234+ constexpr auto query (__get_completion_behavior_t <_Tag>) const noexcept
235+ {
236+ return __completion_behavior::__asynchronous_affine;
237+ }
238+ };
239+
224240 struct __opstate_base
225241 {
226242 constexpr explicit __opstate_base (scheduler_type __sched) noexcept
@@ -291,7 +307,7 @@ namespace STDEXEC
291307 // If the receiver's stop token is different from the task's stop token, then we need
292308 // to set up a callback to request a stop on the task's stop source when the receiver's
293309 // stop token is triggered:
294- __stop_callback ().__construct (get_stop_token (get_env (__rcvr_)),
310+ __stop_callback ().__construct (get_stop_token (STDEXEC:: get_env (__rcvr_)),
295311 __on_stopped_t {__var::__get<0 >(__coro_.promise ().__stop_ )});
296312 }
297313 __coro_.resume ();
@@ -304,7 +320,7 @@ namespace STDEXEC
304320 {
305321 if constexpr (__std::constructible_from<__own_env_t , env_of_t <_Rcvr>>)
306322 {
307- return __own_env_t (get_env (__rcvr));
323+ return __own_env_t (STDEXEC:: get_env (__rcvr));
308324 }
309325 else
310326 {
@@ -320,7 +336,7 @@ namespace STDEXEC
320336 }
321337 else if constexpr (__std::constructible_from<_Env, env_of_t <_Rcvr>>)
322338 {
323- return _Env (get_env (__rcvr));
339+ return _Env (STDEXEC:: get_env (__rcvr));
324340 }
325341 else
326342 {
@@ -330,9 +346,9 @@ namespace STDEXEC
330346
331347 static auto __mk_sched (_Rcvr const & __rcvr) noexcept -> scheduler_type
332348 {
333- if constexpr (requires { scheduler_type (get_scheduler (get_env (__rcvr))); })
349+ if constexpr (requires { scheduler_type (get_scheduler (STDEXEC:: get_env (__rcvr))); })
334350 {
335- return scheduler_type (get_scheduler (get_env (__rcvr)));
351+ return scheduler_type (get_scheduler (STDEXEC:: get_env (__rcvr)));
336352 }
337353 else
338354 {
@@ -398,11 +414,12 @@ namespace STDEXEC
398414 STDEXEC::set_stopped (static_cast <_Rcvr&&>(__rcvr_));
399415 }
400416
417+ [[nodiscard]]
401418 auto __get_allocator () noexcept -> allocator_type final
402419 {
403- if constexpr (requires { allocator_type (get_allocator (get_env (__rcvr_))); })
420+ if constexpr (requires { allocator_type (get_allocator (STDEXEC:: get_env (__rcvr_))); })
404421 {
405- return allocator_type (get_allocator (get_env (__rcvr_)));
422+ return allocator_type (get_allocator (STDEXEC:: get_env (__rcvr_)));
406423 }
407424 else
408425 {
@@ -457,6 +474,7 @@ namespace STDEXEC
457474 }
458475 }
459476
477+ [[nodiscard]]
460478 auto unhandled_stopped () noexcept -> __std::coroutine_handle<>
461479 {
462480 __state_->__canceled ();
0 commit comments