adds assert messages to std.concurrency

* Nicholas review
This commit is contained in:
Robert Schadek 2019-08-15 08:49:55 +01:00
parent 2ae3bb1408
commit 2b9e5377f1

View file

@ -184,9 +184,12 @@ private
void checkops(T...)(T ops)
{
import std.format : format;
foreach (i, t1; T)
{
static assert(isFunctionPointer!t1 || isDelegate!t1);
static assert(isFunctionPointer!t1 || isDelegate!t1,
format!"T %d is not a function pointer or delegates"(i));
alias a1 = Parameters!(t1);
alias r1 = ReturnType!(t1);
@ -198,7 +201,6 @@ private
foreach (t2; T[i + 1 .. $])
{
static assert(isFunctionPointer!t2 || isDelegate!t2);
alias a2 = Parameters!(t2);
static assert(!is(a1 == a2),
@ -1987,7 +1989,7 @@ private
{
import std.meta : AliasSeq;
static assert(T.length);
static assert(T.length, "T must not be empty");
static if (isImplicitlyConvertible!(T[0], Duration))
{
@ -2028,7 +2030,8 @@ private
bool onLinkDeadMsg(ref Message msg)
{
assert(msg.convertsTo!(Tid));
assert(msg.convertsTo!(Tid),
"Message could be converted to Tid");
auto tid = msg.get!(Tid);
if (bool* pDepends = tid in thisInfo.links)
@ -2205,7 +2208,8 @@ private
{
static void onLinkDeadMsg(ref Message msg)
{
assert(msg.convertsTo!(Tid));
assert(msg.convertsTo!(Tid),
"Message could be converted to Tid");
auto tid = msg.get!(Tid);
thisInfo.links.remove(tid);
@ -2350,7 +2354,7 @@ private
{
import std.exception : enforce;
assert(m_count);
assert(m_count, "Can not remove from empty Range");
Node* n = r.m_prev;
enforce(n && n.next, "attempting to remove invalid list node");