diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index d278ebf09220cb85e314b164a000cc109c614578..872035fb3d8e80c6a39fcb64e9962371452be63f 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 2b1980c58397a96c6f6ff8b1217ba0017a458c8e..ff47e3794b2ab9a1b7cb2f1db8922fa080e7c974 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 d13770940e09198258dbd63d7ea9318e678dae08..9672f1bae0970dd74696b1d7259e5a515e04562f 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 4dabcfea835652cbf3024cb646a499657fb380cf..c6d0decf98208d7de737cea327876afffdbce04a 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 1472c7d5baf4c09e90e7697c766908ac91c0a561..c10a146cf08f70fae0bc502e379371b57297d2e5 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 583b7128c7b56c718af80caf2548c0cd8022031f..c6bc9cfe2ebe9339314e4a81662dcd0c409fb90d 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 6d368c0eda17fbc24d6a26973e4081a9381d2baf..ef041c95391dab4bad402e41bba2d8e64d5e0b71 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 fb55a733e5223d06829909215225bfe9b22da1f9..56f32c768186c772fb1eb30e9ae2eb5ed8683537 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 ead75eb43e1423f3f5faba98c0521804fd7a8802..ed5d4387e8fffae6b1d7af1a657bad98a300deca 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 640f68efb41d180deb74454656390577c1dc9edf..f9ed51439cf5bb209edebab78ff10aa67bde3f56 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 07fa6eee51663d93cf8da188926d7f34c0f83613..0000000000000000000000000000000000000000 --- 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 f0a24632283ec2e1dd0b487c1d7298072aab208d..c3964b30e38ba27af15103c49c2bb4d1f2112f56 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; })); }