From a10eb834a4bf7faeaa77669c79f5863e53b3593e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bor=20Gro=C5=A1elj=20Simi=C4=87?= Date: Sat, 29 Apr 2023 15:24:21 +0200 Subject: [PATCH] rt: update abort for harec non-constant assert changes --- rt/abort.ha | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/rt/abort.ha b/rt/abort.ha index a0e4aa2..b32f0e9 100644 --- a/rt/abort.ha +++ b/rt/abort.ha @@ -16,8 +16,10 @@ fn abort_writestr(s: str) size = { return writer(buf); }; -export @symbol("rt.abort") fn _abort(msg: str) void = { +export @symbol("rt.abort") fn _abort(loc: str, msg: str) void = { abort_writestr("Abort: "); + abort_writestr(loc); + abort_writestr(": "); abort_writestr(msg); abort_writestr("\n"); halt(); @@ -30,13 +32,9 @@ const reasons: [_]str = [ "out of memory", // 2 "static insert/append exceeds slice capacity", // 3 "execution reached unreachable code (compiler bug)", // 4 + "assertion failed", // 5 ]; export @noreturn fn abort_fixed(loc: str, i: int) void = { - abort_writestr("Abort: "); - abort_writestr(loc); - abort_writestr(": "); - abort_writestr(reasons[i]); - abort_writestr("\n"); - halt(); + _abort(loc, reasons[i]); }; -- 2.45.2