| ... | @@ -706,7 +706,7 @@ pub const Inst = struct { | ... | @@ -706,7 +706,7 @@ pub const Inst = struct { |
| 706 | base: Inst, | 706 | base: Inst, |
| 707 | | 707 | |
| 708 | positionals: struct { | 708 | positionals: struct { |
| 709 | msg: []const u8, | 709 | msg: *Inst, |
| 710 | }, | 710 | }, |
| 711 | kw_args: struct {}, | 711 | kw_args: struct {}, |
| 712 | }; | 712 | }; |
| ... | @@ -1950,7 +1950,23 @@ const EmitZIR = struct { | ... | @@ -1950,7 +1950,23 @@ const EmitZIR = struct { |
| 1950 | .tag = Inst.CompileError.base_tag, | 1950 | .tag = Inst.CompileError.base_tag, |
| 1951 | }, | 1951 | }, |
| 1952 | .positionals = .{ | 1952 | .positionals = .{ |
| 1953 | .msg = try self.arena.allocator.dupe(u8, err_msg_list.items[0].msg), | 1953 | |
| | 1954 | .msg = blk: { |
| | 1955 | const msg_str = try self.arena.allocator.dupe(u8, err_msg_list.items[0].msg); |
| | 1956 | |
| | 1957 | const str_inst = try self.arena.allocator.create(Inst.Str); |
| | 1958 | str_inst.* = .{ |
| | 1959 | .base = .{ |
| | 1960 | .src = ir_decl.src(), |
| | 1961 | .tag = Inst.Str.base_tag, |
| | 1962 | }, |
| | 1963 | .positionals = .{ |
| | 1964 | .bytes = msg_str, |
| | 1965 | }, |
| | 1966 | .kw_args = .{}, |
| | 1967 | }; |
| | 1968 | break :blk &str_inst.base; |
| | 1969 | }, |
| 1954 | }, | 1970 | }, |
| 1955 | .kw_args = .{}, | 1971 | .kw_args = .{}, |
| 1956 | }; | 1972 | }; |
| ... | @@ -2080,7 +2096,22 @@ const EmitZIR = struct { | ... | @@ -2080,7 +2096,22 @@ const EmitZIR = struct { |
| 2080 | .tag = Inst.CompileError.base_tag, | 2096 | .tag = Inst.CompileError.base_tag, |
| 2081 | }, | 2097 | }, |
| 2082 | .positionals = .{ | 2098 | .positionals = .{ |
| 2083 | .msg = try self.arena.allocator.dupe(u8, err_msg.msg), | 2099 | .msg = blk: { |
| | 2100 | const msg_str = try self.arena.allocator.dupe(u8, err_msg.msg); |
| | 2101 | |
| | 2102 | const str_inst = try self.arena.allocator.create(Inst.Str); |
| | 2103 | str_inst.* = .{ |
| | 2104 | .base = .{ |
| | 2105 | .src = src, |
| | 2106 | .tag = Inst.Str.base_tag, |
| | 2107 | }, |
| | 2108 | .positionals = .{ |
| | 2109 | .bytes = msg_str, |
| | 2110 | }, |
| | 2111 | .kw_args = .{}, |
| | 2112 | }; |
| | 2113 | break :blk &str_inst.base; |
| | 2114 | }, |
| 2084 | }, | 2115 | }, |
| 2085 | .kw_args = .{}, | 2116 | .kw_args = .{}, |
| 2086 | }; | 2117 | }; |
| ... | @@ -2094,7 +2125,22 @@ const EmitZIR = struct { | ... | @@ -2094,7 +2125,22 @@ const EmitZIR = struct { |
| 2094 | .tag = Inst.CompileError.base_tag, | 2125 | .tag = Inst.CompileError.base_tag, |
| 2095 | }, | 2126 | }, |
| 2096 | .positionals = .{ | 2127 | .positionals = .{ |
| 2097 | .msg = try self.arena.allocator.dupe(u8, "depends on another failed Decl"), | 2128 | .msg = blk: { |
| | 2129 | const msg_str = try self.arena.allocator.dupe(u8, "depends on another failed Decl"); |
| | 2130 | |
| | 2131 | const str_inst = try self.arena.allocator.create(Inst.Str); |
| | 2132 | str_inst.* = .{ |
| | 2133 | .base = .{ |
| | 2134 | .src = src, |
| | 2135 | .tag = Inst.Str.base_tag, |
| | 2136 | }, |
| | 2137 | .positionals = .{ |
| | 2138 | .bytes = msg_str, |
| | 2139 | }, |
| | 2140 | .kw_args = .{}, |
| | 2141 | }; |
| | 2142 | break :blk &str_inst.base; |
| | 2143 | }, |
| 2098 | }, | 2144 | }, |
| 2099 | .kw_args = .{}, | 2145 | .kw_args = .{}, |
| 2100 | }; | 2146 | }; |