| ... | @@ -15615,7 +15615,7 @@ fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -15615,7 +15615,7 @@ fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 15615 | => {}, | 15615 | => {}, |
| 15616 | } | 15616 | } |
| 15617 | const val = try ty.lazyAbiSize(mod, sema.arena); | 15617 | const val = try ty.lazyAbiSize(mod, sema.arena); |
| 15618 | if (val.ip_index == .none and val.tag() == .lazy_size) { | 15618 | if (val.isLazySize()) { |
| 15619 | try sema.queueFullTypeResolution(ty); | 15619 | try sema.queueFullTypeResolution(ty); |
| 15620 | } | 15620 | } |
| 15621 | return sema.addConstant(Type.comptime_int, val); | 15621 | return sema.addConstant(Type.comptime_int, val); |
| ... | @@ -17674,6 +17674,10 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -17674,6 +17674,10 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 17674 | if (ty.isGenericPoison()) return error.GenericPoison; | 17674 | if (ty.isGenericPoison()) return error.GenericPoison; |
| 17675 | break :blk ty; | 17675 | break :blk ty; |
| 17676 | }; | 17676 | }; |
| | 17677 | |
| | 17678 | if (elem_ty.zigTypeTag(mod) == .NoReturn) |
| | 17679 | return sema.fail(block, elem_ty_src, "pointer to noreturn not allowed", .{}); |
| | 17680 | |
| 17677 | const target = sema.mod.getTarget(); | 17681 | const target = sema.mod.getTarget(); |
| 17678 | | 17682 | |
| 17679 | var extra_i = extra.end; | 17683 | var extra_i = extra.end; |
| ... | @@ -17681,7 +17685,9 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -17681,7 +17685,9 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 17681 | const sentinel = if (inst_data.flags.has_sentinel) blk: { | 17685 | const sentinel = if (inst_data.flags.has_sentinel) blk: { |
| 17682 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 17686 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 17683 | extra_i += 1; | 17687 | extra_i += 1; |
| 17684 | break :blk (try sema.resolveInstConst(block, sentinel_src, ref, "pointer sentinel value must be comptime-known")).val; | 17688 | const coerced = try sema.coerce(block, elem_ty, try sema.resolveInst(ref), sentinel_src); |
| | 17689 | const val = try sema.resolveConstValue(block, sentinel_src, coerced, "pointer sentinel value must be comptime-known"); |
| | 17690 | break :blk val; |
| 17685 | } else null; | 17691 | } else null; |
| 17686 | | 17692 | |
| 17687 | const abi_align: u32 = if (inst_data.flags.has_align) blk: { | 17693 | const abi_align: u32 = if (inst_data.flags.has_align) blk: { |
| ... | @@ -17725,9 +17731,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -17725,9 +17731,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 17725 | return sema.fail(block, bitoffset_src, "bit offset starts after end of host integer", .{}); | 17731 | return sema.fail(block, bitoffset_src, "bit offset starts after end of host integer", .{}); |
| 17726 | } | 17732 | } |
| 17727 | | 17733 | |
| 17728 | if (elem_ty.zigTypeTag(mod) == .NoReturn) { | 17734 | if (elem_ty.zigTypeTag(mod) == .Fn) { |
| 17729 | return sema.fail(block, elem_ty_src, "pointer to noreturn not allowed", .{}); | | |
| 17730 | } else if (elem_ty.zigTypeTag(mod) == .Fn) { | | |
| 17731 | if (inst_data.size != .One) { | 17735 | if (inst_data.size != .One) { |
| 17732 | return sema.fail(block, elem_ty_src, "function pointers must be single pointers", .{}); | 17736 | return sema.fail(block, elem_ty_src, "function pointers must be single pointers", .{}); |
| 17733 | } | 17737 | } |
| ... | @@ -18580,7 +18584,7 @@ fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -18580,7 +18584,7 @@ fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18580 | return sema.fail(block, operand_src, "no align available for type '{}'", .{ty.fmt(sema.mod)}); | 18584 | return sema.fail(block, operand_src, "no align available for type '{}'", .{ty.fmt(sema.mod)}); |
| 18581 | } | 18585 | } |
| 18582 | const val = try ty.lazyAbiAlignment(mod, sema.arena); | 18586 | const val = try ty.lazyAbiAlignment(mod, sema.arena); |
| 18583 | if (val.tag() == .lazy_align) { | 18587 | if (val.isLazyAlign()) { |
| 18584 | try sema.queueFullTypeResolution(ty); | 18588 | try sema.queueFullTypeResolution(ty); |
| 18585 | } | 18589 | } |
| 18586 | return sema.addConstant(Type.comptime_int, val); | 18590 | return sema.addConstant(Type.comptime_int, val); |
| ... | @@ -33056,7 +33060,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { | ... | @@ -33056,7 +33060,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { |
| 33056 | const enum_simple = resolved_ty.castTag(.enum_simple).?.data; | 33060 | const enum_simple = resolved_ty.castTag(.enum_simple).?.data; |
| 33057 | switch (enum_simple.fields.count()) { | 33061 | switch (enum_simple.fields.count()) { |
| 33058 | 0 => return Value.@"unreachable", | 33062 | 0 => return Value.@"unreachable", |
| 33059 | 1 => return try mod.intValue(ty, 0), | 33063 | 1 => return try Value.Tag.enum_field_index.create(sema.arena, 0), |
| 33060 | else => return null, | 33064 | else => return null, |
| 33061 | } | 33065 | } |
| 33062 | }, | 33066 | }, |