| author | |
| committer | |
| log | ad0871ea4bf2dfbed07282ffe14738b5347d5d32 |
| tree | 17497337d26c37cf2bbc7d68d2813c22fea5c661 |
| parent | 94299d16d1443cd8b731e2eba9b4d1e3fb8048bd |
| parent | 4e6c1b676b30920fb333a6aa270bb42dc4cecc79 |
| signature |
Closes #3336
Closes #37185 files changed, 34 insertions(+), 13 deletions(-)
lib/std/child_process.zig+1-1| ... | ... | @@ -63,7 +63,7 @@ pub const ChildProcess = struct { |
| 63 | 63 | |
| 64 | 64 | /// Windows-only. `cwd` was provided, but the path did not exist when spawning the child process. |
| 65 | 65 | CurrentWorkingDirectoryUnlinked, |
| 66 | } || os.ExecveError || os.SetIdError || os.ChangeCurDirError || windows.CreateProcessError; | |
| 66 | } || os.ExecveError || os.SetIdError || os.ChangeCurDirError || windows.CreateProcessError || windows.WaitForSingleObjectError; | |
| 67 | 67 | |
| 68 | 68 | pub const Term = union(enum) { |
| 69 | 69 | Exited: u32, |
lib/std/coff.zig+1-1| ... | ... | @@ -179,7 +179,7 @@ pub const Coff = struct { |
| 179 | 179 | if (byte != 0 and i == buffer.len) |
| 180 | 180 | return error.NameTooLong; |
| 181 | 181 | |
| 182 | return i; | |
| 182 | return @as(usize, i); | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | pub fn loadSections(self: *Coff) !void { |
src/codegen.cpp+1-1| ... | ... | @@ -7725,7 +7725,7 @@ static void do_code_gen(CodeGen *g) { |
| 7725 | 7725 | |
| 7726 | 7726 | char *error = nullptr; |
| 7727 | 7727 | if (LLVMVerifyModule(g->module, LLVMReturnStatusAction, &error)) { |
| 7728 | zig_panic("broken LLVM module found: %s", error); | |
| 7728 | zig_panic("broken LLVM module found: %s\nThis is a bug in the Zig compiler.", error); | |
| 7729 | 7729 | } |
| 7730 | 7730 | } |
| 7731 | 7731 |
src/ir.cpp+10-10| ... | ... | @@ -13535,16 +13535,6 @@ static IrInstruction *ir_analyze_instruction_return(IrAnalyze *ira, IrInstructio |
| 13535 | 13535 | if (type_is_invalid(operand->value.type)) |
| 13536 | 13536 | return ir_unreach_error(ira); |
| 13537 | 13537 | |
| 13538 | if (!instr_is_comptime(operand) && ira->explicit_return_type != nullptr && | |
| 13539 | handle_is_ptr(ira->explicit_return_type)) | |
| 13540 | { | |
| 13541 | // result location mechanism took care of it. | |
| 13542 | IrInstruction *result = ir_build_return(&ira->new_irb, instruction->base.scope, | |
| 13543 | instruction->base.source_node, nullptr); | |
| 13544 | result->value.type = ira->codegen->builtin_types.entry_unreachable; | |
| 13545 | return ir_finish_anal(ira, result); | |
| 13546 | } | |
| 13547 | ||
| 13548 | 13538 | IrInstruction *casted_operand = ir_implicit_cast(ira, operand, ira->explicit_return_type); |
| 13549 | 13539 | if (type_is_invalid(casted_operand->value.type)) { |
| 13550 | 13540 | AstNode *source_node = ira->explicit_return_type_source_node; |
| ... | ... | @@ -13556,6 +13546,16 @@ static IrInstruction *ir_analyze_instruction_return(IrAnalyze *ira, IrInstructio |
| 13556 | 13546 | return ir_unreach_error(ira); |
| 13557 | 13547 | } |
| 13558 | 13548 | |
| 13549 | if (!instr_is_comptime(operand) && ira->explicit_return_type != nullptr && | |
| 13550 | handle_is_ptr(ira->explicit_return_type)) | |
| 13551 | { | |
| 13552 | // result location mechanism took care of it. | |
| 13553 | IrInstruction *result = ir_build_return(&ira->new_irb, instruction->base.scope, | |
| 13554 | instruction->base.source_node, nullptr); | |
| 13555 | result->value.type = ira->codegen->builtin_types.entry_unreachable; | |
| 13556 | return ir_finish_anal(ira, result); | |
| 13557 | } | |
| 13558 | ||
| 13559 | 13559 | if (casted_operand->value.special == ConstValSpecialRuntime && |
| 13560 | 13560 | casted_operand->value.type->id == ZigTypeIdPointer && |
| 13561 | 13561 | casted_operand->value.data.rh_ptr == RuntimeHintPtrStack) |
test/compile_errors.zig+21| ... | ... | @@ -12,6 +12,27 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 12 | 12 | "tmp.zig:3:5: error: switch must handle all possibilities", |
| 13 | 13 | ); |
| 14 | 14 | |
| 15 | cases.add( | |
| 16 | "incorrect return type", | |
| 17 | \\ pub export fn entry() void{ | |
| 18 | \\ _ = foo(); | |
| 19 | \\ } | |
| 20 | \\ const A = struct { | |
| 21 | \\ a: u32, | |
| 22 | \\ }; | |
| 23 | \\ fn foo() A { | |
| 24 | \\ return bar(); | |
| 25 | \\ } | |
| 26 | \\ const B = struct { | |
| 27 | \\ a: u32, | |
| 28 | \\ }; | |
| 29 | \\ fn bar() B { | |
| 30 | \\ unreachable; | |
| 31 | \\ } | |
| 32 | , | |
| 33 | "tmp.zig:8:16: error: expected type 'A', found 'B'", | |
| 34 | ); | |
| 35 | ||
| 15 | 36 | cases.add( |
| 16 | 37 | "regression test #2980: base type u32 is not type checked properly when assigning a value within a struct", |
| 17 | 38 | \\const Foo = struct { |