Commit b85ef656ca
Changed files (3)
std
src/ir.cpp
@@ -2647,6 +2647,17 @@ static IrInstruction *ir_build_coro_alloc_helper(IrBuilder *irb, Scope *scope, A
return &instruction->base;
}
+static IrInstruction *ir_build_add_implicit_return_type(IrBuilder *irb, Scope *scope, AstNode *source_node,
+ IrInstruction *value)
+{
+ IrInstructionAddImplicitReturnType *instruction = ir_build_instruction<IrInstructionAddImplicitReturnType>(irb, scope, source_node);
+ instruction->value = value;
+
+ ir_ref_instruction(value, irb->current_basic_block);
+
+ return &instruction->base;
+}
+
static IrInstruction *ir_build_atomic_rmw(IrBuilder *irb, Scope *scope, AstNode *source_node,
IrInstruction *operand_type, IrInstruction *ptr, IrInstruction *op, IrInstruction *operand,
IrInstruction *ordering, AtomicRmwOp resolved_op, AtomicOrder resolved_ordering)
src/ir_print.cpp
@@ -1146,6 +1146,12 @@ static void ir_print_coro_alloc_helper(IrPrint *irp, IrInstructionCoroAllocHelpe
fprintf(irp->f, ")");
}
+static void ir_print_add_implicit_return_type(IrPrint *irp, IrInstructionAddImplicitReturnType *instruction) {
+ fprintf(irp->f, "@addImplicitReturnType(");
+ ir_print_other_instruction(irp, instruction->value);
+ fprintf(irp->f, ")");
+}
+
static void ir_print_atomic_rmw(IrPrint *irp, IrInstructionAtomicRmw *instruction) {
fprintf(irp->f, "@atomicRmw(");
if (instruction->operand_type != nullptr) {
std/event.zig
@@ -168,10 +168,10 @@ test "listen on a port, send bytes, receive bytes" {
var socket = *_socket; // TODO https://github.com/zig-lang/zig/issues/733
defer socket.close();
const next_handler = async errorableHandler(self, _addr, socket) catch |err| switch (err) {
- error.OutOfMemory => return,
+ error.OutOfMemory => @panic("unable to handle connection: out of memory"),
};
- (await next_handler) catch |err| switch (err) {
-
+ (await next_handler) catch |err| {
+ std.debug.panic("unable to handle connection: {}\n", err);
};
suspend |p| { cancel p; }
}
@@ -184,7 +184,7 @@ test "listen on a port, send bytes, receive bytes" {
var adapter = std.io.FileOutStream.init(&socket);
var stream = &adapter.stream;
- try stream.print("hello from server\n") catch unreachable;
+ try stream.print("hello from server\n");
}
};