Open joelflaig opened 5 months ago
Smaller repro:
struct T:
fn __moveinit__(inout self, owned other):
...
Crash the compiler (not just the LSP) in nightly.
OK...
Hello, @joelflaig @soraros
After reviewing the code and comparing it with the standard library implementations, I noticed that the copyinit function in your example includes the owned qualifier for a parameter that typically does not transfer ownership. In standard copyinit implementations, this qualifier is usually omitted because the function is intended to copy the data without transferring ownership.
To resolve the parser crash, you should remove the owned qualifier from the other parameter in the copyinit function. Here's the corrected version:
fn __copyinit__(inout self, other: Self):
self.data = other.data
Please try this change and if the issue remains, feel free to reopen the issue.
Hi @JoeLoser, could you please close this issue?
@dayeondev you are correct that this is invalid code. However, the compiler should reject it gracefully instead of crashing, thus we shouldn't close the issue.
Reproduces
The code below produces a LSP parser crash.
System information