From 2b9e5377f17824e43b45efa7f647a902786fb681 Mon Sep 17 00:00:00 2001 From: Robert Schadek Date: Thu, 15 Aug 2019 08:49:55 +0100 Subject: [PATCH] adds assert messages to std.concurrency * Nicholas review --- std/concurrency.d | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/std/concurrency.d b/std/concurrency.d index 1d7d02b59..838fc8f0b 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -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");