diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index d278ebf092..872035fb3d 100644 --- a/lib/std/Build/Step.zig +++ b/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; } }, diff --git a/lib/std/zig/ErrorBundle.zig b/lib/std/zig/ErrorBundle.zig index 2b1980c583..ff47e3794b 100644 --- a/lib/std/zig/ErrorBundle.zig +++ b/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); } diff --git a/src/Sema.zig b/src/Sema.zig index d13770940e..9672f1bae0 100644 --- a/src/Sema.zig +++ b/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); diff --git a/test/cases/compile_errors/@trap_comptime_call.zig b/test/cases/compile_errors/@trap_comptime_call.zig index 4dabcfea83..c6d0decf98 100644 --- a/test/cases/compile_errors/@trap_comptime_call.zig +++ b/test/cases/compile_errors/@trap_comptime_call.zig @@ -1,4 +1,4 @@ -pub fn entry() void { +export fn entry() void { comptime @trap(); } diff --git a/test/cases/compile_errors/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig b/test/cases/compile_errors/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig index 1472c7d5ba..c10a146cf0 100644 --- a/test/cases/compile_errors/C_pointer_pointing_to_non_C_ABI_compatible_type_or_has_align_attr.zig +++ b/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; diff --git a/test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig b/test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig index 583b7128c7..c6bc9cfe2e 100644 --- a/test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig +++ b/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 diff --git a/test/cases/compile_errors/catch_on_undefined_value.zig b/test/cases/compile_errors/catch_on_undefined_value.zig index 6d368c0eda..ef041c9539 100644 --- a/test/cases/compile_errors/catch_on_undefined_value.zig +++ b/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 diff --git a/test/cases/compile_errors/enum_with_declarations_unavailable_for_reify_type.zig b/test/cases/compile_errors/enum_with_declarations_unavailable_for_reify_type.zig index fb55a733e5..56f32c7681 100644 --- a/test/cases/compile_errors/enum_with_declarations_unavailable_for_reify_type.zig +++ b/test/cases/compile_errors/enum_with_declarations_unavailable_for_reify_type.zig @@ -1,7 +1,7 @@ export fn entry() void { _ = @Type(@typeInfo(enum { foo, - const bar = 1; + pub const bar = 1; })); } diff --git a/test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig b/test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig index ead75eb43e..ed5d4387e8 100644 --- a/test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig +++ b/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; } diff --git a/test/cases/compile_errors/invalid_extern_function_call.zig b/test/cases/compile_errors/invalid_extern_function_call.zig index 640f68efb4..f9ed51439c 100644 --- a/test/cases/compile_errors/invalid_extern_function_call.zig +++ b/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, .{}); } diff --git a/test/cases/compile_errors/slice_of_pointer_must_include_end_value.zig b/test/cases/compile_errors/slice_of_pointer_must_include_end_value.zig deleted file mode 100644 index 07fa6eee51..0000000000 --- a/test/cases/compile_errors/slice_of_pointer_must_include_end_value.zig +++ /dev/null @@ -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 diff --git a/test/cases/compile_errors/struct_with_declarations_unavailable_for_reify_type.zig b/test/cases/compile_errors/struct_with_declarations_unavailable_for_reify_type.zig index f0a2463228..c3964b30e3 100644 --- a/test/cases/compile_errors/struct_with_declarations_unavailable_for_reify_type.zig +++ b/test/cases/compile_errors/struct_with_declarations_unavailable_for_reify_type.zig @@ -1,6 +1,6 @@ export fn entry() void { _ = @Type(@typeInfo(struct { - const foo = 1; + pub const foo = 1; })); }