Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP does not show an error when mutating a const #1964

Closed
Hcode00 opened this issue Jul 18, 2024 · 1 comment
Closed

LSP does not show an error when mutating a const #1964

Hcode00 opened this issue Jul 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Hcode00
Copy link

Hcode00 commented Jul 18, 2024

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;
    ~~^~~~
@Hcode00 Hcode00 added the enhancement New feature or request label Jul 18, 2024
@Techatrix
Copy link
Member

This issue is a very specific example of #2017. There is no need to track this separately so I will be closing this.

@Techatrix Techatrix closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants