You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
comptimevarborrows: usize=0;
comptimevarmutborrows: usize=0;
if (borrows>0andmutborrows>0) {
@compileError("Value has already been unwrapped!");
} elseif (borrows>0ormutborrows>0) {
@compileError("There is a borrow[mut] active!");
}
mutborrows+=1;
varvalue: usize=20;
comptimevaralive: bool=true;
if (!alive) @compileError("BorrowMut no longer alive!");
testing.expectEqual(value, 20) catch|err| {
alive=false;
returnerr;
}
if (!alive) @compileError("BorrowMut no longer alive!");
value=0;
if (!alive) @compileError("BorrowMut no longer alive!");
testing.expectEqual(value, 0) catch|err| {
alive=false;
returnerr;
}
alive=false;
Observed Behavior
error: BorrowMut no longer alive!
@compileError("BorrowMut no longer alive!");
This seems to be
comptimevarborrows: usize=0;
comptimevarmutborrows: usize=0;
if (borrows>0andmutborrows>0) {
@compileError("Value has already been unwrapped!");
} elseif (borrows>0ormutborrows>0) {
@compileError("There is a borrow[mut] active!");
}
mutborrows+=1;
comptimevaralive: bool=true;
if (!alive) @compileError("BorrowMut no longer alive!");
alive=false;
if (!alive) @compileError("BorrowMut no longer alive!"); // compile error hereif (!alive) @compileError("BorrowMut no longer alive!");
alive=false;
alive=false;
Expected Behavior
error: store to comptime variable depends on runtime condition
defer mutborrow.release();
note: runtime condition here
try testing.expectEqual(mutborrow.read(opaque {}), 20);
The text was updated successfully, but these errors were encountered:
DerryAlex
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Dec 22, 2022
Zig Version
0.10.0, 0.11.0-dev.923+a52dcdd3c
Steps to Reproduce and Observed Behavior
The example comes from Zorrow.
This should be equate to the following
Observed Behavior
This seems to be
Expected Behavior
The text was updated successfully, but these errors were encountered: