From c6605cba8375871a145896f9cf1090e9c823214a Mon Sep 17 00:00:00 2001 From: Josh Wolfe Date: Sun, 23 Apr 2017 16:59:55 -0700 Subject: blocks check that their statements are void closes #291 This changes the error message "return value ignored" to "expression value is ignored". This is because this error also applies to {1;}, which has no function calls. Also fix ignored expression values in std and test. This caught a bug in debug.readAllocBytes where an early Eof error would have been missed. See #219. --- std/debug.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'std/debug.zig') diff --git a/std/debug.zig b/std/debug.zig index a37f8749cf..45f7dcf091 100644 --- a/std/debug.zig +++ b/std/debug.zig @@ -217,7 +217,7 @@ fn getString(st: &ElfStackTrace, offset: u64) -> %[]u8 { fn readAllocBytes(in_stream: &io.InStream, size: usize) -> %[]u8 { const buf = %return global_allocator.alloc(u8, size); %defer global_allocator.free(buf); - %return in_stream.read(buf); + if (size < %return in_stream.read(buf)) return error.Eof; return buf; } -- cgit v1.2.3