Commit 325e0f5f0e
Changed files (12)
lib
std
Build
src
test
cases
compile_errors
lib/std/Build/Step.zig
@@ -415,7 +415,7 @@ pub fn evalZigProcess(
.Exited => {
// Note that the exit code may be 0 in this case due to the
// compiler server protocol.
- if (compile.expect_errors != null and s.result_error_bundle.errorMessageCount() > 0) {
+ if (compile.expect_errors != null) {
return error.NeedCompileErrorCheck;
}
},
lib/std/zig/ErrorBundle.zig
@@ -162,6 +162,7 @@ pub fn renderToStdErr(eb: ErrorBundle, options: RenderOptions) void {
}
pub fn renderToWriter(eb: ErrorBundle, options: RenderOptions, writer: anytype) anyerror!void {
+ if (eb.extra.len == 0) return;
for (eb.getMessages()) |err_msg| {
try renderErrorMessageToWriter(eb, options, err_msg, writer, "error", .red, 0);
}
src/Sema.zig
@@ -6173,6 +6173,7 @@ fn zirSetAlignStack(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst
};
return sema.failWithOwnedErrorMsg(block, msg);
}
+ sema.prev_stack_alignment_src = src;
const ip = &mod.intern_pool;
const a = ip.funcAnalysis(sema.func_index);
test/cases/compile_errors/@trap_comptime_call.zig
@@ -1,4 +1,4 @@
-pub fn entry() void {
+export fn entry() void {
comptime @trap();
}
test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig
@@ -2,7 +2,7 @@ export fn entry(y: u8) void {
const Thing = struct {
y: u8 = y,
};
- _ = @sizeOf(Thing);
+ _ = Thing{ .y = 1 };
}
// error
test/cases/compile_errors/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig
@@ -1,4 +1,4 @@
-const Foo = struct {};
+const Foo = struct { a: u32 };
export fn a() void {
const T = [*c]Foo;
var t: T = undefined;
test/cases/compile_errors/catch_on_undefined_value.zig
@@ -1,6 +1,6 @@
comptime {
var a: anyerror!bool = undefined;
- _ = a catch false;
+ if (a catch false) {}
}
// error
test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig
@@ -2,7 +2,7 @@ const Foo = extern struct {
f: *const fn() void,
};
-pub fn entry() void {
+export fn entry() void {
_ = (Foo{}).f;
}
test/cases/compile_errors/invalid_extern_function_call.zig
@@ -1,10 +1,10 @@
const x = @extern(*const fn() callconv(.C) void, .{ .name = "foo" });
-pub fn entry0() void {
+export fn entry0() void {
comptime x();
}
-pub fn entry1() void {
+export fn entry1() void {
@call(.always_inline, x, .{});
}
test/cases/compile_errors/slice_of_pointer_must_include_end_value.zig
@@ -1,10 +0,0 @@
-comptime {
- var ptr: [*]u8 = undefined;
- _ = ptr[0..];
-}
-
-// error
-// backend=stage2
-// target=native
-//
-// :3:12: error: slice of pointer must include end value