-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Description
a new implementation of get_completion_signatures that improves diagnostics #1811
This new implementation uses __throw_compile_error in the evaluation of __completion_signatures_of_t which prevents concepts that use __completion_signatures_of_t from evaluating to false.
I added a static_assert to the __throw_compile_error impl for when constexpr exceptions are not supported by the compiler.
Some errors I think are correct and require changes to the tests - for instance:
[path]/stdexec/test/stdexec/concepts/test_concepts_sender.cpp:302:28: note: in instantiation of function template specialization '(anonymous namespace)::test_subsumption<std::execution::(anonymous namespace)::__sexpr<std::execution::(lambda at [path]/stdexec/include/stdexec/__detail/__basic_sender.hpp:56:53){}>>' requested here
[path]/stdexec/include/stdexec/__detail/__completion_signatures.hpp:89:19: note: because '__mexception<_THE_CURRENT_EXECUTION_ENVIRONMENT_DOESNT_HAVE_A_VALUE_FOR_THE_GIVEN_QUERY_, _WHERE_ (_IN_ALGORITHM_, read_env_t), _WITH_QUERY_ (get_scheduler_t), _WITH_ENVIRONMENT_ (env<>)>' (aka '_ERROR_<std::execution::__read::_THE_CURRENT_EXECUTION_ENVIRONMENT_DOESNT_HAVE_A_VALUE_FOR_THE_GIVEN_QUERY_, std::execution::_WHERE_ (std::execution::_IN_ALGORITHM_, std::execution::__read::read_env_t), std::execution::_WITH_QUERY_ (std::execution::__queries::get_scheduler_t), std::execution::_WITH_ENVIRONMENT_ (std::execution::__env::env<>)>') does not satisfy '__ok'Some errors I think are spurious and require changes to the implementation of get_completion_signatures - for instance:
Spurious Error Example
FAILED: [code=1] test/CMakeFiles/test.stdexec.dir/stdexec/algos/factories/test_read.cpp.o
/usr/bin/c++ -DSTDEXEC_ENABLE_LIBDISPATCH -DSTDEXEC_NAMESPACE=std::execution -I[path]/stdexec/include -I[path]/stdexec/build-m1/include -I[path]/stdexec/build-m1/_deps/catch2-src/single_include -I[path]/stdexec/test -O3 -DNDEBUG -std=gnu++2b -arch arm64 -Wall -Werror=unused-parameter -ferror-limit=0 -fmacro-backtrace-limit=0 -ftemplate-backtrace-limit=0 -MD -MT test/CMakeFiles/test.stdexec.dir/stdexec/algos/factories/test_read.cpp.o -MF test/CMakeFiles/test.stdexec.dir/stdexec/algos/factories/test_read.cpp.o.d -o tes
t/CMakeFiles/test.stdexec.dir/stdexec/algos/factories/test_read.cpp.o -c [path]/stdexec/test/stdexec/algos/factories/test_read.cpp
In file included from [path]stdexec/test/stdexec/algos/factories/test_read.cpp:16:
In file included from [path]stdexec/include/stdexec/execution.hpp:22:
In file included from [path]stdexec/include/stdexec/__detail/__as_awaitable.hpp:21:
In file included from [path]stdexec/include/stdexec/__detail/__completion_signatures_of.hpp:21:
In file included from [path]stdexec/include/stdexec/__detail/__debug.hpp:20:
[path]/stdexec/include/stdexec/__detail/__completion_signatures.hpp:89:19: error: static assertion failed: compile-time error..
89 | static_assert(__ok<__mexception<_What...>>, "compile-time error..");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[path]/stdexec/include/stdexec/__detail/__completion_signatures.hpp:125:21: note: in instantiation of function template specialization 'std::execution::__throw_compile_time_error<std::execution::dependent_sender_error, std::execution::_WITH_SENDER_<std::execution::__basic_sender<std::execution::__read::read_env_t, std::execution::__queries::get_allocator_t>>>' requested here
125 | return STDEXEC::__throw_compile_time_error<_What...>();
| ^
[path]/stdexec/include/stdexec/__detail/__get_completion_signatures.hpp:76:25: note: in instantiation of function template specialization 'std::execution::__throw_compile_time_error<std::execution::dependent_sender_error, std::execution::_WITH_SENDER_<std::execution::__basic_sender<std::execution::__read::read_env_t, std::execution::__queries::get_allocator_t>>>' requested here
76 | return STDEXEC::__throw_compile_time_error(_Completions());
| ^
[path]/stdexec/include/stdexec/__detail/__get_completion_signatures.hpp:172:16: note: in instantiation of function template specialization 'std::execution::__cmplsigs::__checked_complsigs<std::execution::_ERROR_<std::execution::dependent_sender_error, std::execution::_WITH_SENDER_<std::execution::__basic_sender<std::execution::__read::read_env_t, std::execution::__queries::get_allocator_t>>>, std::execution::(anonymous namespace)::__sexpr<std::execution::(lambda at [path]/stdexec/include/stdexec/__detail/__basic_sender.hpp:56:53){}>>' requested here
172 | return STDEXEC_CHECKED_COMPLSIGS((_Sender), STDEXEC_GET_COMPLSIGS(_Sender));
| ^
[path]stdexec/include/stdexec/__detail/__get_completion_signatures.hpp:61:24: note: expanded from macro 'STDEXEC_CHECKED_COMPLSIGS'
61 | STDEXEC::__cmplsigs::__checked_complsigs( \
|
[path]stdexec/include/stdexec/__detail/__get_completion_signatures.hpp:237:24: note: in instantiation of function template specialization 'std::execution::__cmplsigs::__get_completion_signatures_helper<std::execution::(anonymous namespace)::__sexpr<std::execution::(lambda at [path]/stdexec/include/stdexec/__detail/__basic_sender.hpp:56:53){}>>' requested here
237 | return __cmplsigs::__get_completion_signatures_helper<_Sender>();
| ^
[path]stdexec/include/stdexec/__detail/__sender_concepts.hpp:62:50: note: in instantiation of function template specialization 'std::execution::get_completion_signatures<std::execution::(anonymous namespace)::__sexpr<std::execution::(lambda at [path]/stdexec/include/stdexec/__detail/__basic_sender.hpp:56:53){}>>' requested here
62 | && __constant_completion_signatures<STDEXEC::get_completion_signatures<_Sender, _En
v...>()>;
| ^
[path]stdexec/include/stdexec/__detail/__sender_concepts.hpp:62:8: note: while substituting template arguments into constraint expression here
62 | && __constant_completion_signatures<STDEXEC::get_completion_signatures<_Sender, _En
v...>()>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[path]stdexec/test/stdexec/algos/factories/test_read.cpp:30:20: note: while checking the satisfaction of concept 'sender_in<std::execution::(anonymous namespace)::__sexpr<std::execution::(lambda at [path]/stdexec/include/stdexec/__detail/__basic_sender.hpp:56:53){}>>' requested here
30 | static_assert(!ex::sender_in<Sndr>);
| ^~~~~~~~~~~~~~~~~~~
[path]stdexec/include/stdexec/__detail/__completion_signatures.hpp:89:19: note: because '__mexception<dependent_sender_error, _WITH_SENDER_<__basic_sender<read_env_t, get_allocator_t>>>' (aka '_ERROR_<std::execution::dependent_sender_error, std::execution::_WITH_SENDER_<std::execution::__basic_sender<std::execution::__read::read_env_t, std::execution::__queries::get_allocator_t>>>') does not satisfy '__ok'
89 | static_assert(__ok<__mexception<_What...>>, "compile-time error..");
| ^
[path]stdexec/include/stdexec/__detail/__meta.hpp:201:18: note: because '__is_same(__ok_t<_ERROR_<dependent_sender_error, _WITH_SENDER_<__basic_sender<read_env_t, get_allocator_t> > > >, __msuccess)' evaluated to false
201 | concept __ok = STDEXEC_IS_SAME(__ok_t<_Arg>, __msuccess);
| ^
[path]stdexec/include/stdexec/__detail/__config.hpp:425:32: note: expanded from macro 'STDEXEC_IS_SAME'
425 | # define STDEXEC_IS_SAME(...) __is_same(__VA_ARGS__)
| ^
1 error generated.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels