@@ -1828,6 +1828,17 @@ fn failWithInvalidComptimeFieldStore(sema: *Sema, block: *Block, init_src: LazyS
1828
1828
return sema.failWithOwnedErrorMsg(msg);
1829
1829
}
1830
1830
1831
+ fn failWithUseOfAsync(sema: *Sema, block: *Block, src: LazySrcLoc) CompileError {
1832
+ const msg = msg: {
1833
+ const msg = try sema.errMsg(block, src, "async has not been implemented in the self-hosted compiler yet", .{});
1834
+ errdefer msg.destroy(sema.gpa);
1835
+
1836
+ try sema.errNote(block, src, msg, "to use async enable the stage1 compiler with either '-fstage1' or by setting '.use_stage1 = true` in your 'build.zig' script", .{});
1837
+ break :msg msg;
1838
+ };
1839
+ return sema.failWithOwnedErrorMsg(msg);
1840
+ }
1841
+
1831
1842
/// We don't return a pointer to the new error note because the pointer
1832
1843
/// becomes invalid when you add another one.
1833
1844
fn errNote(
@@ -4776,7 +4787,7 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr
4776
4787
fn zirSuspendBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
4777
4788
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
4778
4789
const src = inst_data.src();
4779
- return sema.fail (parent_block, src, "TODO: implement Sema.zirSuspendBlock", .{} );
4790
+ return sema.failWithUseOfAsync (parent_block, src);
4780
4791
}
4781
4792
4782
4793
fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
@@ -5613,7 +5624,7 @@ fn analyzeCall(
5613
5624
.never_inline => Air.Inst.Tag.call_never_inline,
5614
5625
.always_tail => Air.Inst.Tag.call_always_tail,
5615
5626
5616
- .async_kw => return sema.fail (block, call_src, "TODO implement async call", .{} ),
5627
+ .async_kw => return sema.failWithUseOfAsync (block, call_src),
5617
5628
};
5618
5629
5619
5630
if (modifier == .never_inline and func_ty_info.cc == .Inline) {
@@ -6657,6 +6668,9 @@ fn zirAnyframeType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
6657
6668
defer tracy.end();
6658
6669
6659
6670
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
6671
+ if (true) {
6672
+ return sema.failWithUseOfAsync(block, inst_data.src());
6673
+ }
6660
6674
const operand_src: LazySrcLoc = .{ .node_offset_anyframe_type = inst_data.src_node };
6661
6675
const return_type = try sema.resolveType(block, operand_src, inst_data.operand);
6662
6676
const anyframe_type = try Type.Tag.anyframe_T.create(sema.arena, return_type);
@@ -14141,8 +14155,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
14141
14155
);
14142
14156
},
14143
14157
.BoundFn => @panic("TODO remove this type from the language and compiler"),
14144
- .Frame => return sema.fail (block, src, "TODO: implement zirTypeInfo for Frame", .{} ),
14145
- .AnyFrame => return sema.fail (block, src, "TODO: implement zirTypeInfo for AnyFrame", .{} ),
14158
+ .Frame => return sema.failWithUseOfAsync (block, src),
14159
+ .AnyFrame => return sema.failWithUseOfAsync (block, src),
14146
14160
}
14147
14161
}
14148
14162
@@ -15787,7 +15801,7 @@ fn zirFrame(
15787
15801
extended: Zir.Inst.Extended.InstData,
15788
15802
) CompileError!Air.Inst.Ref {
15789
15803
const src = LazySrcLoc.nodeOffset(@bitCast(i32, extended.operand));
15790
- return sema.fail (block, src, "TODO: Sema.zirFrame", .{} );
15804
+ return sema.failWithUseOfAsync (block, src);
15791
15805
}
15792
15806
15793
15807
fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
@@ -15976,7 +15990,7 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I
15976
15990
.ComptimeInt => return Air.Inst.Ref.comptime_int_type,
15977
15991
.Undefined => return Air.Inst.Ref.undefined_type,
15978
15992
.Null => return Air.Inst.Ref.null_type,
15979
- .AnyFrame => return Air.Inst.Ref.anyframe_type ,
15993
+ .AnyFrame => return sema.failWithUseOfAsync(block, src) ,
15980
15994
.EnumLiteral => return Air.Inst.Ref.enum_literal_type,
15981
15995
.Int => {
15982
15996
const struct_val = union_val.val.castTag(.aggregate).?.data;
@@ -16628,7 +16642,7 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I
16628
16642
return sema.addType(ty);
16629
16643
},
16630
16644
.BoundFn => @panic("TODO delete BoundFn from the language"),
16631
- .Frame => @panic("TODO implement https://github.com/ziglang/zig/issues/10710" ),
16645
+ .Frame => return sema.failWithUseOfAsync(block, src ),
16632
16646
}
16633
16647
}
16634
16648
@@ -16830,13 +16844,13 @@ fn zirTypeName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
16830
16844
fn zirFrameType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
16831
16845
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
16832
16846
const src = inst_data.src();
16833
- return sema.fail (block, src, "TODO: Sema.zirFrameType", .{} );
16847
+ return sema.failWithUseOfAsync (block, src);
16834
16848
}
16835
16849
16836
16850
fn zirFrameSize(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
16837
16851
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
16838
16852
const src = inst_data.src();
16839
- return sema.fail (block, src, "TODO: Sema.zirFrameSize", .{} );
16853
+ return sema.failWithUseOfAsync (block, src);
16840
16854
}
16841
16855
16842
16856
fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
@@ -19067,13 +19081,13 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
19067
19081
fn zirBuiltinAsyncCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
19068
19082
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
19069
19083
const src = inst_data.src();
19070
- return sema.fail (block, src, "TODO: Sema.zirBuiltinAsyncCall", .{} );
19084
+ return sema.failWithUseOfAsync (block, src);
19071
19085
}
19072
19086
19073
19087
fn zirResume(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
19074
19088
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
19075
19089
const src = inst_data.src();
19076
- return sema.fail (block, src, "TODO: Sema.zirResume", .{} );
19090
+ return sema.failWithUseOfAsync (block, src);
19077
19091
}
19078
19092
19079
19093
fn zirAwait(
@@ -19084,7 +19098,7 @@ fn zirAwait(
19084
19098
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
19085
19099
const src = inst_data.src();
19086
19100
19087
- return sema.fail (block, src, "TODO: Sema.zirAwait", .{} );
19101
+ return sema.failWithUseOfAsync (block, src);
19088
19102
}
19089
19103
19090
19104
fn zirAwaitNosuspend(
@@ -19095,7 +19109,7 @@ fn zirAwaitNosuspend(
19095
19109
const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
19096
19110
const src = LazySrcLoc.nodeOffset(extra.node);
19097
19111
19098
- return sema.fail (block, src, "TODO: Sema.zirAwaitNosuspend", .{} );
19112
+ return sema.failWithUseOfAsync (block, src);
19099
19113
}
19100
19114
19101
19115
fn zirVarExtended(
0 commit comments