zls
zls copied to clipboard
LSP does not show an error when mutating a const
Example:
test "const pointers" {
const x: u8 = 1;
x += 1; // does not give any error
const y = &x;
y.* += 1; // does not give any error
}
until you compile it you get this error:
error: cannot assign to constant
y.* += 1;
~~~~^~~~
error: cannot assign to constant
x += 1;
~~^~~~