authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-01 00:07:40-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-01 00:17:31-04:00
log019217d7a23bee69bd5ceb38aeeb5f689d5c2a9c
tree4fea2ee348cbbb08f4a6f81ddc7437574e475617
parent2f614c42fe4f28e5adda8163bd50d6d3507d6353

fix regressions


4 files changed, 110 insertions(+), 47 deletions(-)

src/ir.cpp+84-21
......@@ -9433,6 +9433,8 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so
94339433 TypeUnionField *union_field = find_union_field_by_tag(wanted_type, &val->data.x_enum_tag);
94349434 assert(union_field != nullptr);
94359435 type_ensure_zero_bits_known(ira->codegen, union_field->type_entry);
9436 if (type_is_invalid(union_field->type_entry))
9437 return ira->codegen->invalid_instruction;
94369438 if (!union_field->type_entry->zero_bits) {
94379439 AstNode *field_node = wanted_type->data.unionation.decl_node->data.container_decl.fields.at(
94389440 union_field->enum_field->decl_index);
......@@ -10015,6 +10017,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1001510017 if (actual_type->id == TypeTableEntryIdNumLitFloat ||
1001610018 actual_type->id == TypeTableEntryIdNumLitInt)
1001710019 {
10020 ensure_complete_type(ira->codegen, wanted_type);
10021 if (type_is_invalid(wanted_type))
10022 return ira->codegen->invalid_instruction;
1001810023 if (wanted_type->id == TypeTableEntryIdEnum) {
1001910024 IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.enumeration.tag_int_type, value);
1002010025 if (type_is_invalid(cast1->value.type))
......@@ -12766,6 +12771,10 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op
1276612771 TypeTableEntry *type_entry = ir_resolve_type(ira, value);
1276712772 if (type_is_invalid(type_entry))
1276812773 return ira->codegen->builtin_types.entry_invalid;
12774 ensure_complete_type(ira->codegen, type_entry);
12775 if (type_is_invalid(type_entry))
12776 return ira->codegen->builtin_types.entry_invalid;
12777
1276912778 switch (type_entry->id) {
1277012779 case TypeTableEntryIdInvalid:
1277112780 zig_unreachable();
......@@ -13187,6 +13196,9 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc
1318713196
1318813197 bool safety_check_on = elem_ptr_instruction->safety_check_on;
1318913198 ensure_complete_type(ira->codegen, return_type->data.pointer.child_type);
13199 if (type_is_invalid(return_type->data.pointer.child_type))
13200 return ira->codegen->builtin_types.entry_invalid;
13201
1319013202 uint64_t elem_size = type_size(ira->codegen, return_type->data.pointer.child_type);
1319113203 uint64_t abi_align = get_abi_alignment(ira->codegen, return_type->data.pointer.child_type);
1319213204 uint64_t ptr_align = return_type->data.pointer.alignment;
......@@ -13696,7 +13708,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru
1369613708 }
1369713709 if (child_type->id == TypeTableEntryIdEnum) {
1369813710 ensure_complete_type(ira->codegen, child_type);
13699 if (child_type->data.enumeration.is_invalid)
13711 if (type_is_invalid(child_type))
1370013712 return ira->codegen->builtin_types.entry_invalid;
1370113713
1370213714 TypeEnumField *field = find_enum_type_field(child_type, field_name);
......@@ -14569,27 +14581,27 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira,
1456914581 return ira->codegen->builtin_types.entry_invalid;
1457014582
1457114583 TypeTableEntry *ptr_type = value->value.type;
14572 if (ptr_type->id == TypeTableEntryIdMetaType) {
14584 assert(ptr_type->id == TypeTableEntryIdPointer);
14585
14586 TypeTableEntry *type_entry = ptr_type->data.pointer.child_type;
14587 if (type_is_invalid(type_entry)) {
14588 return ira->codegen->builtin_types.entry_invalid;
14589 } else if (type_entry->id == TypeTableEntryIdMetaType) {
1457314590 // surprise! actually this is just ??T not an unwrap maybe instruction
14574 TypeTableEntry *ptr_type_ptr = ir_resolve_type(ira, value);
14575 assert(ptr_type_ptr->id == TypeTableEntryIdPointer);
14576 TypeTableEntry *child_type = ptr_type_ptr->data.pointer.child_type;
14591 ConstExprValue *ptr_val = const_ptr_pointee(ira->codegen, &value->value);
14592 assert(ptr_val->type->id == TypeTableEntryIdMetaType);
14593 TypeTableEntry *child_type = ptr_val->data.x_type;
14594
1457714595 type_ensure_zero_bits_known(ira->codegen, child_type);
1457814596 TypeTableEntry *layer1 = get_maybe_type(ira->codegen, child_type);
1457914597 TypeTableEntry *layer2 = get_maybe_type(ira->codegen, layer1);
14580 TypeTableEntry *result_type = get_pointer_to_type(ira->codegen, layer2, true);
1458114598
1458214599 IrInstruction *const_instr = ir_build_const_type(&ira->new_irb, unwrap_maybe_instruction->base.scope,
14583 unwrap_maybe_instruction->base.source_node, result_type);
14584 ir_link_new_instruction(const_instr, &unwrap_maybe_instruction->base);
14585 return const_instr->value.type;
14586 }
14587
14588 assert(ptr_type->id == TypeTableEntryIdPointer);
14589
14590 TypeTableEntry *type_entry = ptr_type->data.pointer.child_type;
14591 if (type_is_invalid(type_entry)) {
14592 return ira->codegen->builtin_types.entry_invalid;
14600 unwrap_maybe_instruction->base.source_node, layer2);
14601 IrInstruction *result_instr = ir_get_ref(ira, &unwrap_maybe_instruction->base, const_instr,
14602 ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile);
14603 ir_link_new_instruction(result_instr, &unwrap_maybe_instruction->base);
14604 return result_instr->value.type;
1459314605 } else if (type_entry->id != TypeTableEntryIdMaybe) {
1459414606 ir_add_error_node(ira, unwrap_maybe_instruction->value->source_node,
1459514607 buf_sprintf("expected nullable type, found '%s'", buf_ptr(&type_entry->name)));
......@@ -15115,6 +15127,8 @@ static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, Ir
1511515127 assert(container_type->id == TypeTableEntryIdUnion);
1511615128
1511715129 ensure_complete_type(ira->codegen, container_type);
15130 if (type_is_invalid(container_type))
15131 return ira->codegen->builtin_types.entry_invalid;
1511815132
1511915133 if (instr_field_count != 1) {
1512015134 ir_add_error(ira, instruction,
......@@ -15182,6 +15196,8 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru
1518215196 }
1518315197
1518415198 ensure_complete_type(ira->codegen, container_type);
15199 if (type_is_invalid(container_type))
15200 return ira->codegen->builtin_types.entry_invalid;
1518515201
1518615202 size_t actual_field_count = container_type->data.structure.src_field_count;
1518715203
......@@ -15687,6 +15703,8 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira,
1568715703 return ira->codegen->builtin_types.entry_invalid;
1568815704
1568915705 ensure_complete_type(ira->codegen, container_type);
15706 if (type_is_invalid(container_type))
15707 return ira->codegen->builtin_types.entry_invalid;
1569015708
1569115709 IrInstruction *field_name_value = instruction->field_name->other;
1569215710 Buf *field_name = ir_resolve_str(ira, field_name_value);
......@@ -15740,6 +15758,9 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na
1574015758 assert(type_info_var->type->id == TypeTableEntryIdMetaType);
1574115759
1574215760 ensure_complete_type(ira->codegen, type_info_var->data.x_type);
15761 if (type_is_invalid(type_info_var->data.x_type))
15762 return ira->codegen->builtin_types.entry_invalid;
15763
1574315764 type_info_type = type_info_var->data.x_type;
1574415765 assert(type_info_type->id == TypeTableEntryIdUnion);
1574515766 }
......@@ -15765,26 +15786,37 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na
1576515786 VariableTableEntry *var = tld->var;
1576615787
1576715788 ensure_complete_type(ira->codegen, var->value->type);
15789 if (type_is_invalid(var->value->type))
15790 return ira->codegen->builtin_types.entry_invalid;
1576815791 assert(var->value->type->id == TypeTableEntryIdMetaType);
1576915792 return var->value->data.x_type;
1577015793}
1577115794
15772static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, ScopeDecls *decls_scope)
15795static bool ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, ScopeDecls *decls_scope)
1577315796{
1577415797 TypeTableEntry *type_info_definition_type = ir_type_info_get_type(ira, "Definition");
1577515798 ensure_complete_type(ira->codegen, type_info_definition_type);
15799 if (type_is_invalid(type_info_definition_type))
15800 return false;
15801
1577615802 ensure_field_index(type_info_definition_type, "name", 0);
1577715803 ensure_field_index(type_info_definition_type, "is_pub", 1);
1577815804 ensure_field_index(type_info_definition_type, "data", 2);
1577915805
1578015806 TypeTableEntry *type_info_definition_data_type = ir_type_info_get_type(ira, "Data", type_info_definition_type);
1578115807 ensure_complete_type(ira->codegen, type_info_definition_data_type);
15808 if (type_is_invalid(type_info_definition_data_type))
15809 return false;
1578215810
1578315811 TypeTableEntry *type_info_fn_def_type = ir_type_info_get_type(ira, "FnDef", type_info_definition_data_type);
1578415812 ensure_complete_type(ira->codegen, type_info_fn_def_type);
15813 if (type_is_invalid(type_info_fn_def_type))
15814 return false;
1578515815
1578615816 TypeTableEntry *type_info_fn_def_inline_type = ir_type_info_get_type(ira, "Inline", type_info_fn_def_type);
1578715817 ensure_complete_type(ira->codegen, type_info_fn_def_inline_type);
15818 if (type_is_invalid(type_info_fn_def_inline_type))
15819 return false;
1578815820
1578915821 // Loop through our definitions once to figure out how many definitions we will generate info for.
1579015822 auto decl_it = decls_scope->decl_table.entry_iterator();
......@@ -15799,7 +15831,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1579915831 resolve_top_level_decl(ira->codegen, curr_entry->value, false, curr_entry->value->source_node);
1580015832 if (curr_entry->value->resolution != TldResolutionOk)
1580115833 {
15802 return;
15834 return false;
1580315835 }
1580415836 }
1580515837
......@@ -15864,6 +15896,9 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1586415896 {
1586515897 VariableTableEntry *var = ((TldVar *)curr_entry->value)->var;
1586615898 ensure_complete_type(ira->codegen, var->value->type);
15899 if (type_is_invalid(var->value->type))
15900 return false;
15901
1586715902 if (var->value->type->id == TypeTableEntryIdMetaType)
1586815903 {
1586915904 // We have a variable of type 'type', so it's actually a type definition.
......@@ -15991,6 +16026,9 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1599116026 {
1599216027 TypeTableEntry *type_entry = ((TldContainer *)curr_entry->value)->type_entry;
1599316028 ensure_complete_type(ira->codegen, type_entry);
16029 if (type_is_invalid(type_entry))
16030 return false;
16031
1599416032 // This is a type.
1599516033 bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 0);
1599616034
......@@ -16011,6 +16049,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
1601116049 }
1601216050
1601316051 assert(definition_index == definition_count);
16052 return true;
1601416053}
1601516054
1601616055static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry)
......@@ -16019,6 +16058,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1601916058 assert(!type_is_invalid(type_entry));
1602016059
1602116060 ensure_complete_type(ira->codegen, type_entry);
16061 if (type_is_invalid(type_entry))
16062 return nullptr;
1602216063
1602316064 const auto make_enum_field_val = [ira](ConstExprValue *enum_field_val, TypeEnumField *enum_field,
1602416065 TypeTableEntry *type_info_enum_field_type) {
......@@ -16246,7 +16287,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1624616287 }
1624716288 // defs: []TypeInfo.Definition
1624816289 ensure_field_index(result->type, "defs", 3);
16249 ir_make_type_info_defs(ira, &fields[3], type_entry->data.enumeration.decls_scope);
16290 if (!ir_make_type_info_defs(ira, &fields[3], type_entry->data.enumeration.decls_scope))
16291 return nullptr;
1625016292
1625116293 break;
1625216294 }
......@@ -16401,7 +16443,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1640116443 }
1640216444 // defs: []TypeInfo.Definition
1640316445 ensure_field_index(result->type, "defs", 3);
16404 ir_make_type_info_defs(ira, &fields[3], type_entry->data.unionation.decls_scope);
16446 if (!ir_make_type_info_defs(ira, &fields[3], type_entry->data.unionation.decls_scope))
16447 return nullptr;
1640516448
1640616449 break;
1640716450 }
......@@ -16412,6 +16455,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1641216455 buf_init_from_str(&ptr_field_name, "ptr");
1641316456 TypeTableEntry *ptr_type = type_entry->data.structure.fields_by_name.get(&ptr_field_name)->type_entry;
1641416457 ensure_complete_type(ira->codegen, ptr_type);
16458 if (type_is_invalid(ptr_type))
16459 return nullptr;
1641516460 buf_deinit(&ptr_field_name);
1641616461
1641716462 result = create_ptr_like_type_info("Slice", ptr_type);
......@@ -16482,7 +16527,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1648216527 }
1648316528 // defs: []TypeInfo.Definition
1648416529 ensure_field_index(result->type, "defs", 2);
16485 ir_make_type_info_defs(ira, &fields[2], type_entry->data.structure.decls_scope);
16530 if (!ir_make_type_info_defs(ira, &fields[2], type_entry->data.structure.decls_scope))
16531 return nullptr;
1648616532
1648716533 break;
1648816534 }
......@@ -17502,6 +17548,11 @@ static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInst
1750217548 if (type_is_invalid(container_type))
1750317549 return ira->codegen->builtin_types.entry_invalid;
1750417550
17551 ensure_complete_type(ira->codegen, container_type);
17552 if (type_is_invalid(container_type))
17553 return ira->codegen->builtin_types.entry_invalid;
17554
17555
1750517556 uint64_t member_index;
1750617557 IrInstruction *index_value = instruction->member_index->other;
1750717558 if (!ir_resolve_usize(ira, index_value, &member_index))
......@@ -17544,6 +17595,10 @@ static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInst
1754417595 if (type_is_invalid(container_type))
1754517596 return ira->codegen->builtin_types.entry_invalid;
1754617597
17598 ensure_complete_type(ira->codegen, container_type);
17599 if (type_is_invalid(container_type))
17600 return ira->codegen->builtin_types.entry_invalid;
17601
1754717602 uint64_t member_index;
1754817603 IrInstruction *index_value = instruction->member_index->other;
1754917604 if (!ir_resolve_usize(ira, index_value, &member_index))
......@@ -18485,7 +18540,12 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
1848518540 return ira->codegen->builtin_types.entry_invalid;
1848618541
1848718542 ensure_complete_type(ira->codegen, dest_type);
18543 if (type_is_invalid(dest_type))
18544 return ira->codegen->builtin_types.entry_invalid;
18545
1848818546 ensure_complete_type(ira->codegen, src_type);
18547 if (type_is_invalid(src_type))
18548 return ira->codegen->builtin_types.entry_invalid;
1848918549
1849018550 if (get_codegen_ptr_type(src_type) != nullptr) {
1849118551 ir_add_error(ira, value,
......@@ -18724,6 +18784,9 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstruc
1872418784 if (!ir_resolve_align(ira, instruction->align_value->other, &align_bytes))
1872518785 return ira->codegen->builtin_types.entry_invalid;
1872618786 } else {
18787 type_ensure_zero_bits_known(ira->codegen, child_type);
18788 if (type_is_invalid(child_type))
18789 return ira->codegen->builtin_types.entry_invalid;
1872718790 align_bytes = get_abi_alignment(ira->codegen, child_type);
1872818791 }
1872918792
test/compile_errors.zig+1-1
......@@ -3232,7 +3232,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
32323232 \\ fn bar(self: *const Foo) void {}
32333233 \\};
32343234 ,
3235 ".tmp_source.zig:4:4: error: variable of type '*const (integer literal)' must be const or comptime",
3235 ".tmp_source.zig:4:4: error: variable of type '*(integer literal)' must be const or comptime",
32363236 ".tmp_source.zig:7:4: error: variable of type '(undefined)' must be const or comptime",
32373237 ".tmp_source.zig:8:4: error: variable of type '(integer literal)' must be const or comptime",
32383238 ".tmp_source.zig:9:4: error: variable of type '(float literal)' must be const or comptime",
test/gen_h.zig+2-2
......@@ -54,7 +54,7 @@ pub fn addCases(cases: *tests.GenHContext) void {
5454 cases.add("declare opaque type",
5555 \\export const Foo = @OpaqueType();
5656 \\
57 \\export fn entry(foo: ?&Foo) void { }
57 \\export fn entry(foo: ?*Foo) void { }
5858 ,
5959 \\struct Foo;
6060 \\
......@@ -64,7 +64,7 @@ pub fn addCases(cases: *tests.GenHContext) void {
6464 cases.add("array field-type",
6565 \\const Foo = extern struct {
6666 \\ A: [2]i32,
67 \\ B: [4]&u32,
67 \\ B: [4]*u32,
6868 \\};
6969 \\export fn entry(foo: Foo, bar: [3]u8) void { }
7070 ,
test/runtime_safety.zig+23-23
......@@ -2,7 +2,7 @@ const tests = @import("tests.zig");
22
33pub fn addCases(cases: *tests.CompareOutputContext) void {
44 cases.addRuntimeSafety("calling panic",
5 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
5 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
66 \\ @import("std").os.exit(126);
77 \\}
88 \\pub fn main() void {
......@@ -11,7 +11,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
1111 );
1212
1313 cases.addRuntimeSafety("out of bounds slice access",
14 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
14 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
1515 \\ @import("std").os.exit(126);
1616 \\}
1717 \\pub fn main() void {
......@@ -25,7 +25,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
2525 );
2626
2727 cases.addRuntimeSafety("integer addition overflow",
28 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
28 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
2929 \\ @import("std").os.exit(126);
3030 \\}
3131 \\pub fn main() !void {
......@@ -38,7 +38,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
3838 );
3939
4040 cases.addRuntimeSafety("integer subtraction overflow",
41 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
41 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
4242 \\ @import("std").os.exit(126);
4343 \\}
4444 \\pub fn main() !void {
......@@ -51,7 +51,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
5151 );
5252
5353 cases.addRuntimeSafety("integer multiplication overflow",
54 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
54 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
5555 \\ @import("std").os.exit(126);
5656 \\}
5757 \\pub fn main() !void {
......@@ -64,7 +64,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
6464 );
6565
6666 cases.addRuntimeSafety("integer negation overflow",
67 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
67 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
6868 \\ @import("std").os.exit(126);
6969 \\}
7070 \\pub fn main() !void {
......@@ -77,7 +77,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
7777 );
7878
7979 cases.addRuntimeSafety("signed integer division overflow",
80 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
80 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
8181 \\ @import("std").os.exit(126);
8282 \\}
8383 \\pub fn main() !void {
......@@ -90,7 +90,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
9090 );
9191
9292 cases.addRuntimeSafety("signed shift left overflow",
93 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
93 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
9494 \\ @import("std").os.exit(126);
9595 \\}
9696 \\pub fn main() !void {
......@@ -103,7 +103,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
103103 );
104104
105105 cases.addRuntimeSafety("unsigned shift left overflow",
106 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
106 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
107107 \\ @import("std").os.exit(126);
108108 \\}
109109 \\pub fn main() !void {
......@@ -116,7 +116,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
116116 );
117117
118118 cases.addRuntimeSafety("signed shift right overflow",
119 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
119 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
120120 \\ @import("std").os.exit(126);
121121 \\}
122122 \\pub fn main() !void {
......@@ -129,7 +129,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
129129 );
130130
131131 cases.addRuntimeSafety("unsigned shift right overflow",
132 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
132 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
133133 \\ @import("std").os.exit(126);
134134 \\}
135135 \\pub fn main() !void {
......@@ -142,7 +142,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
142142 );
143143
144144 cases.addRuntimeSafety("integer division by zero",
145 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
145 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
146146 \\ @import("std").os.exit(126);
147147 \\}
148148 \\pub fn main() void {
......@@ -154,7 +154,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
154154 );
155155
156156 cases.addRuntimeSafety("exact division failure",
157 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
157 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
158158 \\ @import("std").os.exit(126);
159159 \\}
160160 \\pub fn main() !void {
......@@ -167,7 +167,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
167167 );
168168
169169 cases.addRuntimeSafety("cast []u8 to bigger slice of wrong size",
170 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
170 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
171171 \\ @import("std").os.exit(126);
172172 \\}
173173 \\pub fn main() !void {
......@@ -180,7 +180,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
180180 );
181181
182182 cases.addRuntimeSafety("value does not fit in shortening cast",
183 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
183 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
184184 \\ @import("std").os.exit(126);
185185 \\}
186186 \\pub fn main() !void {
......@@ -193,7 +193,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
193193 );
194194
195195 cases.addRuntimeSafety("signed integer not fitting in cast to unsigned integer",
196 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
196 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
197197 \\ @import("std").os.exit(126);
198198 \\}
199199 \\pub fn main() !void {
......@@ -206,7 +206,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
206206 );
207207
208208 cases.addRuntimeSafety("unwrap error",
209 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
209 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
210210 \\ if (@import("std").mem.eql(u8, message, "attempt to unwrap error: Whatever")) {
211211 \\ @import("std").os.exit(126); // good
212212 \\ }
......@@ -221,7 +221,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
221221 );
222222
223223 cases.addRuntimeSafety("cast integer to global error and no code matches",
224 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
224 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
225225 \\ @import("std").os.exit(126);
226226 \\}
227227 \\pub fn main() void {
......@@ -233,7 +233,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
233233 );
234234
235235 cases.addRuntimeSafety("cast integer to non-global error set and no match",
236 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
236 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
237237 \\ @import("std").os.exit(126);
238238 \\}
239239 \\const Set1 = error{A, B};
......@@ -247,7 +247,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
247247 );
248248
249249 cases.addRuntimeSafety("@alignCast misaligned",
250 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
250 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
251251 \\ @import("std").os.exit(126);
252252 \\}
253253 \\pub fn main() !void {
......@@ -263,7 +263,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
263263 );
264264
265265 cases.addRuntimeSafety("bad union field access",
266 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
266 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
267267 \\ @import("std").os.exit(126);
268268 \\}
269269 \\
......@@ -277,7 +277,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
277277 \\ bar(&f);
278278 \\}
279279 \\
280 \\fn bar(f: &Foo) void {
280 \\fn bar(f: *Foo) void {
281281 \\ f.float = 12.34;
282282 \\}
283283 );
......@@ -287,7 +287,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
287287 cases.addRuntimeSafety("error return trace across suspend points",
288288 \\const std = @import("std");
289289 \\
290 \\pub fn panic(message: []const u8, stack_trace: ?&@import("builtin").StackTrace) noreturn {
290 \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
291291 \\ std.os.exit(126);
292292 \\}
293293 \\