Skip to content

Should work? let a; let b; (a, b) = (1, 2); #8273

New issue

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

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

Already on GitHub? # to your account

Closed
jeaye opened this issue Aug 3, 2013 · 3 comments
Closed

Should work? let a; let b; (a, b) = (1, 2); #8273

jeaye opened this issue Aug 3, 2013 · 3 comments

Comments

@jeaye
Copy link

jeaye commented Aug 3, 2013

This seems like it should be allowed, but it errors out with:

<anon>:5:24: 5:25 error: use of possibly uninitialized variable: `a`
<anon>:5          let a; let b; (a, b) = (1, 2); b
                                 ^
<anon>:5:27: 5:28 error: use of possibly uninitialized variable: `b`
<anon>:5          let a; let b; (a, b) = (1, 2); b
                                    ^
error: aborting due to 2 previous errors
application terminated with error code 101
@thestinger
Copy link
Contributor

It's not allowed, only let, match and parameters use patterns.

#7508

@thestinger
Copy link
Contributor

Allowing binding to an lvalue in a pattern seems like RFC material but I don't know how feasible it is. It's not as simple as just the usage here.

@glaebhoerl
Copy link
Contributor

There was discussion of this idea on reddit: http://www.reddit.com/r/rust/comments/1hsqf5/proposal_for_an_additional_use_case_of_the_in/, with the objection being that it would prevent the grammar from being LL(finite number).

flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 17, 2022
…ef_to_type_aliases, r=llogiq

Apply `not_unsafe_ptr_arg_deref` to type aliases

changelog: Apply [`not_unsafe_ptr_arg_deref`] to type aliases
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants