aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorr00ster91 <r00ster91@proton.me>2022-07-07 20:40:31 +0200
committerGitHub <noreply@github.com>2022-07-07 21:40:31 +0300
commit6f17be063d37f5ecd9552479e65428a5c60d9152 (patch)
treeea5072883e66ff72d591637c7e2ebd197b65f503 /lib
parent81bbefe9b837dc439a68458ca91d522c1c49b96b (diff)
downloadzig-6f17be063d37f5ecd9552479e65428a5c60d9152.tar.gz
zig-6f17be063d37f5ecd9552479e65428a5c60d9152.zip
std.log: give friendly error to freestanding users
Diffstat (limited to 'lib')
-rw-r--r--lib/std/log.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/log.zig b/lib/std/log.zig
index 5d9e5242a8..4110fe6d8d 100644
--- a/lib/std/log.zig
+++ b/lib/std/log.zig
@@ -156,11 +156,11 @@ pub fn defaultLog(
comptime format: []const u8,
args: anytype,
) void {
- if (builtin.os.tag == .freestanding) {
- // On freestanding one must provide a log function; we do not have
- // any I/O configured.
- return;
- }
+ if (builtin.os.tag == .freestanding)
+ @compileError(
+ \\freestanding targets do not have I/O configured;
+ \\please provide at least an empty `log` function declaration
+ );
const level_txt = comptime message_level.asText();
const prefix2 = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): ";