-
Notifications
You must be signed in to change notification settings - Fork 1.7k
"index out of bounds" with incorrect match
#15883
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
Comments
I investigated this issue and found that it is due to the However, according to the algorithm, if the constructors of the two are different, they should just return false. I'm not sure why this error is being triggered in this case. (In fact, when I set it up this way, the error did indeed disappear, and it passed all tests successfully.) |
The error is being triggered because this algorithm was taken from rustc, where detecting such type errors early is important. For rust-analyzer it does make sense to ignore those, we should do that |
So, should we remove |
That risks false positives, for example the match being errored as "non exhaustive". The correct fix is to use the recently added |
The OP's example was supposed to cause this function
to return false and prevent from being checked for exhaustiveness. But the example seems sneaking through RA's typecheck. Or perhaps that function is buggy. |
rust-lang/rust#120313 should fix this (and #15808) once it makes its way to rust-analyzer |
rust-analyzer version: 0.3.1722-standalone
rustc version: rustc 1.73.0 (cc66ad468 2023-10-03)
relevant settings: none that should affect this
This code causes a panic inside rust-analyzer:
Panic backtrace:
The text was updated successfully, but these errors were encountered: