| author | |
| committer | |
| log | af00afed9844b9fb17478d33840fb4a312c4f07c |
| tree | 2199ced7be5a0234a18bdb57cac9309cd2f16cc0 |
| parent | b957dc29a4e3f025e446e717b0ae8c69602545ca |
| signature |
9 files changed, 61 insertions(+), 55 deletions(-)
lib/std/debug.zig+15-15| ... | ... | @@ -62,7 +62,7 @@ pub fn warn(comptime fmt: []const u8, args: var) void { |
| 62 | 62 | const held = stderr_mutex.acquire(); |
| 63 | 63 | defer held.release(); |
| 64 | 64 | const stderr = getStderrStream(); |
| 65 | noasync stderr.print(fmt, args) catch return; | |
| 65 | nosuspend stderr.print(fmt, args) catch return; | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | pub fn getStderrStream() *File.OutStream { |
| ... | ... | @@ -112,7 +112,7 @@ pub fn detectTTYConfig() TTY.Config { |
| 112 | 112 | /// Tries to print the current stack trace to stderr, unbuffered, and ignores any error returned. |
| 113 | 113 | /// TODO multithreaded awareness |
| 114 | 114 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 115 | noasync { | |
| 115 | nosuspend { | |
| 116 | 116 | const stderr = getStderrStream(); |
| 117 | 117 | if (builtin.strip_debug_info) { |
| 118 | 118 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | ... | @@ -133,7 +133,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 133 | 133 | /// unbuffered, and ignores any error returned. |
| 134 | 134 | /// TODO multithreaded awareness |
| 135 | 135 | pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { |
| 136 | noasync { | |
| 136 | nosuspend { | |
| 137 | 137 | const stderr = getStderrStream(); |
| 138 | 138 | if (builtin.strip_debug_info) { |
| 139 | 139 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | ... | @@ -203,7 +203,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace |
| 203 | 203 | /// Tries to print a stack trace to stderr, unbuffered, and ignores any error returned. |
| 204 | 204 | /// TODO multithreaded awareness |
| 205 | 205 | pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void { |
| 206 | noasync { | |
| 206 | nosuspend { | |
| 207 | 207 | const stderr = getStderrStream(); |
| 208 | 208 | if (builtin.strip_debug_info) { |
| 209 | 209 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | ... | @@ -261,7 +261,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c |
| 261 | 261 | resetSegfaultHandler(); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | noasync switch (panic_stage) { | |
| 264 | nosuspend switch (panic_stage) { | |
| 265 | 265 | 0 => { |
| 266 | 266 | panic_stage = 1; |
| 267 | 267 | |
| ... | ... | @@ -447,7 +447,7 @@ pub const TTY = struct { |
| 447 | 447 | windows_api, |
| 448 | 448 | |
| 449 | 449 | fn setColor(conf: Config, out_stream: var, color: Color) void { |
| 450 | noasync switch (conf) { | |
| 450 | nosuspend switch (conf) { | |
| 451 | 451 | .no_color => return, |
| 452 | 452 | .escape_codes => switch (color) { |
| 453 | 453 | .Red => out_stream.writeAll(RED) catch return, |
| ... | ... | @@ -604,7 +604,7 @@ fn printLineInfo( |
| 604 | 604 | tty_config: TTY.Config, |
| 605 | 605 | comptime printLineFromFile: var, |
| 606 | 606 | ) !void { |
| 607 | noasync { | |
| 607 | nosuspend { | |
| 608 | 608 | tty_config.setColor(out_stream, .White); |
| 609 | 609 | |
| 610 | 610 | if (line_info) |*li| { |
| ... | ... | @@ -651,7 +651,7 @@ pub const OpenSelfDebugInfoError = error{ |
| 651 | 651 | |
| 652 | 652 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 653 | 653 | pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { |
| 654 | noasync { | |
| 654 | nosuspend { | |
| 655 | 655 | if (builtin.strip_debug_info) |
| 656 | 656 | return error.MissingDebugInfo; |
| 657 | 657 | if (@hasDecl(root, "os") and @hasDecl(root.os, "debug") and @hasDecl(root.os.debug, "openSelfDebugInfo")) { |
| ... | ... | @@ -672,7 +672,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { |
| 672 | 672 | |
| 673 | 673 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 674 | 674 | fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) !ModuleDebugInfo { |
| 675 | noasync { | |
| 675 | nosuspend { | |
| 676 | 676 | const coff_file = try std.fs.openFileAbsoluteW(coff_file_path, .{ .intended_io_mode = .blocking }); |
| 677 | 677 | errdefer coff_file.close(); |
| 678 | 678 | |
| ... | ... | @@ -853,7 +853,7 @@ fn chopSlice(ptr: []const u8, offset: u64, size: u64) ![]const u8 { |
| 853 | 853 | |
| 854 | 854 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 855 | 855 | pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !ModuleDebugInfo { |
| 856 | noasync { | |
| 856 | nosuspend { | |
| 857 | 857 | const mapped_mem = try mapWholeFile(elf_file_path); |
| 858 | 858 | const hdr = @ptrCast(*const elf.Ehdr, &mapped_mem[0]); |
| 859 | 859 | if (!mem.eql(u8, hdr.e_ident[0..4], "\x7fELF")) return error.InvalidElfMagic; |
| ... | ... | @@ -1056,7 +1056,7 @@ const MachoSymbol = struct { |
| 1056 | 1056 | }; |
| 1057 | 1057 | |
| 1058 | 1058 | fn mapWholeFile(path: []const u8) ![]align(mem.page_size) const u8 { |
| 1059 | noasync { | |
| 1059 | nosuspend { | |
| 1060 | 1060 | const file = try fs.cwd().openFile(path, .{ .intended_io_mode = .blocking }); |
| 1061 | 1061 | defer file.close(); |
| 1062 | 1062 | |
| ... | ... | @@ -1418,7 +1418,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { |
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | fn getSymbolAtAddress(self: *@This(), address: usize) !SymbolInfo { |
| 1421 | noasync { | |
| 1421 | nosuspend { | |
| 1422 | 1422 | // Translate the VA into an address into this object |
| 1423 | 1423 | const relocated_address = address - self.base_address; |
| 1424 | 1424 | assert(relocated_address >= 0x100000000); |
| ... | ... | @@ -1643,14 +1643,14 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { |
| 1643 | 1643 | // Translate the VA into an address into this object |
| 1644 | 1644 | const relocated_address = address - self.base_address; |
| 1645 | 1645 | |
| 1646 | if (noasync self.dwarf.findCompileUnit(relocated_address)) |compile_unit| { | |
| 1646 | if (nosuspend self.dwarf.findCompileUnit(relocated_address)) |compile_unit| { | |
| 1647 | 1647 | return SymbolInfo{ |
| 1648 | .symbol_name = noasync self.dwarf.getSymbolName(relocated_address) orelse "???", | |
| 1648 | .symbol_name = nosuspend self.dwarf.getSymbolName(relocated_address) orelse "???", | |
| 1649 | 1649 | .compile_unit_name = compile_unit.die.getAttrString(&self.dwarf, DW.AT_name) catch |err| switch (err) { |
| 1650 | 1650 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", |
| 1651 | 1651 | else => return err, |
| 1652 | 1652 | }, |
| 1653 | .line_info = noasync self.dwarf.getLineNumberInfo(compile_unit.*, relocated_address) catch |err| switch (err) { | |
| 1653 | .line_info = nosuspend self.dwarf.getLineNumberInfo(compile_unit.*, relocated_address) catch |err| switch (err) { | |
| 1654 | 1654 | error.MissingDebugInfo, error.InvalidDebugInfo => null, |
| 1655 | 1655 | else => return err, |
| 1656 | 1656 | }, |
lib/std/dwarf.zig+19-19| ... | ... | @@ -252,13 +252,13 @@ fn readUnitLength(in_stream: var, endian: builtin.Endian, is_64: *bool) !u64 { |
| 252 | 252 | fn readAllocBytes(allocator: *mem.Allocator, in_stream: var, size: usize) ![]u8 { |
| 253 | 253 | const buf = try allocator.alloc(u8, size); |
| 254 | 254 | errdefer allocator.free(buf); |
| 255 | if ((try noasync in_stream.read(buf)) < size) return error.EndOfFile; | |
| 255 | if ((try nosuspend in_stream.read(buf)) < size) return error.EndOfFile; | |
| 256 | 256 | return buf; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // TODO the noasyncs here are workarounds |
| 260 | 260 | fn readAddress(in_stream: var, endian: builtin.Endian, is_64: bool) !u64 { |
| 261 | return noasync if (is_64) | |
| 261 | return nosuspend if (is_64) | |
| 262 | 262 | try in_stream.readInt(u64, endian) |
| 263 | 263 | else |
| 264 | 264 | @as(u64, try in_stream.readInt(u32, endian)); |
| ... | ... | @@ -271,7 +271,7 @@ fn parseFormValueBlockLen(allocator: *mem.Allocator, in_stream: var, size: usize |
| 271 | 271 | |
| 272 | 272 | // TODO the noasyncs here are workarounds |
| 273 | 273 | fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: usize) !FormValue { |
| 274 | const block_len = try noasync in_stream.readVarInt(usize, endian, size); | |
| 274 | const block_len = try nosuspend in_stream.readVarInt(usize, endian, size); | |
| 275 | 275 | return parseFormValueBlockLen(allocator, in_stream, block_len); |
| 276 | 276 | } |
| 277 | 277 | |
| ... | ... | @@ -282,16 +282,16 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo |
| 282 | 282 | .Const = Constant{ |
| 283 | 283 | .signed = signed, |
| 284 | 284 | .payload = switch (size) { |
| 285 | 1 => try noasync in_stream.readInt(u8, endian), | |
| 286 | 2 => try noasync in_stream.readInt(u16, endian), | |
| 287 | 4 => try noasync in_stream.readInt(u32, endian), | |
| 288 | 8 => try noasync in_stream.readInt(u64, endian), | |
| 285 | 1 => try nosuspend in_stream.readInt(u8, endian), | |
| 286 | 2 => try nosuspend in_stream.readInt(u16, endian), | |
| 287 | 4 => try nosuspend in_stream.readInt(u32, endian), | |
| 288 | 8 => try nosuspend in_stream.readInt(u64, endian), | |
| 289 | 289 | -1 => blk: { |
| 290 | 290 | if (signed) { |
| 291 | const x = try noasync leb.readILEB128(i64, in_stream); | |
| 291 | const x = try nosuspend leb.readILEB128(i64, in_stream); | |
| 292 | 292 | break :blk @bitCast(u64, x); |
| 293 | 293 | } else { |
| 294 | const x = try noasync leb.readULEB128(u64, in_stream); | |
| 294 | const x = try nosuspend leb.readULEB128(u64, in_stream); | |
| 295 | 295 | break :blk x; |
| 296 | 296 | } |
| 297 | 297 | }, |
| ... | ... | @@ -305,11 +305,11 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo |
| 305 | 305 | fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: i32) !FormValue { |
| 306 | 306 | return FormValue{ |
| 307 | 307 | .Ref = switch (size) { |
| 308 | 1 => try noasync in_stream.readInt(u8, endian), | |
| 309 | 2 => try noasync in_stream.readInt(u16, endian), | |
| 310 | 4 => try noasync in_stream.readInt(u32, endian), | |
| 311 | 8 => try noasync in_stream.readInt(u64, endian), | |
| 312 | -1 => try noasync leb.readULEB128(u64, in_stream), | |
| 308 | 1 => try nosuspend in_stream.readInt(u8, endian), | |
| 309 | 2 => try nosuspend in_stream.readInt(u16, endian), | |
| 310 | 4 => try nosuspend in_stream.readInt(u32, endian), | |
| 311 | 8 => try nosuspend in_stream.readInt(u64, endian), | |
| 312 | -1 => try nosuspend leb.readULEB128(u64, in_stream), | |
| 313 | 313 | else => unreachable, |
| 314 | 314 | }, |
| 315 | 315 | }; |
| ... | ... | @@ -323,7 +323,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia |
| 323 | 323 | FORM_block2 => parseFormValueBlock(allocator, in_stream, endian, 2), |
| 324 | 324 | FORM_block4 => parseFormValueBlock(allocator, in_stream, endian, 4), |
| 325 | 325 | FORM_block => x: { |
| 326 | const block_len = try noasync leb.readULEB128(usize, in_stream); | |
| 326 | const block_len = try nosuspend leb.readULEB128(usize, in_stream); | |
| 327 | 327 | return parseFormValueBlockLen(allocator, in_stream, block_len); |
| 328 | 328 | }, |
| 329 | 329 | FORM_data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1), |
| ... | ... | @@ -335,11 +335,11 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia |
| 335 | 335 | return parseFormValueConstant(allocator, in_stream, signed, endian, -1); |
| 336 | 336 | }, |
| 337 | 337 | FORM_exprloc => { |
| 338 | const size = try noasync leb.readULEB128(usize, in_stream); | |
| 338 | const size = try nosuspend leb.readULEB128(usize, in_stream); | |
| 339 | 339 | const buf = try readAllocBytes(allocator, in_stream, size); |
| 340 | 340 | return FormValue{ .ExprLoc = buf }; |
| 341 | 341 | }, |
| 342 | FORM_flag => FormValue{ .Flag = (try noasync in_stream.readByte()) != 0 }, | |
| 342 | FORM_flag => FormValue{ .Flag = (try nosuspend in_stream.readByte()) != 0 }, | |
| 343 | 343 | FORM_flag_present => FormValue{ .Flag = true }, |
| 344 | 344 | FORM_sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) }, |
| 345 | 345 | |
| ... | ... | @@ -350,12 +350,12 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia |
| 350 | 350 | FORM_ref_udata => parseFormValueRef(allocator, in_stream, endian, -1), |
| 351 | 351 | |
| 352 | 352 | FORM_ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) }, |
| 353 | FORM_ref_sig8 => FormValue{ .Ref = try noasync in_stream.readInt(u64, endian) }, | |
| 353 | FORM_ref_sig8 => FormValue{ .Ref = try nosuspend in_stream.readInt(u64, endian) }, | |
| 354 | 354 | |
| 355 | 355 | FORM_string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) }, |
| 356 | 356 | FORM_strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) }, |
| 357 | 357 | FORM_indirect => { |
| 358 | const child_form_id = try noasync leb.readULEB128(u64, in_stream); | |
| 358 | const child_form_id = try nosuspend leb.readULEB128(u64, in_stream); | |
| 359 | 359 | const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64)); |
| 360 | 360 | var frame = try allocator.create(F); |
| 361 | 361 | defer allocator.destroy(frame); |
lib/std/event/batch.zig+2-2| ... | ... | @@ -75,7 +75,7 @@ pub fn Batch( |
| 75 | 75 | const job = &self.jobs[self.next_job_index]; |
| 76 | 76 | self.next_job_index = (self.next_job_index + 1) % max_jobs; |
| 77 | 77 | if (job.frame) |existing| { |
| 78 | job.result = if (async_ok) await existing else noasync await existing; | |
| 78 | job.result = if (async_ok) await existing else nosuspend await existing; | |
| 79 | 79 | if (CollectedResult != void) { |
| 80 | 80 | job.result catch |err| { |
| 81 | 81 | self.collected_result = err; |
| ... | ... | @@ -94,7 +94,7 @@ pub fn Batch( |
| 94 | 94 | /// a time, however, it need not be the same thread. |
| 95 | 95 | pub fn wait(self: *Self) CollectedResult { |
| 96 | 96 | for (self.jobs) |*job| if (job.frame) |f| { |
| 97 | job.result = if (async_ok) await f else noasync await f; | |
| 97 | job.result = if (async_ok) await f else nosuspend await f; | |
| 98 | 98 | if (CollectedResult != void) { |
| 99 | 99 | job.result catch |err| { |
| 100 | 100 | self.collected_result = err; |
lib/std/event/loop.zig+4-4| ... | ... | @@ -195,7 +195,7 @@ pub const Loop = struct { |
| 195 | 195 | const wakeup_bytes = [_]u8{0x1} ** 8; |
| 196 | 196 | |
| 197 | 197 | fn initOsData(self: *Loop, extra_thread_count: usize) InitOsDataError!void { |
| 198 | noasync switch (builtin.os.tag) { | |
| 198 | nosuspend switch (builtin.os.tag) { | |
| 199 | 199 | .linux => { |
| 200 | 200 | errdefer { |
| 201 | 201 | while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); |
| ... | ... | @@ -371,7 +371,7 @@ pub const Loop = struct { |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | fn deinitOsData(self: *Loop) void { |
| 374 | noasync switch (builtin.os.tag) { | |
| 374 | nosuspend switch (builtin.os.tag) { | |
| 375 | 375 | .linux => { |
| 376 | 376 | os.close(self.os_data.final_eventfd); |
| 377 | 377 | while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); |
| ... | ... | @@ -663,7 +663,7 @@ pub const Loop = struct { |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | pub fn finishOneEvent(self: *Loop) void { |
| 666 | noasync { | |
| 666 | nosuspend { | |
| 667 | 667 | const prev = @atomicRmw(usize, &self.pending_event_count, .Sub, 1, .SeqCst); |
| 668 | 668 | if (prev != 1) return; |
| 669 | 669 | |
| ... | ... | @@ -1041,7 +1041,7 @@ pub const Loop = struct { |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | fn posixFsRun(self: *Loop) void { |
| 1044 | noasync while (true) { | |
| 1044 | nosuspend while (true) { | |
| 1045 | 1045 | self.fs_thread_wakeup.reset(); |
| 1046 | 1046 | while (self.fs_queue.get()) |node| { |
| 1047 | 1047 | switch (node.data.msg) { |
lib/std/zig/system/macos.zig+9-4| ... | ... | @@ -39,7 +39,7 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { |
| 39 | 39 | zend += 1; |
| 40 | 40 | } |
| 41 | 41 | if (zend == yindex + 1) return error.InvalidVersion; |
| 42 | const z = std.fmt.parseUnsigned(u16, build[yindex + 1..zend], 10) catch return error.InvalidVersion; | |
| 42 | const z = std.fmt.parseUnsigned(u16, build[yindex + 1 .. zend], 10) catch return error.InvalidVersion; | |
| 43 | 43 | |
| 44 | 44 | result.patch = switch (result.minor) { |
| 45 | 45 | // TODO: compiler complains without explicit @as() coercion |
| ... | ... | @@ -97,7 +97,9 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { |
| 97 | 97 | 4 => @as(u32, switch (y) { // Tiger: 10.4 |
| 98 | 98 | 'A' => 0, |
| 99 | 99 | 'B' => 1, |
| 100 | 'C', 'E', => 2, | |
| 100 | 'C', | |
| 101 | 'E', | |
| 102 | => 2, | |
| 101 | 103 | 'F' => 3, |
| 102 | 104 | 'G' => @as(u32, block: { |
| 103 | 105 | if (z >= 1454) break :block 5; |
| ... | ... | @@ -105,7 +107,10 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { |
| 105 | 107 | }), |
| 106 | 108 | 'H' => 5, |
| 107 | 109 | 'I' => 6, |
| 108 | 'J', 'K', 'N', => 7, | |
| 110 | 'J', | |
| 111 | 'K', | |
| 112 | 'N', | |
| 113 | => 7, | |
| 109 | 114 | 'L' => 8, |
| 110 | 115 | 'P' => 9, |
| 111 | 116 | 'R' => 10, |
| ... | ... | @@ -438,7 +443,7 @@ test "version_from_build" { |
| 438 | 443 | for (known) |pair| { |
| 439 | 444 | var buf: [32]u8 = undefined; |
| 440 | 445 | const ver = try version_from_build(pair[0]); |
| 441 | const sver = try std.fmt.bufPrint(buf[0..], "{}.{}.{}", .{ver.major, ver.minor, ver.patch}); | |
| 446 | const sver = try std.fmt.bufPrint(buf[0..], "{}.{}.{}", .{ ver.major, ver.minor, ver.patch }); | |
| 442 | 447 | std.testing.expect(std.mem.eql(u8, sver, pair[1])); |
| 443 | 448 | } |
| 444 | 449 | } |
test/stage1/behavior/async_fn.zig+5-5| ... | ... | @@ -1093,7 +1093,7 @@ test "recursive call of await @asyncCall with struct return type" { |
| 1093 | 1093 | test "noasync function call" { |
| 1094 | 1094 | const S = struct { |
| 1095 | 1095 | fn doTheTest() void { |
| 1096 | const result = noasync add(50, 100); | |
| 1096 | const result = nosuspend add(50, 100); | |
| 1097 | 1097 | expect(result == 150); |
| 1098 | 1098 | } |
| 1099 | 1099 | fn add(a: i32, b: i32) i32 { |
| ... | ... | @@ -1517,7 +1517,7 @@ test "noasync await" { |
| 1517 | 1517 | |
| 1518 | 1518 | fn doTheTest() void { |
| 1519 | 1519 | var frame = async foo(false); |
| 1520 | expect(noasync await frame == 42); | |
| 1520 | expect(nosuspend await frame == 42); | |
| 1521 | 1521 | finished = true; |
| 1522 | 1522 | } |
| 1523 | 1523 | |
| ... | ... | @@ -1544,8 +1544,8 @@ test "noasync on function calls" { |
| 1544 | 1544 | return S0{}; |
| 1545 | 1545 | } |
| 1546 | 1546 | }; |
| 1547 | expectEqual(@as(i32, 42), noasync S1.c().b); | |
| 1548 | expectEqual(@as(i32, 42), (try noasync S1.d()).b); | |
| 1547 | expectEqual(@as(i32, 42), nosuspend S1.c().b); | |
| 1548 | expectEqual(@as(i32, 42), (try nosuspend S1.d()).b); | |
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | test "avoid forcing frame alignment resolution implicit cast to *c_void" { |
| ... | ... | @@ -1561,5 +1561,5 @@ test "avoid forcing frame alignment resolution implicit cast to *c_void" { |
| 1561 | 1561 | }; |
| 1562 | 1562 | var frame = async S.foo(); |
| 1563 | 1563 | resume @ptrCast(anyframe->bool, @alignCast(@alignOf(@Frame(S.foo)), S.x)); |
| 1564 | expect(noasync await frame); | |
| 1564 | expect(nosuspend await frame); | |
| 1565 | 1565 | } |
test/stage1/behavior/cast.zig+1-1| ... | ... | @@ -823,7 +823,7 @@ test "peer type resolve array pointer and unknown pointer" { |
| 823 | 823 | |
| 824 | 824 | comptime expect(@TypeOf(&array, const_ptr) == [*]const u8); |
| 825 | 825 | comptime expect(@TypeOf(const_ptr, &array) == [*]const u8); |
| 826 | ||
| 826 | ||
| 827 | 827 | comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8); |
| 828 | 828 | comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8); |
| 829 | 829 | } |
test/standalone/main_return_error/error_u8.zig+1-3| ... | ... | @@ -1,6 +1,4 @@ |
| 1 | const Err = error { | |
| 2 | Foo | |
| 3 | }; | |
| 1 | const Err = error{Foo}; | |
| 4 | 2 | |
| 5 | 3 | pub fn main() !u8 { |
| 6 | 4 | return Err.Foo; |
test/standalone/main_return_error/error_u8_non_zero.zig+5-2| ... | ... | @@ -1,6 +1,9 @@ |
| 1 | const Err = error { Foo }; | |
| 1 | const Err = error{Foo}; | |
| 2 | 2 | |
| 3 | fn foo() u8 { var x = @intCast(u8, 9); return x; } | |
| 3 | fn foo() u8 { | |
| 4 | var x = @intCast(u8, 9); | |
| 5 | return x; | |
| 6 | } | |
| 4 | 7 | |
| 5 | 8 | pub fn main() !u8 { |
| 6 | 9 | if (foo() == 7) return Err.Foo; |