I have something like
mutex: std.Thread.Mutex = .{},
pub fn init() Self {
return .{};
}
pub fn f(self: Self) void {
self.mutex.lock();
defer self.mutex.unlock();
// ...
}
And I'm getting
error: expected type '*Thread.Mutex', found '*const Thread.Mutex'
self.mutex.lock();
~~~~~~~~~~^~~~~
note: cast discards const qualifier
Huh? It's a mutable field on self. There's no explicit const pointers in my code. Why is zig choosing to convert self.mutex to a *const and then complaining about it?