-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
feature(destructuring_assignment) suggested errorneously #90095
Comments
ah, wait, reading closer , #71126 (comment) implies that this behavior is expected, even if maybe unfortunate. I'll leave this bug report open for now, but feel free to close as WAI if that is the correct reading. |
Encountered a similar case today, and this seems related to rust-lang/rfcs#2545. |
The behaviour is correct, but a little confusingly-worded. By "left-hand side of an assignment", it means the variable being assigned to, rather than any syntax to the left of |
@varkor According to the Reference:
... maybe here it's better to say:
|
We have to be careful to use terminology most users will understand, and I think "place expression" is jargon that not a lot of users will be familiar with. |
@varkor I understand this but it's hard to be both precise and straightforward... Let me try again:
Another possible version, but I'm not sure if this breaks the original meaning or not:
As a user, I think the predicate "in expressions" confuses me, since I'm using PS: I believe this problem is temporary. I guess once the array size can be omitted, this error will be always talking about the variable being assigned to (or does it?) |
Sorry to be using this issue's comments section to ask this, but wasn't this the syntax used to ask the compiler to figure out the size of the array In other words, I thought this was legal code: fn main(){
let foo: [u8; _] = [1,2,3];
} I'm very confused... How am I supposed to write that, then? |
@araruna This error message is hopefully a temporary state and will probably be fixed with rust-lang/rfcs#2545. |
(playground)
However the
#![feature(destructuring_assignment)]
seems to be completely irrelevant here, and indeed adding that (playground)still gives error of
(Tangentially: technically the error message is wrong since
_
is used in the left hand side of an assignment. Just not as the variable name as rustc expected... )cc #71126
The text was updated successfully, but these errors were encountered: