-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
"Insert explicit type" suggestion produces invalid code for array #2922
Labels
Comments
Not that I disagree that this is a bug, but wasn't there an RFC to allow underscores for array lengths? It seems like a nice feature. EDIT: rust-lang/rfcs#2545 |
You were a bit faster than I was! ^^ But that RFC hasn't been merged yet, and apparently also hasn't been implemented, considering I get that error message on Nightly. |
lnicola
added
A-assists
S-actionable
Someone could pick this issue up and work on it right now
labels
Jan 25, 2021
lf-
added a commit
to lf-/rust-analyzer
that referenced
this issue
May 14, 2021
Fix rust-lang#2922: add unknown length as a condition for a type having unknown. Incorporate reviews by @flodiebold: * Extract some of the const evaluation workings into functions * Add fixmes on the hacks * Add tests for impls on specific array lengths (these work!!! 😁) * Add tests for const generics (indeed we don't support it yet)
lf-
added a commit
to lf-/rust-analyzer
that referenced
this issue
May 14, 2021
Fix rust-lang#2922: add unknown length as a condition for a type having unknown. Incorporate reviews: * Extract some of the const evaluation workings into functions * Add fixmes on the hacks * Add tests for impls on specific array lengths (these work!!! 😁) * Add tests for const generics (indeed we don't support it yet)
bors bot
added a commit
that referenced
this issue
May 16, 2021
8813: Get some more array lengths! r=lf- a=lf- This is built on #8799 and thus contains its changes. I'll rebase it onto master when that one gets merged. It adds support for r-a understanding the length of: * `let a: [u8; 2] = ...` * `let a = b"aaa"` * `let a = [0u8; 4]` I have added support for getting the values of byte strings, which was not previously there. I am least confident in the correctness of this part and it probably needs some more tests, as we currently have only one test that exercised that part (!). Fixes #2922. Co-authored-by: Jade <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
For arrays, ra produces an invalid suggestion to insert
[T;_]
, whereT
is a concrete type, but_
is literally an underscore, which is not valid in that position.Example:
produces a suggestion that when applied results in
which leads to the error message
The text was updated successfully, but these errors were encountered: