-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Destructuring arguments in trait methods with bodies fails with a syntax error #55036
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
Comments
FWIW, your sample code is now valid in the 2018 edition. |
I think it might be a regression brought about by the recent PR. |
Oh, you're right, my bad! It looks like the error was regressed by #54415. |
Fixed in #57251 |
bors
added a commit
that referenced
this issue
Jan 2, 2019
syntax: Fix regression in diagnostics for patterns in trait method parameters Fixes #55036
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
You can't destructure an argument in a trait method which has code in the body.
Minimal example
Expectation
This should work fine. Destructuring an argument in a trait method seems totally reasonable.
Reality
The line
fn foo_in_trait(Foo { bar }: Foo) {
gives errorsMeta
rustc version:
rustc 1.31.0-nightly (5af0bb830 2018-10-10)
Let's speculate
This might be related to #53051, maybe? In particular, I would expect to see the error message from that pull request in this case, if this were validly invalid code.
The text was updated successfully, but these errors were encountered: