-
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 arguments in trait methods with bodies fails with a syntax error #55036
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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: