-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Destructuring assignment doesn't work for bare unit structs #118753
Labels
C-bug
Category: This is a bug.
Comments
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Dec 8, 2023
Oh, this was supposed to have been fixed in 1.62.0 with #95380. But that implements:
which isn't how I read "We support the following classes of expressions ... structs (including unit)", as I'd expect all those classes of expression to be valid at the top-level of the assignment. |
does work, using the " |
jsgf
changed the title
Destructuring assignment doesn't work for unit structs
Destructuring assignment doesn't work for bare unit structs
Dec 8, 2023
saethlin
removed
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Dec 10, 2023
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 13, 2023
Rollup merge of rust-lang#118759 - compiler-errors:bare-unit-structs, r=petrochenkov Support bare unit structs in destructuring assignments We should be allowed to use destructuring assignments on *bare* unit structs, not just unit structs that are located within other pattern constructors. Fixes rust-lang#118753 r? petrochenkov since you reviewed rust-lang#95380, reassign if you're busy or don't want to review this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this code:
I expected to see this being treated as a (trivial) destructuring assignment.
Instead, it fails with:
Likewise:
fails similarly.
On the other hand the very similar:
works as expected.
The RFC for this says:
It looks like enums are also not implemented. The PR implementing this for structs seems to overlook unit structs, and I couldn't find any place claiming to implement it for enums.
Meta
rustc --version --verbose
:And is also present in nightly.
The text was updated successfully, but these errors were encountered: