| ... | @@ -191,25 +191,27 @@ const bad_main_ret = "expected return type of main to be 'void', '!void', 'noret | ... | @@ -191,25 +191,27 @@ const bad_main_ret = "expected return type of main to be 'void', '!void', 'noret |
| 191 | // and we want fewer call frames in stack traces. | 191 | // and we want fewer call frames in stack traces. |
| 192 | inline fn initEventLoopAndCallMain() u8 { | 192 | inline fn initEventLoopAndCallMain() u8 { |
| 193 | if (std.event.Loop.instance) |loop| { | 193 | if (std.event.Loop.instance) |loop| { |
| 194 | loop.init() catch |err| { | 194 | if (!@hasDecl(root, "event_loop")) { |
| 195 | std.debug.warn("error: {}\n", @errorName(err)); | 195 | loop.init() catch |err| { |
| 196 | if (@errorReturnTrace()) |trace| { | 196 | std.debug.warn("error: {}\n", @errorName(err)); |
| 197 | std.debug.dumpStackTrace(trace.*); | 197 | if (@errorReturnTrace()) |trace| { |
| 198 | } | 198 | std.debug.dumpStackTrace(trace.*); |
| 199 | return 1; | 199 | } |
| 200 | }; | 200 | return 1; |
| 201 | defer loop.deinit(); | 201 | }; |
| 202 | | 202 | defer loop.deinit(); |
| 203 | var result: u8 = undefined; | 203 | |
| 204 | var frame: @Frame(callMain) = undefined; | 204 | var result: u8 = undefined; |
| 205 | _ = @asyncCall(&frame, &result, callMain); | 205 | var frame: @Frame(callMain) = undefined; |
| 206 | loop.run(); | 206 | _ = @asyncCall(&frame, &result, callMain); |
| 207 | return result; | 207 | loop.run(); |
| 208 | } else { | 208 | return result; |
| 209 | // This is marked inline because for some reason LLVM in release mode fails to inline it, | 209 | } |
| 210 | // and we want fewer call frames in stack traces. | | |
| 211 | return @inlineCall(callMain); | | |
| 212 | } | 210 | } |
| | 211 | |
| | 212 | // This is marked inline because for some reason LLVM in release mode fails to inline it, |
| | 213 | // and we want fewer call frames in stack traces. |
| | 214 | return @inlineCall(callMain); |
| 213 | } | 215 | } |
| 214 | | 216 | |
| 215 | // This is not marked inline because it is called with @asyncCall when | 217 | // This is not marked inline because it is called with @asyncCall when |