Zig Version
0.16.0-dev.1541+d73fbcc3a
Steps to Reproduce and Observed Behavior
pubconstAoC=struct{gpa:std.mem.Allocator,threaded:Io.Threaded,io:Io,day:u8,pubfninit(d:u8)AoC{varthreaded:Io.Threaded=.init_single_threaded;constio:Io=threaded.io();std.debug.print("Advent of Code Day {d}\n=====================================\n",.{d});return.{.gpa=std.heap.smp_allocator,.threaded=threaded,.io=io,.day=d,};}}Observe a constant being incorrectly mutated:
General protection exception (no address available)
/home/blackbeard/src/zig/stage4-release/lib/zig/std/Io/Threaded.zig:122:28: 0x106ca2e in beginSyscall (std.zig)
.fromSignaleeId(thread.signal_id),
^
/home/blackbeard/src/zig/stage4-release/lib/zig/std/Io/Threaded.zig:2353:36: 0x1049df0 in dirOpenFilePosix (std.zig)
try current_thread.beginSyscall();
^
Expected Behavior
No mutation of constant data
### Zig Version
0.16.0-dev.1541+d73fbcc3a
### Steps to Reproduce and Observed Behavior
```zig
pub const AoC = struct {
gpa: std.mem.Allocator,
threaded: Io.Threaded,
io: Io,
day: u8,
pub fn init(d: u8) AoC {
var threaded: Io.Threaded = .init_single_threaded;
const io: Io = threaded.io();
std.debug.print("Advent of Code Day {d}\n=====================================\n", .{d});
return .{
.gpa = std.heap.smp_allocator,
.threaded = threaded,
.io = io,
.day = d,
};
}
}
```
Observe a constant being incorrectly mutated:
```
General protection exception (no address available)
/home/blackbeard/src/zig/stage4-release/lib/zig/std/Io/Threaded.zig:122:28: 0x106ca2e in beginSyscall (std.zig)
.fromSignaleeId(thread.signal_id),
^
/home/blackbeard/src/zig/stage4-release/lib/zig/std/Io/Threaded.zig:2353:36: 0x1049df0 in dirOpenFilePosix (std.zig)
try current_thread.beginSyscall();
^
```
### Expected Behavior
No mutation of constant data