| ... | @@ -50,7 +50,7 @@ comptime_break_inst: Zir.Inst.Index = undefined, | ... | @@ -50,7 +50,7 @@ comptime_break_inst: Zir.Inst.Index = undefined, |
| 50 | src: LazySrcLoc = .{ .token_offset = 0 }, | 50 | src: LazySrcLoc = .{ .token_offset = 0 }, |
| 51 | decl_val_table: std.AutoHashMapUnmanaged(Decl.Index, Air.Inst.Ref) = .{}, | 51 | decl_val_table: std.AutoHashMapUnmanaged(Decl.Index, Air.Inst.Ref) = .{}, |
| 52 | /// When doing a generic function instantiation, this array collects a | 52 | /// When doing a generic function instantiation, this array collects a |
| 53 | /// `Value` object for each parameter that is comptime known and thus elided | 53 | /// `Value` object for each parameter that is comptime-known and thus elided |
| 54 | /// from the generated function. This memory is allocated by a parent `Sema` and | 54 | /// from the generated function. This memory is allocated by a parent `Sema` and |
| 55 | /// owned by the values arena of the Sema owner_decl. | 55 | /// owned by the values arena of the Sema owner_decl. |
| 56 | comptime_args: []TypedValue = &.{}, | 56 | comptime_args: []TypedValue = &.{}, |
| ... | @@ -1351,7 +1351,7 @@ fn analyzeBodyInner( | ... | @@ -1351,7 +1351,7 @@ fn analyzeBodyInner( |
| 1351 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); | 1351 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 1352 | const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len]; | 1352 | const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len]; |
| 1353 | const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; | 1353 | const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; |
| 1354 | const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime known"); | 1354 | const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime-known"); |
| 1355 | const inline_body = if (cond.val.toBool()) then_body else else_body; | 1355 | const inline_body = if (cond.val.toBool()) then_body else else_body; |
| 1356 | | 1356 | |
| 1357 | try sema.maybeErrorUnwrapCondbr(block, inline_body, extra.data.condition, cond_src); | 1357 | try sema.maybeErrorUnwrapCondbr(block, inline_body, extra.data.condition, cond_src); |
| ... | @@ -1369,7 +1369,7 @@ fn analyzeBodyInner( | ... | @@ -1369,7 +1369,7 @@ fn analyzeBodyInner( |
| 1369 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); | 1369 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 1370 | const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len]; | 1370 | const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len]; |
| 1371 | const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; | 1371 | const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; |
| 1372 | const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime known"); | 1372 | const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime-known"); |
| 1373 | const inline_body = if (cond.val.toBool()) then_body else else_body; | 1373 | const inline_body = if (cond.val.toBool()) then_body else else_body; |
| 1374 | const old_runtime_index = block.runtime_index; | 1374 | const old_runtime_index = block.runtime_index; |
| 1375 | defer block.runtime_index = old_runtime_index; | 1375 | defer block.runtime_index = old_runtime_index; |
| ... | @@ -1391,7 +1391,7 @@ fn analyzeBodyInner( | ... | @@ -1391,7 +1391,7 @@ fn analyzeBodyInner( |
| 1391 | const err_union = try sema.resolveInst(extra.data.operand); | 1391 | const err_union = try sema.resolveInst(extra.data.operand); |
| 1392 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union); | 1392 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union); |
| 1393 | assert(is_non_err != .none); | 1393 | assert(is_non_err != .none); |
| 1394 | const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime known"); | 1394 | const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime-known"); |
| 1395 | if (is_non_err_tv.val.toBool()) { | 1395 | if (is_non_err_tv.val.toBool()) { |
| 1396 | const err_union_ty = sema.typeOf(err_union); | 1396 | const err_union_ty = sema.typeOf(err_union); |
| 1397 | break :blk try sema.analyzeErrUnionPayload(block, src, err_union_ty, err_union, operand_src, false); | 1397 | break :blk try sema.analyzeErrUnionPayload(block, src, err_union_ty, err_union, operand_src, false); |
| ... | @@ -1447,7 +1447,7 @@ fn analyzeBodyInner( | ... | @@ -1447,7 +1447,7 @@ fn analyzeBodyInner( |
| 1447 | const err_union = try sema.analyzeLoad(block, src, operand, operand_src); | 1447 | const err_union = try sema.analyzeLoad(block, src, operand, operand_src); |
| 1448 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union); | 1448 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union); |
| 1449 | assert(is_non_err != .none); | 1449 | assert(is_non_err != .none); |
| 1450 | const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime known"); | 1450 | const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime-known"); |
| 1451 | if (is_non_err_tv.val.toBool()) { | 1451 | if (is_non_err_tv.val.toBool()) { |
| 1452 | break :blk try sema.analyzeErrUnionPayloadPtr(block, src, operand, false, false); | 1452 | break :blk try sema.analyzeErrUnionPayloadPtr(block, src, operand, false, false); |
| 1453 | } | 1453 | } |
| ... | @@ -1592,7 +1592,7 @@ fn analyzeAsType( | ... | @@ -1592,7 +1592,7 @@ fn analyzeAsType( |
| 1592 | ) !Type { | 1592 | ) !Type { |
| 1593 | const wanted_type = Type.initTag(.@"type"); | 1593 | const wanted_type = Type.initTag(.@"type"); |
| 1594 | const coerced_inst = try sema.coerce(block, wanted_type, air_inst, src); | 1594 | const coerced_inst = try sema.coerce(block, wanted_type, air_inst, src); |
| 1595 | const val = try sema.resolveConstValue(block, src, coerced_inst, "types must be comptime known"); | 1595 | const val = try sema.resolveConstValue(block, src, coerced_inst, "types must be comptime-known"); |
| 1596 | var buffer: Value.ToTypeBuffer = undefined; | 1596 | var buffer: Value.ToTypeBuffer = undefined; |
| 1597 | const ty = val.toType(&buffer); | 1597 | const ty = val.toType(&buffer); |
| 1598 | return ty.copy(sema.arena); | 1598 | return ty.copy(sema.arena); |
| ... | @@ -2037,7 +2037,7 @@ fn analyzeAsAlign( | ... | @@ -2037,7 +2037,7 @@ fn analyzeAsAlign( |
| 2037 | src: LazySrcLoc, | 2037 | src: LazySrcLoc, |
| 2038 | air_ref: Air.Inst.Ref, | 2038 | air_ref: Air.Inst.Ref, |
| 2039 | ) !u32 { | 2039 | ) !u32 { |
| 2040 | const alignment_big = try sema.analyzeAsInt(block, src, air_ref, align_ty, "alignment must be comptime known"); | 2040 | const alignment_big = try sema.analyzeAsInt(block, src, air_ref, align_ty, "alignment must be comptime-known"); |
| 2041 | const alignment = @intCast(u32, alignment_big); // We coerce to u16 in the prev line. | 2041 | const alignment = @intCast(u32, alignment_big); // We coerce to u16 in the prev line. |
| 2042 | try sema.validateAlign(block, src, alignment); | 2042 | try sema.validateAlign(block, src, alignment); |
| 2043 | return alignment; | 2043 | return alignment; |
| ... | @@ -2711,7 +2711,7 @@ fn zirEnumDecl( | ... | @@ -2711,7 +2711,7 @@ fn zirEnumDecl( |
| 2711 | // TODO: if we need to report an error here, use a source location | 2711 | // TODO: if we need to report an error here, use a source location |
| 2712 | // that points to this default value expression rather than the struct. | 2712 | // that points to this default value expression rather than the struct. |
| 2713 | // But only resolve the source location if we need to emit a compile error. | 2713 | // But only resolve the source location if we need to emit a compile error. |
| 2714 | const tag_val = (try sema.resolveInstConst(block, src, tag_val_ref, "enum tag value must be comptime known")).val; | 2714 | const tag_val = (try sema.resolveInstConst(block, src, tag_val_ref, "enum tag value must be comptime-known")).val; |
| 2715 | last_tag_val = tag_val; | 2715 | last_tag_val = tag_val; |
| 2716 | const copied_tag_val = try tag_val.copy(decl_arena_allocator); | 2716 | const copied_tag_val = try tag_val.copy(decl_arena_allocator); |
| 2717 | const gop_val = enum_obj.values.getOrPutAssumeCapacityContext(copied_tag_val, .{ | 2717 | const gop_val = enum_obj.values.getOrPutAssumeCapacityContext(copied_tag_val, .{ |
| ... | @@ -3202,7 +3202,7 @@ fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -3202,7 +3202,7 @@ fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 3202 | var ptr_info = alloc_ty.ptrInfo().data; | 3202 | var ptr_info = alloc_ty.ptrInfo().data; |
| 3203 | const elem_ty = ptr_info.pointee_type; | 3203 | const elem_ty = ptr_info.pointee_type; |
| 3204 | | 3204 | |
| 3205 | // Detect if all stores to an `.alloc` were comptime known. | 3205 | // Detect if all stores to an `.alloc` were comptime-known. |
| 3206 | ct: { | 3206 | ct: { |
| 3207 | var search_index: usize = block.instructions.items.len; | 3207 | var search_index: usize = block.instructions.items.len; |
| 3208 | const air_tags = sema.air_instructions.items(.tag); | 3208 | const air_tags = sema.air_instructions.items(.tag); |
| ... | @@ -3419,7 +3419,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -3419,7 +3419,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3419 | if (var_is_mut) { | 3419 | if (var_is_mut) { |
| 3420 | try sema.validateVarType(block, ty_src, final_elem_ty, false); | 3420 | try sema.validateVarType(block, ty_src, final_elem_ty, false); |
| 3421 | } else ct: { | 3421 | } else ct: { |
| 3422 | // Detect if the value is comptime known. In such case, the | 3422 | // Detect if the value is comptime-known. In such case, the |
| 3423 | // last 3 AIR instructions of the block will look like this: | 3423 | // last 3 AIR instructions of the block will look like this: |
| 3424 | // | 3424 | // |
| 3425 | // %a = constant | 3425 | // %a = constant |
| ... | @@ -4326,7 +4326,7 @@ fn zirValidateDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -4326,7 +4326,7 @@ fn zirValidateDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 4326 | const msg = try sema.errMsg( | 4326 | const msg = try sema.errMsg( |
| 4327 | block, | 4327 | block, |
| 4328 | src, | 4328 | src, |
| 4329 | "values of type '{}' must be comptime known, but operand value is runtime known", | 4329 | "values of type '{}' must be comptime-known, but operand value is runtime known", |
| 4330 | .{elem_ty.fmt(sema.mod)}, | 4330 | .{elem_ty.fmt(sema.mod)}, |
| 4331 | ); | 4331 | ); |
| 4332 | errdefer msg.destroy(sema.gpa); | 4332 | errdefer msg.destroy(sema.gpa); |
| ... | @@ -4540,13 +4540,13 @@ fn storeToInferredAllocComptime( | ... | @@ -4540,13 +4540,13 @@ fn storeToInferredAllocComptime( |
| 4540 | return; | 4540 | return; |
| 4541 | } | 4541 | } |
| 4542 | | 4542 | |
| 4543 | return sema.failWithNeededComptime(block, src, "value being stored to a comptime variable must be comptime known"); | 4543 | return sema.failWithNeededComptime(block, src, "value being stored to a comptime variable must be comptime-known"); |
| 4544 | } | 4544 | } |
| 4545 | | 4545 | |
| 4546 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 4546 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4547 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 4547 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 4548 | const src = inst_data.src(); | 4548 | const src = inst_data.src(); |
| 4549 | const quota = @intCast(u32, try sema.resolveInt(block, src, inst_data.operand, Type.u32, "eval branch quota must be comptime known")); | 4549 | const quota = @intCast(u32, try sema.resolveInt(block, src, inst_data.operand, Type.u32, "eval branch quota must be comptime-known")); |
| 4550 | sema.branch_quota = @maximum(sema.branch_quota, quota); | 4550 | sema.branch_quota = @maximum(sema.branch_quota, quota); |
| 4551 | } | 4551 | } |
| 4552 | | 4552 | |
| ... | @@ -4699,7 +4699,7 @@ fn zirCompileError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -4699,7 +4699,7 @@ fn zirCompileError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 4699 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 4699 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 4700 | const src = inst_data.src(); | 4700 | const src = inst_data.src(); |
| 4701 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 4701 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 4702 | const msg = try sema.resolveConstString(block, operand_src, inst_data.operand, "compile error string must be comptime known"); | 4702 | const msg = try sema.resolveConstString(block, operand_src, inst_data.operand, "compile error string must be comptime-known"); |
| 4703 | return sema.fail(block, src, "{s}", .{msg}); | 4703 | return sema.fail(block, src, "{s}", .{msg}); |
| 4704 | } | 4704 | } |
| 4705 | | 4705 | |
| ... | @@ -5146,7 +5146,7 @@ fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -5146,7 +5146,7 @@ fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 5146 | const src = inst_data.src(); | 5146 | const src = inst_data.src(); |
| 5147 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 5147 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5148 | const options_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 5148 | const options_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 5149 | const operand = try sema.resolveInstConst(block, operand_src, extra.operand, "export target must be comptime known"); | 5149 | const operand = try sema.resolveInstConst(block, operand_src, extra.operand, "export target must be comptime-known"); |
| 5150 | const options = sema.resolveExportOptions(block, .unneeded, extra.options) catch |err| switch (err) { | 5150 | const options = sema.resolveExportOptions(block, .unneeded, extra.options) catch |err| switch (err) { |
| 5151 | error.NeededSourceLocation => { | 5151 | error.NeededSourceLocation => { |
| 5152 | _ = try sema.resolveExportOptions(block, options_src, extra.options); | 5152 | _ = try sema.resolveExportOptions(block, options_src, extra.options); |
| ... | @@ -5287,7 +5287,7 @@ fn zirSetAlignStack(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst | ... | @@ -5287,7 +5287,7 @@ fn zirSetAlignStack(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst |
| 5287 | fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 5287 | fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5288 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5288 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5289 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 5289 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5290 | const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setCold must be comptime known"); | 5290 | const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setCold must be comptime-known"); |
| 5291 | const func = sema.func orelse return; // does nothing outside a function | 5291 | const func = sema.func orelse return; // does nothing outside a function |
| 5292 | func.is_cold = is_cold; | 5292 | func.is_cold = is_cold; |
| 5293 | } | 5293 | } |
| ... | @@ -5295,13 +5295,13 @@ fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi | ... | @@ -5295,13 +5295,13 @@ fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi |
| 5295 | fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { | 5295 | fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { |
| 5296 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 5296 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 5297 | const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; | 5297 | const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; |
| 5298 | block.float_mode = try sema.resolveBuiltinEnum(block, src, extra.operand, "FloatMode", "operand to @setFloatMode must be comptime known"); | 5298 | block.float_mode = try sema.resolveBuiltinEnum(block, src, extra.operand, "FloatMode", "operand to @setFloatMode must be comptime-known"); |
| 5299 | } | 5299 | } |
| 5300 | | 5300 | |
| 5301 | fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 5301 | fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5302 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 5302 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 5303 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 5303 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 5304 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setRuntimeSafety must be comptime known"); | 5304 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setRuntimeSafety must be comptime-known"); |
| 5305 | } | 5305 | } |
| 5306 | | 5306 | |
| 5307 | fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { | 5307 | fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { |
| ... | @@ -5309,7 +5309,7 @@ fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) Co | ... | @@ -5309,7 +5309,7 @@ fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) Co |
| 5309 | | 5309 | |
| 5310 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 5310 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 5311 | const order_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; | 5311 | const order_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; |
| 5312 | const order = try sema.resolveAtomicOrder(block, order_src, extra.operand, "atomic order of @fence must be comptime known"); | 5312 | const order = try sema.resolveAtomicOrder(block, order_src, extra.operand, "atomic order of @fence must be comptime-known"); |
| 5313 | | 5313 | |
| 5314 | if (@enumToInt(order) < @enumToInt(std.builtin.AtomicOrder.Acquire)) { | 5314 | if (@enumToInt(order) < @enumToInt(std.builtin.AtomicOrder.Acquire)) { |
| 5315 | return sema.fail(block, order_src, "atomic ordering must be Acquire or stricter", .{}); | 5315 | return sema.fail(block, order_src, "atomic ordering must be Acquire or stricter", .{}); |
| ... | @@ -5946,7 +5946,7 @@ fn analyzeCall( | ... | @@ -5946,7 +5946,7 @@ fn analyzeCall( |
| 5946 | } | 5946 | } |
| 5947 | | 5947 | |
| 5948 | const result: Air.Inst.Ref = if (is_inline_call) res: { | 5948 | const result: Air.Inst.Ref = if (is_inline_call) res: { |
| 5949 | const func_val = sema.resolveConstValue(block, func_src, func, "function being called at comptime must be comptime known") catch |err| { | 5949 | const func_val = sema.resolveConstValue(block, func_src, func, "function being called at comptime must be comptime-known") catch |err| { |
| 5950 | if (err == error.AnalysisFail and sema.err != null) { | 5950 | if (err == error.AnalysisFail and sema.err != null) { |
| 5951 | try sema.addComptimeReturnTypeNote(block, func, func_src, func_ty_info.return_type, sema.err.?, comptime_only_ret_ty); | 5951 | try sema.addComptimeReturnTypeNote(block, func, func_src, func_ty_info.return_type, sema.err.?, comptime_only_ret_ty); |
| 5952 | } | 5952 | } |
| ... | @@ -6343,7 +6343,7 @@ fn analyzeInlineCallArg( | ... | @@ -6343,7 +6343,7 @@ fn analyzeInlineCallArg( |
| 6343 | new_fn_info.param_types[arg_i.*] = param_ty; | 6343 | new_fn_info.param_types[arg_i.*] = param_ty; |
| 6344 | const uncasted_arg = uncasted_args[arg_i.*]; | 6344 | const uncasted_arg = uncasted_args[arg_i.*]; |
| 6345 | if (try sema.typeRequiresComptime(param_ty)) { | 6345 | if (try sema.typeRequiresComptime(param_ty)) { |
| 6346 | _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime-only type must be comptime known") catch |err| { | 6346 | _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime-only type must be comptime-known") catch |err| { |
| 6347 | if (err == error.AnalysisFail and sema.err != null) { | 6347 | if (err == error.AnalysisFail and sema.err != null) { |
| 6348 | try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty); | 6348 | try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty); |
| 6349 | } | 6349 | } |
| ... | @@ -6354,7 +6354,7 @@ fn analyzeInlineCallArg( | ... | @@ -6354,7 +6354,7 @@ fn analyzeInlineCallArg( |
| 6354 | try sema.inst_map.putNoClobber(sema.gpa, inst, casted_arg); | 6354 | try sema.inst_map.putNoClobber(sema.gpa, inst, casted_arg); |
| 6355 | | 6355 | |
| 6356 | if (is_comptime_call) { | 6356 | if (is_comptime_call) { |
| 6357 | const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, casted_arg, "argument to function being called at comptime must be comptime known") catch |err| { | 6357 | const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, casted_arg, "argument to function being called at comptime must be comptime-known") catch |err| { |
| 6358 | if (err == error.AnalysisFail and sema.err != null) { | 6358 | if (err == error.AnalysisFail and sema.err != null) { |
| 6359 | try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty); | 6359 | try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty); |
| 6360 | } | 6360 | } |
| ... | @@ -6389,7 +6389,7 @@ fn analyzeInlineCallArg( | ... | @@ -6389,7 +6389,7 @@ fn analyzeInlineCallArg( |
| 6389 | try sema.inst_map.putNoClobber(sema.gpa, inst, uncasted_arg); | 6389 | try sema.inst_map.putNoClobber(sema.gpa, inst, uncasted_arg); |
| 6390 | | 6390 | |
| 6391 | if (is_comptime_call) { | 6391 | if (is_comptime_call) { |
| 6392 | const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to function being called at comptime must be comptime known") catch |err| { | 6392 | const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to function being called at comptime must be comptime-known") catch |err| { |
| 6393 | if (err == error.AnalysisFail and sema.err != null) { | 6393 | if (err == error.AnalysisFail and sema.err != null) { |
| 6394 | try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty); | 6394 | try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty); |
| 6395 | } | 6395 | } |
| ... | @@ -6475,7 +6475,7 @@ fn instantiateGenericCall( | ... | @@ -6475,7 +6475,7 @@ fn instantiateGenericCall( |
| 6475 | const mod = sema.mod; | 6475 | const mod = sema.mod; |
| 6476 | const gpa = sema.gpa; | 6476 | const gpa = sema.gpa; |
| 6477 | | 6477 | |
| 6478 | const func_val = try sema.resolveConstValue(block, func_src, func, "generic function being called must be comptime known"); | 6478 | const func_val = try sema.resolveConstValue(block, func_src, func, "generic function being called must be comptime-known"); |
| 6479 | const module_fn = switch (func_val.tag()) { | 6479 | const module_fn = switch (func_val.tag()) { |
| 6480 | .function => func_val.castTag(.function).?.data, | 6480 | .function => func_val.castTag(.function).?.data, |
| 6481 | .decl_ref => mod.declPtr(func_val.castTag(.decl_ref).?.data).val.castTag(.function).?.data, | 6481 | .decl_ref => mod.declPtr(func_val.castTag(.decl_ref).?.data).val.castTag(.function).?.data, |
| ... | @@ -6967,7 +6967,7 @@ fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! | ... | @@ -6967,7 +6967,7 @@ fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 6967 | const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 6967 | const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 6968 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 6968 | const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 6969 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 6969 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 6970 | const len = try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector length must be comptime known"); | 6970 | const len = try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector length must be comptime-known"); |
| 6971 | const elem_type = try sema.resolveType(block, elem_type_src, extra.rhs); | 6971 | const elem_type = try sema.resolveType(block, elem_type_src, extra.rhs); |
| 6972 | try sema.checkVectorElemType(block, elem_type_src, elem_type); | 6972 | try sema.checkVectorElemType(block, elem_type_src, elem_type); |
| 6973 | const vector_type = try Type.Tag.vector.create(sema.arena, .{ | 6973 | const vector_type = try Type.Tag.vector.create(sema.arena, .{ |
| ... | @@ -6985,7 +6985,7 @@ fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -6985,7 +6985,7 @@ fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 6985 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 6985 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 6986 | const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node }; | 6986 | const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node }; |
| 6987 | const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node }; | 6987 | const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node }; |
| 6988 | const len = try sema.resolveInt(block, len_src, extra.lhs, Type.usize, "array length must be comptime known"); | 6988 | const len = try sema.resolveInt(block, len_src, extra.lhs, Type.usize, "array length must be comptime-known"); |
| 6989 | const elem_type = try sema.resolveType(block, elem_src, extra.rhs); | 6989 | const elem_type = try sema.resolveType(block, elem_src, extra.rhs); |
| 6990 | const array_ty = try Type.array(sema.arena, len, null, elem_type, sema.mod); | 6990 | const array_ty = try Type.array(sema.arena, len, null, elem_type, sema.mod); |
| 6991 | | 6991 | |
| ... | @@ -7001,11 +7001,11 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil | ... | @@ -7001,11 +7001,11 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7001 | const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node }; | 7001 | const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node }; |
| 7002 | const sentinel_src: LazySrcLoc = .{ .node_offset_array_type_sentinel = inst_data.src_node }; | 7002 | const sentinel_src: LazySrcLoc = .{ .node_offset_array_type_sentinel = inst_data.src_node }; |
| 7003 | const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node }; | 7003 | const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node }; |
| 7004 | const len = try sema.resolveInt(block, len_src, extra.len, Type.usize, "array length must be comptime known"); | 7004 | const len = try sema.resolveInt(block, len_src, extra.len, Type.usize, "array length must be comptime-known"); |
| 7005 | const elem_type = try sema.resolveType(block, elem_src, extra.elem_type); | 7005 | const elem_type = try sema.resolveType(block, elem_src, extra.elem_type); |
| 7006 | const uncasted_sentinel = try sema.resolveInst(extra.sentinel); | 7006 | const uncasted_sentinel = try sema.resolveInst(extra.sentinel); |
| 7007 | const sentinel = try sema.coerce(block, elem_type, uncasted_sentinel, sentinel_src); | 7007 | const sentinel = try sema.coerce(block, elem_type, uncasted_sentinel, sentinel_src); |
| 7008 | const sentinel_val = try sema.resolveConstValue(block, sentinel_src, sentinel, "array sentinel value must be comptime known"); | 7008 | const sentinel_val = try sema.resolveConstValue(block, sentinel_src, sentinel, "array sentinel value must be comptime-known"); |
| 7009 | const array_ty = try Type.array(sema.arena, len, sentinel_val, elem_type, sema.mod); | 7009 | const array_ty = try Type.array(sema.arena, len, sentinel_val, elem_type, sema.mod); |
| 7010 | | 7010 | |
| 7011 | return sema.addType(array_ty); | 7011 | return sema.addType(array_ty); |
| ... | @@ -7703,7 +7703,7 @@ fn zirFunc( | ... | @@ -7703,7 +7703,7 @@ fn zirFunc( |
| 7703 | const ret_ty_body = sema.code.extra[extra_index..][0..extra.data.ret_body_len]; | 7703 | const ret_ty_body = sema.code.extra[extra_index..][0..extra.data.ret_body_len]; |
| 7704 | extra_index += ret_ty_body.len; | 7704 | extra_index += ret_ty_body.len; |
| 7705 | | 7705 | |
| 7706 | const ret_ty_val = try sema.resolveGenericBody(block, ret_ty_src, ret_ty_body, inst, Type.type, "return type must be comptime known"); | 7706 | const ret_ty_val = try sema.resolveGenericBody(block, ret_ty_src, ret_ty_body, inst, Type.type, "return type must be comptime-known"); |
| 7707 | var buffer: Value.ToTypeBuffer = undefined; | 7707 | var buffer: Value.ToTypeBuffer = undefined; |
| 7708 | break :blk try ret_ty_val.toType(&buffer).copy(sema.arena); | 7708 | break :blk try ret_ty_val.toType(&buffer).copy(sema.arena); |
| 7709 | }, | 7709 | }, |
| ... | @@ -8530,7 +8530,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -8530,7 +8530,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 8530 | const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 8530 | const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 8531 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; | 8531 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; |
| 8532 | const object = try sema.resolveInst(extra.lhs); | 8532 | const object = try sema.resolveInst(extra.lhs); |
| 8533 | const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime known"); | 8533 | const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime-known"); |
| 8534 | return sema.fieldVal(block, src, object, field_name, field_name_src); | 8534 | return sema.fieldVal(block, src, object, field_name, field_name_src); |
| 8535 | } | 8535 | } |
| 8536 | | 8536 | |
| ... | @@ -8543,7 +8543,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -8543,7 +8543,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 8543 | const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 8543 | const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 8544 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; | 8544 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; |
| 8545 | const object_ptr = try sema.resolveInst(extra.lhs); | 8545 | const object_ptr = try sema.resolveInst(extra.lhs); |
| 8546 | const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime known"); | 8546 | const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime-known"); |
| 8547 | return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src, false); | 8547 | return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src, false); |
| 8548 | } | 8548 | } |
| 8549 | | 8549 | |
| ... | @@ -8555,7 +8555,7 @@ fn zirFieldCallBindNamed(sema: *Sema, block: *Block, extended: Zir.Inst.Extended | ... | @@ -8555,7 +8555,7 @@ fn zirFieldCallBindNamed(sema: *Sema, block: *Block, extended: Zir.Inst.Extended |
| 8555 | const src = LazySrcLoc.nodeOffset(extra.node); | 8555 | const src = LazySrcLoc.nodeOffset(extra.node); |
| 8556 | const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node }; | 8556 | const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node }; |
| 8557 | const object_ptr = try sema.resolveInst(extra.lhs); | 8557 | const object_ptr = try sema.resolveInst(extra.lhs); |
| 8558 | const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime known"); | 8558 | const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime-known"); |
| 8559 | return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src); | 8559 | return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src); |
| 8560 | } | 8560 | } |
| 8561 | | 8561 | |
| ... | @@ -10282,7 +10282,7 @@ fn resolveSwitchItemVal( | ... | @@ -10282,7 +10282,7 @@ fn resolveSwitchItemVal( |
| 10282 | const src = switch_prong_src.resolve(sema.gpa, sema.mod.declPtr(block.src_decl), switch_node_offset, range_expand); | 10282 | const src = switch_prong_src.resolve(sema.gpa, sema.mod.declPtr(block.src_decl), switch_node_offset, range_expand); |
| 10283 | return TypedValue{ | 10283 | return TypedValue{ |
| 10284 | .ty = item_ty, | 10284 | .ty = item_ty, |
| 10285 | .val = try sema.resolveConstValue(block, src, item, "switch prong values must be comptime known"), | 10285 | .val = try sema.resolveConstValue(block, src, item, "switch prong values must be comptime-known"), |
| 10286 | }; | 10286 | }; |
| 10287 | }, | 10287 | }, |
| 10288 | else => |e| return e, | 10288 | else => |e| return e, |
| ... | @@ -10571,7 +10571,7 @@ fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -10571,7 +10571,7 @@ fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 10571 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 10571 | const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 10572 | const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 10572 | const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 10573 | const unresolved_ty = try sema.resolveType(block, ty_src, extra.lhs); | 10573 | const unresolved_ty = try sema.resolveType(block, ty_src, extra.lhs); |
| 10574 | const field_name = try sema.resolveConstString(block, name_src, extra.rhs, "field name must be comptime known"); | 10574 | const field_name = try sema.resolveConstString(block, name_src, extra.rhs, "field name must be comptime-known"); |
| 10575 | const ty = try sema.resolveTypeFields(block, ty_src, unresolved_ty); | 10575 | const ty = try sema.resolveTypeFields(block, ty_src, unresolved_ty); |
| 10576 | | 10576 | |
| 10577 | const has_field = hf: { | 10577 | const has_field = hf: { |
| ... | @@ -10613,7 +10613,7 @@ fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -10613,7 +10613,7 @@ fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 10613 | const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 10613 | const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 10614 | const rhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 10614 | const rhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 10615 | const container_type = try sema.resolveType(block, lhs_src, extra.lhs); | 10615 | const container_type = try sema.resolveType(block, lhs_src, extra.lhs); |
| 10616 | const decl_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "decl name must be comptime known"); | 10616 | const decl_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "decl name must be comptime-known"); |
| 10617 | | 10617 | |
| 10618 | try checkNamespaceType(sema, block, lhs_src, container_type); | 10618 | try checkNamespaceType(sema, block, lhs_src, container_type); |
| 10619 | | 10619 | |
| ... | @@ -10677,7 +10677,7 @@ fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -10677,7 +10677,7 @@ fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 10677 | const mod = sema.mod; | 10677 | const mod = sema.mod; |
| 10678 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 10678 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 10679 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 10679 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 10680 | const name = try sema.resolveConstString(block, operand_src, inst_data.operand, "file path name must be comptime known"); | 10680 | const name = try sema.resolveConstString(block, operand_src, inst_data.operand, "file path name must be comptime-known"); |
| 10681 | | 10681 | |
| 10682 | const embed_file = mod.embedFile(block.getFileScope(), name) catch |err| switch (err) { | 10682 | const embed_file = mod.embedFile(block.getFileScope(), name) catch |err| switch (err) { |
| 10683 | error.ImportOutsidePkgPath => { | 10683 | error.ImportOutsidePkgPath => { |
| ... | @@ -10792,7 +10792,7 @@ fn zirShl( | ... | @@ -10792,7 +10792,7 @@ fn zirShl( |
| 10792 | if (lhs_val.isUndef()) return sema.addConstUndef(lhs_ty); | 10792 | if (lhs_val.isUndef()) return sema.addConstUndef(lhs_ty); |
| 10793 | const rhs_val = maybe_rhs_val orelse { | 10793 | const rhs_val = maybe_rhs_val orelse { |
| 10794 | if (scalar_ty.zigTypeTag() == .ComptimeInt) { | 10794 | if (scalar_ty.zigTypeTag() == .ComptimeInt) { |
| 10795 | return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be a comptime known", .{}); | 10795 | return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{}); |
| 10796 | } | 10796 | } |
| 10797 | break :rs rhs_src; | 10797 | break :rs rhs_src; |
| 10798 | }; | 10798 | }; |
| ... | @@ -10974,7 +10974,7 @@ fn zirShr( | ... | @@ -10974,7 +10974,7 @@ fn zirShr( |
| 10974 | } else rhs_src; | 10974 | } else rhs_src; |
| 10975 | | 10975 | |
| 10976 | if (maybe_rhs_val == null and scalar_ty.zigTypeTag() == .ComptimeInt) { | 10976 | if (maybe_rhs_val == null and scalar_ty.zigTypeTag() == .ComptimeInt) { |
| 10977 | return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be a comptime known", .{}); | 10977 | return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{}); |
| 10978 | } | 10978 | } |
| 10979 | | 10979 | |
| 10980 | try sema.requireRuntimeBlock(block, src, runtime_src); | 10980 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| ... | @@ -11244,8 +11244,8 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -11244,8 +11244,8 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 11244 | const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val); | 11244 | const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val); |
| 11245 | const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src); | 11245 | const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src); |
| 11246 | const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src); | 11246 | const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src); |
| 11247 | const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime known"); | 11247 | const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime-known"); |
| 11248 | const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime known"); | 11248 | const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime-known"); |
| 11249 | if (try sema.valuesEqual(block, src, lhs_sent_casted_val, rhs_sent_casted_val, resolved_elem_ty)) { | 11249 | if (try sema.valuesEqual(block, src, lhs_sent_casted_val, rhs_sent_casted_val, resolved_elem_ty)) { |
| 11250 | break :s lhs_sent_casted_val; | 11250 | break :s lhs_sent_casted_val; |
| 11251 | } else { | 11251 | } else { |
| ... | @@ -11253,14 +11253,14 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -11253,14 +11253,14 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 11253 | } | 11253 | } |
| 11254 | } else { | 11254 | } else { |
| 11255 | const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src); | 11255 | const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src); |
| 11256 | const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime known"); | 11256 | const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime-known"); |
| 11257 | break :s lhs_sent_casted_val; | 11257 | break :s lhs_sent_casted_val; |
| 11258 | } | 11258 | } |
| 11259 | } else { | 11259 | } else { |
| 11260 | if (rhs_info.sentinel) |rhs_sent_val| { | 11260 | if (rhs_info.sentinel) |rhs_sent_val| { |
| 11261 | const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val); | 11261 | const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val); |
| 11262 | const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src); | 11262 | const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src); |
| 11263 | const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime known"); | 11263 | const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime-known"); |
| 11264 | break :s rhs_sent_casted_val; | 11264 | break :s rhs_sent_casted_val; |
| 11265 | } else { | 11265 | } else { |
| 11266 | break :s null; | 11266 | break :s null; |
| ... | @@ -11381,7 +11381,7 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins | ... | @@ -11381,7 +11381,7 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins |
| 11381 | // has a sentinel, and this code should compute the length based | 11381 | // has a sentinel, and this code should compute the length based |
| 11382 | // on the sentinel value. | 11382 | // on the sentinel value. |
| 11383 | .Slice, .Many => { | 11383 | .Slice, .Many => { |
| 11384 | const val = try sema.resolveConstValue(block, src, operand, "slice value being concatenated must be comptime known"); | 11384 | const val = try sema.resolveConstValue(block, src, operand, "slice value being concatenated must be comptime-known"); |
| 11385 | return Type.ArrayInfo{ | 11385 | return Type.ArrayInfo{ |
| 11386 | .elem_type = ptr_info.pointee_type, | 11386 | .elem_type = ptr_info.pointee_type, |
| 11387 | .sentinel = ptr_info.sentinel, | 11387 | .sentinel = ptr_info.sentinel, |
| ... | @@ -11482,7 +11482,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -11482,7 +11482,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 11482 | const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; | 11482 | const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; |
| 11483 | | 11483 | |
| 11484 | // In `**` rhs must be comptime-known, but lhs can be runtime-known | 11484 | // In `**` rhs must be comptime-known, but lhs can be runtime-known |
| 11485 | const factor = try sema.resolveInt(block, rhs_src, extra.rhs, Type.usize, "array multiplication factor must be comptime known"); | 11485 | const factor = try sema.resolveInt(block, rhs_src, extra.rhs, Type.usize, "array multiplication factor must be comptime-known"); |
| 11486 | | 11486 | |
| 11487 | if (lhs_ty.isTuple()) { | 11487 | if (lhs_ty.isTuple()) { |
| 11488 | return sema.analyzeTupleMul(block, inst_data.src_node, lhs, factor); | 11488 | return sema.analyzeTupleMul(block, inst_data.src_node, lhs, factor); |
| ... | @@ -15812,14 +15812,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -15812,14 +15812,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 15812 | const sentinel = if (inst_data.flags.has_sentinel) blk: { | 15812 | const sentinel = if (inst_data.flags.has_sentinel) blk: { |
| 15813 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 15813 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 15814 | extra_i += 1; | 15814 | extra_i += 1; |
| 15815 | break :blk (try sema.resolveInstConst(block, sentinel_src, ref, "pointer sentinel value must be comptime known")).val; | 15815 | break :blk (try sema.resolveInstConst(block, sentinel_src, ref, "pointer sentinel value must be comptime-known")).val; |
| 15816 | } else null; | 15816 | } else null; |
| 15817 | | 15817 | |
| 15818 | const abi_align: u32 = if (inst_data.flags.has_align) blk: { | 15818 | const abi_align: u32 = if (inst_data.flags.has_align) blk: { |
| 15819 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 15819 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 15820 | extra_i += 1; | 15820 | extra_i += 1; |
| 15821 | const coerced = try sema.coerce(block, Type.u32, try sema.resolveInst(ref), align_src); | 15821 | const coerced = try sema.coerce(block, Type.u32, try sema.resolveInst(ref), align_src); |
| 15822 | const val = try sema.resolveConstValue(block, align_src, coerced, "pointer alignment must be comptime known"); | 15822 | const val = try sema.resolveConstValue(block, align_src, coerced, "pointer alignment must be comptime-known"); |
| 15823 | // Check if this happens to be the lazy alignment of our element type, in | 15823 | // Check if this happens to be the lazy alignment of our element type, in |
| 15824 | // which case we can make this 0 without resolving it. | 15824 | // which case we can make this 0 without resolving it. |
| 15825 | if (val.castTag(.lazy_align)) |payload| { | 15825 | if (val.castTag(.lazy_align)) |payload| { |
| ... | @@ -15841,14 +15841,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -15841,14 +15841,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 15841 | const bit_offset = if (inst_data.flags.has_bit_range) blk: { | 15841 | const bit_offset = if (inst_data.flags.has_bit_range) blk: { |
| 15842 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 15842 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 15843 | extra_i += 1; | 15843 | extra_i += 1; |
| 15844 | const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, Type.u16, "pointer bit-offset must be comptime known"); | 15844 | const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, Type.u16, "pointer bit-offset must be comptime-known"); |
| 15845 | break :blk @intCast(u16, bit_offset); | 15845 | break :blk @intCast(u16, bit_offset); |
| 15846 | } else 0; | 15846 | } else 0; |
| 15847 | | 15847 | |
| 15848 | const host_size: u16 = if (inst_data.flags.has_bit_range) blk: { | 15848 | const host_size: u16 = if (inst_data.flags.has_bit_range) blk: { |
| 15849 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 15849 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 15850 | extra_i += 1; | 15850 | extra_i += 1; |
| 15851 | const host_size = try sema.resolveInt(block, hostsize_src, ref, Type.u16, "pointer host size must be comptime known"); | 15851 | const host_size = try sema.resolveInt(block, hostsize_src, ref, Type.u16, "pointer host size must be comptime-known"); |
| 15852 | break :blk @intCast(u16, host_size); | 15852 | break :blk @intCast(u16, host_size); |
| 15853 | } else 0; | 15853 | } else 0; |
| 15854 | | 15854 | |
| ... | @@ -15972,7 +15972,7 @@ fn zirUnionInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -15972,7 +15972,7 @@ fn zirUnionInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 15972 | const init_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; | 15972 | const init_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; |
| 15973 | const extra = sema.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data; | 15973 | const extra = sema.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data; |
| 15974 | const union_ty = try sema.resolveType(block, ty_src, extra.union_type); | 15974 | const union_ty = try sema.resolveType(block, ty_src, extra.union_type); |
| 15975 | const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "name of field being initialized must be comptime known"); | 15975 | const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "name of field being initialized must be comptime-known"); |
| 15976 | const init = try sema.resolveInst(extra.init); | 15976 | const init = try sema.resolveInst(extra.init); |
| 15977 | return sema.unionInit(block, init, init_src, union_ty, ty_src, field_name, field_src); | 15977 | return sema.unionInit(block, init, init_src, union_ty, ty_src, field_name, field_src); |
| 15978 | } | 15978 | } |
| ... | @@ -16070,7 +16070,7 @@ fn zirStructInit( | ... | @@ -16070,7 +16070,7 @@ fn zirStructInit( |
| 16070 | field_inits[field_index] = try sema.resolveInst(item.data.init); | 16070 | field_inits[field_index] = try sema.resolveInst(item.data.init); |
| 16071 | if (!is_packed) if (resolved_ty.structFieldValueComptime(field_index)) |default_value| { | 16071 | if (!is_packed) if (resolved_ty.structFieldValueComptime(field_index)) |default_value| { |
| 16072 | const init_val = (try sema.resolveMaybeUndefVal(block, field_src, field_inits[field_index])) orelse { | 16072 | const init_val = (try sema.resolveMaybeUndefVal(block, field_src, field_inits[field_index])) orelse { |
| 16073 | return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime known"); | 16073 | return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime-known"); |
| 16074 | }; | 16074 | }; |
| 16075 | | 16075 | |
| 16076 | if (!init_val.eql(default_value, resolved_ty.structFieldType(field_index), sema.mod)) { | 16076 | if (!init_val.eql(default_value, resolved_ty.structFieldType(field_index), sema.mod)) { |
| ... | @@ -16581,7 +16581,7 @@ fn zirFieldTypeRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -16581,7 +16581,7 @@ fn zirFieldTypeRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 16581 | const ty_src = inst_data.src(); | 16581 | const ty_src = inst_data.src(); |
| 16582 | const field_src = inst_data.src(); | 16582 | const field_src = inst_data.src(); |
| 16583 | const aggregate_ty = try sema.resolveType(block, ty_src, extra.container_type); | 16583 | const aggregate_ty = try sema.resolveType(block, ty_src, extra.container_type); |
| 16584 | const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "field name must be comptime known"); | 16584 | const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "field name must be comptime-known"); |
| 16585 | return sema.fieldType(block, aggregate_ty, field_name, field_src, ty_src); | 16585 | return sema.fieldType(block, aggregate_ty, field_name, field_src, ty_src); |
| 16586 | } | 16586 | } |
| 16587 | | 16587 | |
| ... | @@ -16862,7 +16862,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in | ... | @@ -16862,7 +16862,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in |
| 16862 | const uncasted_operand = try sema.resolveInst(extra.operand); | 16862 | const uncasted_operand = try sema.resolveInst(extra.operand); |
| 16863 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; | 16863 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; |
| 16864 | const type_info = try sema.coerce(block, type_info_ty, uncasted_operand, operand_src); | 16864 | const type_info = try sema.coerce(block, type_info_ty, uncasted_operand, operand_src); |
| 16865 | const val = try sema.resolveConstValue(block, operand_src, type_info, "operand to @Type must be comptime known"); | 16865 | const val = try sema.resolveConstValue(block, operand_src, type_info, "operand to @Type must be comptime-known"); |
| 16866 | const union_val = val.cast(Value.Payload.Union).?.data; | 16866 | const union_val = val.cast(Value.Payload.Union).?.data; |
| 16867 | const target = mod.getTarget(); | 16867 | const target = mod.getTarget(); |
| 16868 | const tag_index = type_info_ty.unionTagFieldIndex(union_val.tag, mod).?; | 16868 | const tag_index = type_info_ty.unionTagFieldIndex(union_val.tag, mod).?; |
| ... | @@ -17798,7 +17798,7 @@ fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! | ... | @@ -17798,7 +17798,7 @@ fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 17798 | const result_val = try sema.floatToInt(block, operand_src, val, operand_ty, dest_ty); | 17798 | const result_val = try sema.floatToInt(block, operand_src, val, operand_ty, dest_ty); |
| 17799 | return sema.addConstant(dest_ty, result_val); | 17799 | return sema.addConstant(dest_ty, result_val); |
| 17800 | } else if (dest_ty.zigTypeTag() == .ComptimeInt) { | 17800 | } else if (dest_ty.zigTypeTag() == .ComptimeInt) { |
| 17801 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_int' must be comptime known"); | 17801 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_int' must be comptime-known"); |
| 17802 | } | 17802 | } |
| 17803 | | 17803 | |
| 17804 | try sema.requireRuntimeBlock(block, inst_data.src(), operand_src); | 17804 | try sema.requireRuntimeBlock(block, inst_data.src(), operand_src); |
| ... | @@ -17831,7 +17831,7 @@ fn zirIntToFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! | ... | @@ -17831,7 +17831,7 @@ fn zirIntToFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 17831 | const result_val = try val.intToFloatAdvanced(sema.arena, operand_ty, dest_ty, target, sema.kit(block, operand_src)); | 17831 | const result_val = try val.intToFloatAdvanced(sema.arena, operand_ty, dest_ty, target, sema.kit(block, operand_src)); |
| 17832 | return sema.addConstant(dest_ty, result_val); | 17832 | return sema.addConstant(dest_ty, result_val); |
| 17833 | } else if (dest_ty.zigTypeTag() == .ComptimeFloat) { | 17833 | } else if (dest_ty.zigTypeTag() == .ComptimeFloat) { |
| 17834 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_float' must be comptime known"); | 17834 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_float' must be comptime-known"); |
| 17835 | } | 17835 | } |
| 17836 | | 17836 | |
| 17837 | try sema.requireRuntimeBlock(block, inst_data.src(), operand_src); | 17837 | try sema.requireRuntimeBlock(block, inst_data.src(), operand_src); |
| ... | @@ -18411,7 +18411,7 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6 | ... | @@ -18411,7 +18411,7 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6 |
| 18411 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 18411 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 18412 | | 18412 | |
| 18413 | const ty = try sema.resolveType(block, lhs_src, extra.lhs); | 18413 | const ty = try sema.resolveType(block, lhs_src, extra.lhs); |
| 18414 | const field_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "name of field must be comptime known"); | 18414 | const field_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "name of field must be comptime-known"); |
| 18415 | const target = sema.mod.getTarget(); | 18415 | const target = sema.mod.getTarget(); |
| 18416 | | 18416 | |
| 18417 | try sema.resolveTypeLayout(block, lhs_src, ty); | 18417 | try sema.resolveTypeLayout(block, lhs_src, ty); |
| ... | @@ -18882,19 +18882,19 @@ fn resolveExportOptions( | ... | @@ -18882,19 +18882,19 @@ fn resolveExportOptions( |
| 18882 | const visibility_src = sema.maybeOptionsSrc(block, src, "visibility"); | 18882 | const visibility_src = sema.maybeOptionsSrc(block, src, "visibility"); |
| 18883 | | 18883 | |
| 18884 | const name_operand = try sema.fieldVal(block, src, options, "name", name_src); | 18884 | const name_operand = try sema.fieldVal(block, src, options, "name", name_src); |
| 18885 | const name_val = try sema.resolveConstValue(block, name_src, name_operand, "name of exported value must be comptime known"); | 18885 | const name_val = try sema.resolveConstValue(block, name_src, name_operand, "name of exported value must be comptime-known"); |
| 18886 | const name_ty = Type.initTag(.const_slice_u8); | 18886 | const name_ty = Type.initTag(.const_slice_u8); |
| 18887 | const name = try name_val.toAllocatedBytes(name_ty, sema.arena, sema.mod); | 18887 | const name = try name_val.toAllocatedBytes(name_ty, sema.arena, sema.mod); |
| 18888 | | 18888 | |
| 18889 | const linkage_operand = try sema.fieldVal(block, src, options, "linkage", linkage_src); | 18889 | const linkage_operand = try sema.fieldVal(block, src, options, "linkage", linkage_src); |
| 18890 | const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_operand, "linkage of exported value must be comptime known"); | 18890 | const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_operand, "linkage of exported value must be comptime-known"); |
| 18891 | const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage); | 18891 | const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage); |
| 18892 | | 18892 | |
| 18893 | const section = try sema.fieldVal(block, src, options, "section", section_src); | 18893 | const section = try sema.fieldVal(block, src, options, "section", section_src); |
| 18894 | const section_val = try sema.resolveConstValue(block, section_src, section, "linksection of exported value must be comptime known"); | 18894 | const section_val = try sema.resolveConstValue(block, section_src, section, "linksection of exported value must be comptime-known"); |
| 18895 | | 18895 | |
| 18896 | const visibility_operand = try sema.fieldVal(block, src, options, "visibility", visibility_src); | 18896 | const visibility_operand = try sema.fieldVal(block, src, options, "visibility", visibility_src); |
| 18897 | const visibility_val = try sema.resolveConstValue(block, visibility_src, visibility_operand, "visibility of exported value must be comptime known"); | 18897 | const visibility_val = try sema.resolveConstValue(block, visibility_src, visibility_operand, "visibility of exported value must be comptime-known"); |
| 18898 | const visibility = visibility_val.toEnum(std.builtin.SymbolVisibility); | 18898 | const visibility = visibility_val.toEnum(std.builtin.SymbolVisibility); |
| 18899 | | 18899 | |
| 18900 | if (name.len < 1) { | 18900 | if (name.len < 1) { |
| ... | @@ -18950,7 +18950,7 @@ fn resolveAtomicRmwOp( | ... | @@ -18950,7 +18950,7 @@ fn resolveAtomicRmwOp( |
| 18950 | src: LazySrcLoc, | 18950 | src: LazySrcLoc, |
| 18951 | zir_ref: Zir.Inst.Ref, | 18951 | zir_ref: Zir.Inst.Ref, |
| 18952 | ) CompileError!std.builtin.AtomicRmwOp { | 18952 | ) CompileError!std.builtin.AtomicRmwOp { |
| 18953 | return resolveBuiltinEnum(sema, block, src, zir_ref, "AtomicRmwOp", "@atomicRmW operation must be comptime known"); | 18953 | return resolveBuiltinEnum(sema, block, src, zir_ref, "AtomicRmwOp", "@atomicRmW operation must be comptime-known"); |
| 18954 | } | 18954 | } |
| 18955 | | 18955 | |
| 18956 | fn zirCmpxchg( | 18956 | fn zirCmpxchg( |
| ... | @@ -18986,8 +18986,8 @@ fn zirCmpxchg( | ... | @@ -18986,8 +18986,8 @@ fn zirCmpxchg( |
| 18986 | const uncasted_ptr = try sema.resolveInst(extra.ptr); | 18986 | const uncasted_ptr = try sema.resolveInst(extra.ptr); |
| 18987 | const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false); | 18987 | const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false); |
| 18988 | const new_value = try sema.coerce(block, elem_ty, try sema.resolveInst(extra.new_value), new_value_src); | 18988 | const new_value = try sema.coerce(block, elem_ty, try sema.resolveInst(extra.new_value), new_value_src); |
| 18989 | const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, "atomic order of cmpxchg success must be comptime known"); | 18989 | const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, "atomic order of cmpxchg success must be comptime-known"); |
| 18990 | const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, "atomic order of cmpxchg failure must be comptime known"); | 18990 | const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, "atomic order of cmpxchg failure must be comptime-known"); |
| 18991 | | 18991 | |
| 18992 | if (@enumToInt(success_order) < @enumToInt(std.builtin.AtomicOrder.Monotonic)) { | 18992 | if (@enumToInt(success_order) < @enumToInt(std.builtin.AtomicOrder.Monotonic)) { |
| 18993 | return sema.fail(block, success_order_src, "success atomic ordering must be Monotonic or stricter", .{}); | 18993 | return sema.fail(block, success_order_src, "success atomic ordering must be Monotonic or stricter", .{}); |
| ... | @@ -19052,7 +19052,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -19052,7 +19052,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 19052 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 19052 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 19053 | const len_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node }; | 19053 | const len_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node }; |
| 19054 | const scalar_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; | 19054 | const scalar_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; |
| 19055 | const len = @intCast(u32, try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector splat destination length must be comptime known")); | 19055 | const len = @intCast(u32, try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector splat destination length must be comptime-known")); |
| 19056 | const scalar = try sema.resolveInst(extra.rhs); | 19056 | const scalar = try sema.resolveInst(extra.rhs); |
| 19057 | const scalar_ty = sema.typeOf(scalar); | 19057 | const scalar_ty = sema.typeOf(scalar); |
| 19058 | try sema.checkVectorElemType(block, scalar_src, scalar_ty); | 19058 | try sema.checkVectorElemType(block, scalar_src, scalar_ty); |
| ... | @@ -19078,7 +19078,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -19078,7 +19078,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 19078 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 19078 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 19079 | const op_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 19079 | const op_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 19080 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | 19080 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; |
| 19081 | const operation = try sema.resolveBuiltinEnum(block, op_src, extra.lhs, "ReduceOp", "@reduce operation must be comptime known"); | 19081 | const operation = try sema.resolveBuiltinEnum(block, op_src, extra.lhs, "ReduceOp", "@reduce operation must be comptime-known"); |
| 19082 | const operand = try sema.resolveInst(extra.rhs); | 19082 | const operand = try sema.resolveInst(extra.rhs); |
| 19083 | const operand_ty = sema.typeOf(operand); | 19083 | const operand_ty = sema.typeOf(operand); |
| 19084 | const target = sema.mod.getTarget(); | 19084 | const target = sema.mod.getTarget(); |
| ... | @@ -19165,7 +19165,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -19165,7 +19165,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 19165 | .elem_type = Type.@"i32", | 19165 | .elem_type = Type.@"i32", |
| 19166 | }); | 19166 | }); |
| 19167 | mask = try sema.coerce(block, mask_ty, mask, mask_src); | 19167 | mask = try sema.coerce(block, mask_ty, mask, mask_src); |
| 19168 | const mask_val = try sema.resolveConstMaybeUndefVal(block, mask_src, mask, "shuffle mask must be comptime known"); | 19168 | const mask_val = try sema.resolveConstMaybeUndefVal(block, mask_src, mask, "shuffle mask must be comptime-known"); |
| 19169 | return sema.analyzeShuffle(block, inst_data.src_node, elem_ty, a, b, mask_val, @intCast(u32, mask_len)); | 19169 | return sema.analyzeShuffle(block, inst_data.src_node, elem_ty, a, b, mask_val, @intCast(u32, mask_len)); |
| 19170 | } | 19170 | } |
| 19171 | | 19171 | |
| ... | @@ -19433,7 +19433,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! | ... | @@ -19433,7 +19433,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 19433 | const elem_ty = try sema.resolveType(block, elem_ty_src, extra.elem_type); | 19433 | const elem_ty = try sema.resolveType(block, elem_ty_src, extra.elem_type); |
| 19434 | const uncasted_ptr = try sema.resolveInst(extra.ptr); | 19434 | const uncasted_ptr = try sema.resolveInst(extra.ptr); |
| 19435 | const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, true); | 19435 | const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, true); |
| 19436 | const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicLoad must be comptime known"); | 19436 | const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicLoad must be comptime-known"); |
| 19437 | | 19437 | |
| 19438 | switch (order) { | 19438 | switch (order) { |
| 19439 | .Release, .AcqRel => { | 19439 | .Release, .AcqRel => { |
| ... | @@ -19497,7 +19497,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -19497,7 +19497,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 19497 | }, | 19497 | }, |
| 19498 | else => {}, | 19498 | else => {}, |
| 19499 | } | 19499 | } |
| 19500 | const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicRmW must be comptime known"); | 19500 | const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicRmW must be comptime-known"); |
| 19501 | | 19501 | |
| 19502 | if (order == .Unordered) { | 19502 | if (order == .Unordered) { |
| 19503 | return sema.fail(block, order_src, "@atomicRmw atomic ordering must not be Unordered", .{}); | 19503 | return sema.fail(block, order_src, "@atomicRmw atomic ordering must not be Unordered", .{}); |
| ... | @@ -19565,7 +19565,7 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -19565,7 +19565,7 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 19565 | const elem_ty = sema.typeOf(operand); | 19565 | const elem_ty = sema.typeOf(operand); |
| 19566 | const uncasted_ptr = try sema.resolveInst(extra.ptr); | 19566 | const uncasted_ptr = try sema.resolveInst(extra.ptr); |
| 19567 | const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false); | 19567 | const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false); |
| 19568 | const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicStore must be comptime known"); | 19568 | const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicStore must be comptime-known"); |
| 19569 | | 19569 | |
| 19570 | const air_tag: Air.Inst.Tag = switch (order) { | 19570 | const air_tag: Air.Inst.Tag = switch (order) { |
| 19571 | .Acquire, .AcqRel => { | 19571 | .Acquire, .AcqRel => { |
| ... | @@ -19668,11 +19668,11 @@ fn resolveCallOptions( | ... | @@ -19668,11 +19668,11 @@ fn resolveCallOptions( |
| 19668 | const stack_src = sema.maybeOptionsSrc(block, src, "stack"); | 19668 | const stack_src = sema.maybeOptionsSrc(block, src, "stack"); |
| 19669 | | 19669 | |
| 19670 | const modifier = try sema.fieldVal(block, src, options, "modifier", modifier_src); | 19670 | const modifier = try sema.fieldVal(block, src, options, "modifier", modifier_src); |
| 19671 | const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier, "call modifier must be comptime known"); | 19671 | const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier, "call modifier must be comptime-known"); |
| 19672 | const wanted_modifier = modifier_val.toEnum(std.builtin.CallOptions.Modifier); | 19672 | const wanted_modifier = modifier_val.toEnum(std.builtin.CallOptions.Modifier); |
| 19673 | | 19673 | |
| 19674 | const stack = try sema.fieldVal(block, src, options, "stack", stack_src); | 19674 | const stack = try sema.fieldVal(block, src, options, "stack", stack_src); |
| 19675 | const stack_val = try sema.resolveConstValue(block, stack_src, stack, "call stack value must be comptime known"); | 19675 | const stack_val = try sema.resolveConstValue(block, stack_src, stack, "call stack value must be comptime-known"); |
| 19676 | | 19676 | |
| 19677 | if (!stack_val.isNull()) { | 19677 | if (!stack_val.isNull()) { |
| 19678 | return sema.fail(block, stack_src, "TODO: implement @call with stack", .{}); | 19678 | return sema.fail(block, stack_src, "TODO: implement @call with stack", .{}); |
| ... | @@ -19802,7 +19802,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -19802,7 +19802,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr |
| 19802 | const ptr_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; | 19802 | const ptr_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; |
| 19803 | | 19803 | |
| 19804 | const struct_ty = try sema.resolveType(block, ty_src, extra.parent_type); | 19804 | const struct_ty = try sema.resolveType(block, ty_src, extra.parent_type); |
| 19805 | const field_name = try sema.resolveConstString(block, name_src, extra.field_name, "field name must be comptime known"); | 19805 | const field_name = try sema.resolveConstString(block, name_src, extra.field_name, "field name must be comptime-known"); |
| 19806 | const field_ptr = try sema.resolveInst(extra.field_ptr); | 19806 | const field_ptr = try sema.resolveInst(extra.field_ptr); |
| 19807 | const field_ptr_ty = sema.typeOf(field_ptr); | 19807 | const field_ptr_ty = sema.typeOf(field_ptr); |
| 19808 | | 19808 | |
| ... | @@ -20115,7 +20115,7 @@ fn zirVarExtended( | ... | @@ -20115,7 +20115,7 @@ fn zirVarExtended( |
| 20115 | uncasted_init; | 20115 | uncasted_init; |
| 20116 | | 20116 | |
| 20117 | break :blk (try sema.resolveMaybeUndefVal(block, init_src, init)) orelse | 20117 | break :blk (try sema.resolveMaybeUndefVal(block, init_src, init)) orelse |
| 20118 | return sema.failWithNeededComptime(block, init_src, "container level variable initializers must be comptime known"); | 20118 | return sema.failWithNeededComptime(block, init_src, "container level variable initializers must be comptime-known"); |
| 20119 | } else Value.initTag(.unreachable_value); | 20119 | } else Value.initTag(.unreachable_value); |
| 20120 | | 20120 | |
| 20121 | try sema.validateVarType(block, ty_src, var_ty, small.is_extern); | 20121 | try sema.validateVarType(block, ty_src, var_ty, small.is_extern); |
| ... | @@ -20184,7 +20184,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20184,7 +20184,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20184 | const body = sema.code.extra[extra_index..][0..body_len]; | 20184 | const body = sema.code.extra[extra_index..][0..body_len]; |
| 20185 | extra_index += body.len; | 20185 | extra_index += body.len; |
| 20186 | | 20186 | |
| 20187 | const val = try sema.resolveGenericBody(block, align_src, body, inst, Type.u29, "alignment must be comptime known"); | 20187 | const val = try sema.resolveGenericBody(block, align_src, body, inst, Type.u29, "alignment must be comptime-known"); |
| 20188 | if (val.tag() == .generic_poison) { | 20188 | if (val.tag() == .generic_poison) { |
| 20189 | break :blk null; | 20189 | break :blk null; |
| 20190 | } | 20190 | } |
| ... | @@ -20198,7 +20198,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20198,7 +20198,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20198 | } else if (extra.data.bits.has_align_ref) blk: { | 20198 | } else if (extra.data.bits.has_align_ref) blk: { |
| 20199 | const align_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 20199 | const align_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 20200 | extra_index += 1; | 20200 | extra_index += 1; |
| 20201 | const align_tv = sema.resolveInstConst(block, align_src, align_ref, "alignment must be comptime known") catch |err| switch (err) { | 20201 | const align_tv = sema.resolveInstConst(block, align_src, align_ref, "alignment must be comptime-known") catch |err| switch (err) { |
| 20202 | error.GenericPoison => { | 20202 | error.GenericPoison => { |
| 20203 | break :blk null; | 20203 | break :blk null; |
| 20204 | }, | 20204 | }, |
| ... | @@ -20220,7 +20220,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20220,7 +20220,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20220 | extra_index += body.len; | 20220 | extra_index += body.len; |
| 20221 | | 20221 | |
| 20222 | const addrspace_ty = try sema.getBuiltinType(block, addrspace_src, "AddressSpace"); | 20222 | const addrspace_ty = try sema.getBuiltinType(block, addrspace_src, "AddressSpace"); |
| 20223 | const val = try sema.resolveGenericBody(block, addrspace_src, body, inst, addrspace_ty, "addrespace must be comptime known"); | 20223 | const val = try sema.resolveGenericBody(block, addrspace_src, body, inst, addrspace_ty, "addrespace must be comptime-known"); |
| 20224 | if (val.tag() == .generic_poison) { | 20224 | if (val.tag() == .generic_poison) { |
| 20225 | break :blk null; | 20225 | break :blk null; |
| 20226 | } | 20226 | } |
| ... | @@ -20228,7 +20228,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20228,7 +20228,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20228 | } else if (extra.data.bits.has_addrspace_ref) blk: { | 20228 | } else if (extra.data.bits.has_addrspace_ref) blk: { |
| 20229 | const addrspace_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 20229 | const addrspace_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 20230 | extra_index += 1; | 20230 | extra_index += 1; |
| 20231 | const addrspace_tv = sema.resolveInstConst(block, addrspace_src, addrspace_ref, "addrespace must be comptime known") catch |err| switch (err) { | 20231 | const addrspace_tv = sema.resolveInstConst(block, addrspace_src, addrspace_ref, "addrespace must be comptime-known") catch |err| switch (err) { |
| 20232 | error.GenericPoison => { | 20232 | error.GenericPoison => { |
| 20233 | break :blk null; | 20233 | break :blk null; |
| 20234 | }, | 20234 | }, |
| ... | @@ -20243,7 +20243,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20243,7 +20243,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20243 | const body = sema.code.extra[extra_index..][0..body_len]; | 20243 | const body = sema.code.extra[extra_index..][0..body_len]; |
| 20244 | extra_index += body.len; | 20244 | extra_index += body.len; |
| 20245 | | 20245 | |
| 20246 | const val = try sema.resolveGenericBody(block, section_src, body, inst, Type.initTag(.const_slice_u8), "linksection must be comptime known"); | 20246 | const val = try sema.resolveGenericBody(block, section_src, body, inst, Type.initTag(.const_slice_u8), "linksection must be comptime-known"); |
| 20247 | if (val.tag() == .generic_poison) { | 20247 | if (val.tag() == .generic_poison) { |
| 20248 | break :blk FuncLinkSection{ .generic = {} }; | 20248 | break :blk FuncLinkSection{ .generic = {} }; |
| 20249 | } | 20249 | } |
| ... | @@ -20251,7 +20251,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20251,7 +20251,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20251 | } else if (extra.data.bits.has_section_ref) blk: { | 20251 | } else if (extra.data.bits.has_section_ref) blk: { |
| 20252 | const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 20252 | const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 20253 | extra_index += 1; | 20253 | extra_index += 1; |
| 20254 | const section_tv = sema.resolveInstConst(block, section_src, section_ref, "linksection must be comptime known") catch |err| switch (err) { | 20254 | const section_tv = sema.resolveInstConst(block, section_src, section_ref, "linksection must be comptime-known") catch |err| switch (err) { |
| 20255 | error.GenericPoison => { | 20255 | error.GenericPoison => { |
| 20256 | break :blk FuncLinkSection{ .generic = {} }; | 20256 | break :blk FuncLinkSection{ .generic = {} }; |
| 20257 | }, | 20257 | }, |
| ... | @@ -20268,7 +20268,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20268,7 +20268,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20268 | extra_index += body.len; | 20268 | extra_index += body.len; |
| 20269 | | 20269 | |
| 20270 | const cc_ty = try sema.getBuiltinType(block, addrspace_src, "CallingConvention"); | 20270 | const cc_ty = try sema.getBuiltinType(block, addrspace_src, "CallingConvention"); |
| 20271 | const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, "calling convention must be comptime known"); | 20271 | const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, "calling convention must be comptime-known"); |
| 20272 | if (val.tag() == .generic_poison) { | 20272 | if (val.tag() == .generic_poison) { |
| 20273 | break :blk null; | 20273 | break :blk null; |
| 20274 | } | 20274 | } |
| ... | @@ -20276,7 +20276,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20276,7 +20276,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20276 | } else if (extra.data.bits.has_cc_ref) blk: { | 20276 | } else if (extra.data.bits.has_cc_ref) blk: { |
| 20277 | const cc_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 20277 | const cc_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 20278 | extra_index += 1; | 20278 | extra_index += 1; |
| 20279 | const cc_tv = sema.resolveInstConst(block, cc_src, cc_ref, "calling convention must be comptime known") catch |err| switch (err) { | 20279 | const cc_tv = sema.resolveInstConst(block, cc_src, cc_ref, "calling convention must be comptime-known") catch |err| switch (err) { |
| 20280 | error.GenericPoison => { | 20280 | error.GenericPoison => { |
| 20281 | break :blk null; | 20281 | break :blk null; |
| 20282 | }, | 20282 | }, |
| ... | @@ -20291,14 +20291,14 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -20291,14 +20291,14 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 20291 | const body = sema.code.extra[extra_index..][0..body_len]; | 20291 | const body = sema.code.extra[extra_index..][0..body_len]; |
| 20292 | extra_index += body.len; | 20292 | extra_index += body.len; |
| 20293 | | 20293 | |
| 20294 | const val = try sema.resolveGenericBody(block, ret_src, body, inst, Type.type, "return type must be comptime known"); | 20294 | const val = try sema.resolveGenericBody(block, ret_src, body, inst, Type.type, "return type must be comptime-known"); |
| 20295 | var buffer: Value.ToTypeBuffer = undefined; | 20295 | var buffer: Value.ToTypeBuffer = undefined; |
| 20296 | const ty = try val.toType(&buffer).copy(sema.arena); | 20296 | const ty = try val.toType(&buffer).copy(sema.arena); |
| 20297 | break :blk ty; | 20297 | break :blk ty; |
| 20298 | } else if (extra.data.bits.has_ret_ty_ref) blk: { | 20298 | } else if (extra.data.bits.has_ret_ty_ref) blk: { |
| 20299 | const ret_ty_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 20299 | const ret_ty_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 20300 | extra_index += 1; | 20300 | extra_index += 1; |
| 20301 | const ret_ty_tv = sema.resolveInstConst(block, ret_src, ret_ty_ref, "return type must be comptime known") catch |err| switch (err) { | 20301 | const ret_ty_tv = sema.resolveInstConst(block, ret_src, ret_ty_ref, "return type must be comptime-known") catch |err| switch (err) { |
| 20302 | error.GenericPoison => { | 20302 | error.GenericPoison => { |
| 20303 | break :blk Type.initTag(.generic_poison); | 20303 | break :blk Type.initTag(.generic_poison); |
| 20304 | }, | 20304 | }, |
| ... | @@ -20354,7 +20354,7 @@ fn zirCUndef( | ... | @@ -20354,7 +20354,7 @@ fn zirCUndef( |
| 20354 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 20354 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 20355 | const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; | 20355 | const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; |
| 20356 | | 20356 | |
| 20357 | const name = try sema.resolveConstString(block, src, extra.operand, "name of macro being undefined must be comptime known"); | 20357 | const name = try sema.resolveConstString(block, src, extra.operand, "name of macro being undefined must be comptime-known"); |
| 20358 | try block.c_import_buf.?.writer().print("#undefine {s}\n", .{name}); | 20358 | try block.c_import_buf.?.writer().print("#undefine {s}\n", .{name}); |
| 20359 | return Air.Inst.Ref.void_value; | 20359 | return Air.Inst.Ref.void_value; |
| 20360 | } | 20360 | } |
| ... | @@ -20367,7 +20367,7 @@ fn zirCInclude( | ... | @@ -20367,7 +20367,7 @@ fn zirCInclude( |
| 20367 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 20367 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 20368 | const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; | 20368 | const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; |
| 20369 | | 20369 | |
| 20370 | const name = try sema.resolveConstString(block, src, extra.operand, "path being included must be comptime known"); | 20370 | const name = try sema.resolveConstString(block, src, extra.operand, "path being included must be comptime-known"); |
| 20371 | try block.c_import_buf.?.writer().print("#include <{s}>\n", .{name}); | 20371 | try block.c_import_buf.?.writer().print("#include <{s}>\n", .{name}); |
| 20372 | return Air.Inst.Ref.void_value; | 20372 | return Air.Inst.Ref.void_value; |
| 20373 | } | 20373 | } |
| ... | @@ -20381,10 +20381,10 @@ fn zirCDefine( | ... | @@ -20381,10 +20381,10 @@ fn zirCDefine( |
| 20381 | const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; | 20381 | const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; |
| 20382 | const val_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node }; | 20382 | const val_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node }; |
| 20383 | | 20383 | |
| 20384 | const name = try sema.resolveConstString(block, name_src, extra.lhs, "name of macro being undefined must be comptime known"); | 20384 | const name = try sema.resolveConstString(block, name_src, extra.lhs, "name of macro being undefined must be comptime-known"); |
| 20385 | const rhs = try sema.resolveInst(extra.rhs); | 20385 | const rhs = try sema.resolveInst(extra.rhs); |
| 20386 | if (sema.typeOf(rhs).zigTypeTag() != .Void) { | 20386 | if (sema.typeOf(rhs).zigTypeTag() != .Void) { |
| 20387 | const value = try sema.resolveConstString(block, val_src, extra.rhs, "value of macro being undefined must be comptime known"); | 20387 | const value = try sema.resolveConstString(block, val_src, extra.rhs, "value of macro being undefined must be comptime-known"); |
| 20388 | try block.c_import_buf.?.writer().print("#define {s} {s}\n", .{ name, value }); | 20388 | try block.c_import_buf.?.writer().print("#define {s} {s}\n", .{ name, value }); |
| 20389 | } else { | 20389 | } else { |
| 20390 | try block.c_import_buf.?.writer().print("#define {s}\n", .{name}); | 20390 | try block.c_import_buf.?.writer().print("#define {s}\n", .{name}); |
| ... | @@ -20405,7 +20405,7 @@ fn zirWasmMemorySize( | ... | @@ -20405,7 +20405,7 @@ fn zirWasmMemorySize( |
| 20405 | return sema.fail(block, builtin_src, "builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); | 20405 | return sema.fail(block, builtin_src, "builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); |
| 20406 | } | 20406 | } |
| 20407 | | 20407 | |
| 20408 | const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.operand, Type.u32, "wasm memory size index must be comptime known")); | 20408 | const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.operand, Type.u32, "wasm memory size index must be comptime-known")); |
| 20409 | try sema.requireRuntimeBlock(block, builtin_src, null); | 20409 | try sema.requireRuntimeBlock(block, builtin_src, null); |
| 20410 | return block.addInst(.{ | 20410 | return block.addInst(.{ |
| 20411 | .tag = .wasm_memory_size, | 20411 | .tag = .wasm_memory_size, |
| ... | @@ -20430,7 +20430,7 @@ fn zirWasmMemoryGrow( | ... | @@ -20430,7 +20430,7 @@ fn zirWasmMemoryGrow( |
| 20430 | return sema.fail(block, builtin_src, "builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); | 20430 | return sema.fail(block, builtin_src, "builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)}); |
| 20431 | } | 20431 | } |
| 20432 | | 20432 | |
| 20433 | const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.lhs, Type.u32, "wasm memory size index must be comptime known")); | 20433 | const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.lhs, Type.u32, "wasm memory size index must be comptime-known")); |
| 20434 | const delta = try sema.coerce(block, Type.u32, try sema.resolveInst(extra.rhs), delta_src); | 20434 | const delta = try sema.coerce(block, Type.u32, try sema.resolveInst(extra.rhs), delta_src); |
| 20435 | | 20435 | |
| 20436 | try sema.requireRuntimeBlock(block, builtin_src, null); | 20436 | try sema.requireRuntimeBlock(block, builtin_src, null); |
| ... | @@ -20458,13 +20458,13 @@ fn resolvePrefetchOptions( | ... | @@ -20458,13 +20458,13 @@ fn resolvePrefetchOptions( |
| 20458 | const cache_src = sema.maybeOptionsSrc(block, src, "cache"); | 20458 | const cache_src = sema.maybeOptionsSrc(block, src, "cache"); |
| 20459 | | 20459 | |
| 20460 | const rw = try sema.fieldVal(block, src, options, "rw", rw_src); | 20460 | const rw = try sema.fieldVal(block, src, options, "rw", rw_src); |
| 20461 | const rw_val = try sema.resolveConstValue(block, rw_src, rw, "prefetch read/write must be comptime known"); | 20461 | const rw_val = try sema.resolveConstValue(block, rw_src, rw, "prefetch read/write must be comptime-known"); |
| 20462 | | 20462 | |
| 20463 | const locality = try sema.fieldVal(block, src, options, "locality", locality_src); | 20463 | const locality = try sema.fieldVal(block, src, options, "locality", locality_src); |
| 20464 | const locality_val = try sema.resolveConstValue(block, locality_src, locality, "prefetch locality must be comptime known"); | 20464 | const locality_val = try sema.resolveConstValue(block, locality_src, locality, "prefetch locality must be comptime-known"); |
| 20465 | | 20465 | |
| 20466 | const cache = try sema.fieldVal(block, src, options, "cache", cache_src); | 20466 | const cache = try sema.fieldVal(block, src, options, "cache", cache_src); |
| 20467 | const cache_val = try sema.resolveConstValue(block, cache_src, cache, "prefetch cache must be comptime known"); | 20467 | const cache_val = try sema.resolveConstValue(block, cache_src, cache, "prefetch cache must be comptime-known"); |
| 20468 | | 20468 | |
| 20469 | return std.builtin.PrefetchOptions{ | 20469 | return std.builtin.PrefetchOptions{ |
| 20470 | .rw = rw_val.toEnum(std.builtin.PrefetchOptions.Rw), | 20470 | .rw = rw_val.toEnum(std.builtin.PrefetchOptions.Rw), |
| ... | @@ -20524,18 +20524,18 @@ fn resolveExternOptions( | ... | @@ -20524,18 +20524,18 @@ fn resolveExternOptions( |
| 20524 | const thread_local_src = sema.maybeOptionsSrc(block, src, "thread_local"); | 20524 | const thread_local_src = sema.maybeOptionsSrc(block, src, "thread_local"); |
| 20525 | | 20525 | |
| 20526 | const name_ref = try sema.fieldVal(block, src, options, "name", name_src); | 20526 | const name_ref = try sema.fieldVal(block, src, options, "name", name_src); |
| 20527 | const name_val = try sema.resolveConstValue(block, name_src, name_ref, "name of the extern symbol must be comptime known"); | 20527 | const name_val = try sema.resolveConstValue(block, name_src, name_ref, "name of the extern symbol must be comptime-known"); |
| 20528 | const name = try name_val.toAllocatedBytes(Type.initTag(.const_slice_u8), sema.arena, mod); | 20528 | const name = try name_val.toAllocatedBytes(Type.initTag(.const_slice_u8), sema.arena, mod); |
| 20529 | | 20529 | |
| 20530 | const library_name_inst = try sema.fieldVal(block, src, options, "library_name", library_src); | 20530 | const library_name_inst = try sema.fieldVal(block, src, options, "library_name", library_src); |
| 20531 | const library_name_val = try sema.resolveConstValue(block, library_src, library_name_inst, "library in which extern symbol is must be comptime known"); | 20531 | const library_name_val = try sema.resolveConstValue(block, library_src, library_name_inst, "library in which extern symbol is must be comptime-known"); |
| 20532 | | 20532 | |
| 20533 | const linkage_ref = try sema.fieldVal(block, src, options, "linkage", linkage_src); | 20533 | const linkage_ref = try sema.fieldVal(block, src, options, "linkage", linkage_src); |
| 20534 | const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_ref, "linkage of the extern symbol must be comptime known"); | 20534 | const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_ref, "linkage of the extern symbol must be comptime-known"); |
| 20535 | const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage); | 20535 | const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage); |
| 20536 | | 20536 | |
| 20537 | const is_thread_local = try sema.fieldVal(block, src, options, "is_thread_local", thread_local_src); | 20537 | const is_thread_local = try sema.fieldVal(block, src, options, "is_thread_local", thread_local_src); |
| 20538 | const is_thread_local_val = try sema.resolveConstValue(block, thread_local_src, is_thread_local, "threadlocality of the extern symbol must be comptime known"); | 20538 | const is_thread_local_val = try sema.resolveConstValue(block, thread_local_src, is_thread_local, "threadlocality of the extern symbol must be comptime-known"); |
| 20539 | | 20539 | |
| 20540 | const library_name = if (!library_name_val.isNull()) blk: { | 20540 | const library_name = if (!library_name_val.isNull()) blk: { |
| 20541 | const payload = library_name_val.castTag(.opt_payload).?.data; | 20541 | const payload = library_name_val.castTag(.opt_payload).?.data; |
| ... | @@ -22518,7 +22518,7 @@ fn elemPtr( | ... | @@ -22518,7 +22518,7 @@ fn elemPtr( |
| 22518 | .Array, .Vector => return sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init), | 22518 | .Array, .Vector => return sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init), |
| 22519 | .Struct => { | 22519 | .Struct => { |
| 22520 | // Tuple field access. | 22520 | // Tuple field access. |
| 22521 | const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime known"); | 22521 | const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime-known"); |
| 22522 | const index = @intCast(u32, index_val.toUnsignedInt(target)); | 22522 | const index = @intCast(u32, index_val.toUnsignedInt(target)); |
| 22523 | return sema.tupleFieldPtr(block, src, indexable_ptr, elem_index_src, index, init); | 22523 | return sema.tupleFieldPtr(block, src, indexable_ptr, elem_index_src, index, init); |
| 22524 | }, | 22524 | }, |
| ... | @@ -22580,7 +22580,7 @@ fn elemVal( | ... | @@ -22580,7 +22580,7 @@ fn elemVal( |
| 22580 | }, | 22580 | }, |
| 22581 | .Struct => { | 22581 | .Struct => { |
| 22582 | // Tuple field access. | 22582 | // Tuple field access. |
| 22583 | const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime known"); | 22583 | const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime-known"); |
| 22584 | const index = @intCast(u32, index_val.toUnsignedInt(target)); | 22584 | const index = @intCast(u32, index_val.toUnsignedInt(target)); |
| 22585 | return tupleField(sema, block, indexable_src, indexable, elem_index_src, index); | 22585 | return tupleField(sema, block, indexable_src, indexable, elem_index_src, index); |
| 22586 | }, | 22586 | }, |
| ... | @@ -22602,7 +22602,7 @@ fn validateRuntimeElemAccess( | ... | @@ -22602,7 +22602,7 @@ fn validateRuntimeElemAccess( |
| 22602 | const msg = try sema.errMsg( | 22602 | const msg = try sema.errMsg( |
| 22603 | block, | 22603 | block, |
| 22604 | elem_index_src, | 22604 | elem_index_src, |
| 22605 | "values of type '{}' must be comptime known, but index value is runtime known", | 22605 | "values of type '{}' must be comptime-known, but index value is runtime known", |
| 22606 | .{parent_ty.fmt(sema.mod)}, | 22606 | .{parent_ty.fmt(sema.mod)}, |
| 22607 | ); | 22607 | ); |
| 22608 | errdefer msg.destroy(sema.gpa); | 22608 | errdefer msg.destroy(sema.gpa); |
| ... | @@ -23307,7 +23307,7 @@ fn coerceExtra( | ... | @@ -23307,7 +23307,7 @@ fn coerceExtra( |
| 23307 | const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse { | 23307 | const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse { |
| 23308 | if (dest_ty.zigTypeTag() == .ComptimeInt) { | 23308 | if (dest_ty.zigTypeTag() == .ComptimeInt) { |
| 23309 | if (!opts.report_err) return error.NotCoercible; | 23309 | if (!opts.report_err) return error.NotCoercible; |
| 23310 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime known"); | 23310 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime-known"); |
| 23311 | } | 23311 | } |
| 23312 | break :float; | 23312 | break :float; |
| 23313 | }; | 23313 | }; |
| ... | @@ -23325,7 +23325,7 @@ fn coerceExtra( | ... | @@ -23325,7 +23325,7 @@ fn coerceExtra( |
| 23325 | }, | 23325 | }, |
| 23326 | .Int, .ComptimeInt => { | 23326 | .Int, .ComptimeInt => { |
| 23327 | if (try sema.resolveDefinedValue(block, inst_src, inst)) |val| { | 23327 | if (try sema.resolveDefinedValue(block, inst_src, inst)) |val| { |
| 23328 | // comptime known integer to other number | 23328 | // comptime-known integer to other number |
| 23329 | if (!(try sema.intFitsInType(block, inst_src, val, dest_ty, null))) { | 23329 | if (!(try sema.intFitsInType(block, inst_src, val, dest_ty, null))) { |
| 23330 | if (!opts.report_err) return error.NotCoercible; | 23330 | if (!opts.report_err) return error.NotCoercible; |
| 23331 | return sema.fail(block, inst_src, "type '{}' cannot represent integer value '{}'", .{ dest_ty.fmt(sema.mod), val.fmtValue(inst_ty, sema.mod) }); | 23331 | return sema.fail(block, inst_src, "type '{}' cannot represent integer value '{}'", .{ dest_ty.fmt(sema.mod), val.fmtValue(inst_ty, sema.mod) }); |
| ... | @@ -23335,7 +23335,7 @@ fn coerceExtra( | ... | @@ -23335,7 +23335,7 @@ fn coerceExtra( |
| 23335 | if (dest_ty.zigTypeTag() == .ComptimeInt) { | 23335 | if (dest_ty.zigTypeTag() == .ComptimeInt) { |
| 23336 | if (!opts.report_err) return error.NotCoercible; | 23336 | if (!opts.report_err) return error.NotCoercible; |
| 23337 | if (opts.no_cast_to_comptime_int) return inst; | 23337 | if (opts.no_cast_to_comptime_int) return inst; |
| 23338 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime known"); | 23338 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime-known"); |
| 23339 | } | 23339 | } |
| 23340 | | 23340 | |
| 23341 | // integer widening | 23341 | // integer widening |
| ... | @@ -23374,7 +23374,7 @@ fn coerceExtra( | ... | @@ -23374,7 +23374,7 @@ fn coerceExtra( |
| 23374 | return try sema.addConstant(dest_ty, result_val); | 23374 | return try sema.addConstant(dest_ty, result_val); |
| 23375 | } else if (dest_ty.zigTypeTag() == .ComptimeFloat) { | 23375 | } else if (dest_ty.zigTypeTag() == .ComptimeFloat) { |
| 23376 | if (!opts.report_err) return error.NotCoercible; | 23376 | if (!opts.report_err) return error.NotCoercible; |
| 23377 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime known"); | 23377 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime-known"); |
| 23378 | } | 23378 | } |
| 23379 | | 23379 | |
| 23380 | // float widening | 23380 | // float widening |
| ... | @@ -23389,7 +23389,7 @@ fn coerceExtra( | ... | @@ -23389,7 +23389,7 @@ fn coerceExtra( |
| 23389 | const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse { | 23389 | const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse { |
| 23390 | if (dest_ty.zigTypeTag() == .ComptimeFloat) { | 23390 | if (dest_ty.zigTypeTag() == .ComptimeFloat) { |
| 23391 | if (!opts.report_err) return error.NotCoercible; | 23391 | if (!opts.report_err) return error.NotCoercible; |
| 23392 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime known"); | 23392 | return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime-known"); |
| 23393 | } | 23393 | } |
| 23394 | break :int; | 23394 | break :int; |
| 23395 | }; | 23395 | }; |
| ... | @@ -26185,7 +26185,7 @@ fn coerceTupleToStruct( | ... | @@ -26185,7 +26185,7 @@ fn coerceTupleToStruct( |
| 26185 | field_refs[field_index] = coerced; | 26185 | field_refs[field_index] = coerced; |
| 26186 | if (field.is_comptime) { | 26186 | if (field.is_comptime) { |
| 26187 | const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse { | 26187 | const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse { |
| 26188 | return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime known"); | 26188 | return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime-known"); |
| 26189 | }; | 26189 | }; |
| 26190 | | 26190 | |
| 26191 | if (!init_val.eql(field.default_val, field.ty, sema.mod)) { | 26191 | if (!init_val.eql(field.default_val, field.ty, sema.mod)) { |
| ... | @@ -26281,7 +26281,7 @@ fn coerceTupleToTuple( | ... | @@ -26281,7 +26281,7 @@ fn coerceTupleToTuple( |
| 26281 | field_refs[field_index] = coerced; | 26281 | field_refs[field_index] = coerced; |
| 26282 | if (default_val.tag() != .unreachable_value) { | 26282 | if (default_val.tag() != .unreachable_value) { |
| 26283 | const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse { | 26283 | const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse { |
| 26284 | return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime known"); | 26284 | return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime-known"); |
| 26285 | }; | 26285 | }; |
| 26286 | | 26286 | |
| 26287 | if (!init_val.eql(default_val, field_ty, sema.mod)) { | 26287 | if (!init_val.eql(default_val, field_ty, sema.mod)) { |
| ... | @@ -26647,7 +26647,7 @@ fn analyzeIsNonErrComptimeOnly( | ... | @@ -26647,7 +26647,7 @@ fn analyzeIsNonErrComptimeOnly( |
| 26647 | const maybe_operand_val = try sema.resolveMaybeUndefVal(block, src, operand); | 26647 | const maybe_operand_val = try sema.resolveMaybeUndefVal(block, src, operand); |
| 26648 | | 26648 | |
| 26649 | // exception if the error union error set is known to be empty, | 26649 | // exception if the error union error set is known to be empty, |
| 26650 | // we allow the comparison but always make it comptime known. | 26650 | // we allow the comparison but always make it comptime-known. |
| 26651 | const set_ty = operand_ty.errorUnionSet(); | 26651 | const set_ty = operand_ty.errorUnionSet(); |
| 26652 | switch (set_ty.tag()) { | 26652 | switch (set_ty.tag()) { |
| 26653 | .anyerror => {}, | 26653 | .anyerror => {}, |
| ... | @@ -26914,7 +26914,7 @@ fn analyzeSlice( | ... | @@ -26914,7 +26914,7 @@ fn analyzeSlice( |
| 26914 | const sentinel = s: { | 26914 | const sentinel = s: { |
| 26915 | if (sentinel_opt != .none) { | 26915 | if (sentinel_opt != .none) { |
| 26916 | const casted = try sema.coerce(block, elem_ty, sentinel_opt, sentinel_src); | 26916 | const casted = try sema.coerce(block, elem_ty, sentinel_opt, sentinel_src); |
| 26917 | break :s try sema.resolveConstValue(block, sentinel_src, casted, "slice sentinel must be comptime known"); | 26917 | break :s try sema.resolveConstValue(block, sentinel_src, casted, "slice sentinel must be comptime-known"); |
| 26918 | } | 26918 | } |
| 26919 | // If we are slicing to the end of something that is sentinel-terminated | 26919 | // If we are slicing to the end of something that is sentinel-terminated |
| 26920 | // then the resulting slice type is also sentinel-terminated. | 26920 | // then the resulting slice type is also sentinel-terminated. |
| ... | @@ -28836,7 +28836,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void | ... | @@ -28836,7 +28836,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void |
| 28836 | const field = &struct_obj.fields.values()[i]; | 28836 | const field = &struct_obj.fields.values()[i]; |
| 28837 | const coerced = try sema.coerce(&block_scope, field.ty, init, src); | 28837 | const coerced = try sema.coerce(&block_scope, field.ty, init, src); |
| 28838 | const default_val = (try sema.resolveMaybeUndefVal(&block_scope, src, coerced)) orelse | 28838 | const default_val = (try sema.resolveMaybeUndefVal(&block_scope, src, coerced)) orelse |
| 28839 | return sema.failWithNeededComptime(&block_scope, src, "struct field default value must be comptime known"); | 28839 | return sema.failWithNeededComptime(&block_scope, src, "struct field default value must be comptime-known"); |
| 28840 | field.default_val = try default_val.copy(decl_arena_allocator); | 28840 | field.default_val = try default_val.copy(decl_arena_allocator); |
| 28841 | } | 28841 | } |
| 28842 | } | 28842 | } |
| ... | @@ -29032,7 +29032,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { | ... | @@ -29032,7 +29032,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { |
| 29032 | if (tag_ref != .none) { | 29032 | if (tag_ref != .none) { |
| 29033 | const tag_src = src; // TODO better source location | 29033 | const tag_src = src; // TODO better source location |
| 29034 | const coerced = try sema.coerce(&block_scope, int_tag_ty, tag_ref, tag_src); | 29034 | const coerced = try sema.coerce(&block_scope, int_tag_ty, tag_ref, tag_src); |
| 29035 | const val = try sema.resolveConstValue(&block_scope, tag_src, coerced, "enum tag value must be comptime known"); | 29035 | const val = try sema.resolveConstValue(&block_scope, tag_src, coerced, "enum tag value must be comptime-known"); |
| 29036 | last_tag_val = val; | 29036 | last_tag_val = val; |
| 29037 | | 29037 | |
| 29038 | // This puts the memory into the union arena, not the enum arena, but | 29038 | // This puts the memory into the union arena, not the enum arena, but |
| ... | @@ -29856,7 +29856,7 @@ pub fn analyzeAddrspace( | ... | @@ -29856,7 +29856,7 @@ pub fn analyzeAddrspace( |
| 29856 | zir_ref: Zir.Inst.Ref, | 29856 | zir_ref: Zir.Inst.Ref, |
| 29857 | ctx: AddressSpaceContext, | 29857 | ctx: AddressSpaceContext, |
| 29858 | ) !std.builtin.AddressSpace { | 29858 | ) !std.builtin.AddressSpace { |
| 29859 | const addrspace_tv = try sema.resolveInstConst(block, src, zir_ref, "addresspace must be comptime known"); | 29859 | const addrspace_tv = try sema.resolveInstConst(block, src, zir_ref, "addresspace must be comptime-known"); |
| 29860 | const address_space = addrspace_tv.val.toEnum(std.builtin.AddressSpace); | 29860 | const address_space = addrspace_tv.val.toEnum(std.builtin.AddressSpace); |
| 29861 | const target = sema.mod.getTarget(); | 29861 | const target = sema.mod.getTarget(); |
| 29862 | const arch = target.cpu.arch; | 29862 | const arch = target.cpu.arch; |