-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Named and destructable self
#922
Conversation
Destruction and destructuring are two rather different things. |
|
||
# Summary | ||
|
||
Allow destructing assignment for `self` argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
destructuring
and all the other places
The "Rendered" is a dead link. |
(fixed link) |
Thank you for posting this. I actually believe the intention, during the UFCS design, was to add this feature (or something very much like it). In particular, you can today already write: struct Foo(u32, String);
impl Foo {
fn bar(x: Self) -> String {
x.1
}
} (note however, that one is currently forced to call the above via the syntax Anyway, we do already have a start to what you describe. Of course, in addition to the method call issue noted above, it also does not yet allow destructuring. (But I suspect this was an oversight, not a concious design choice.) @nikomatsakis can you comment on whether the UFCS RFC needs an amendment to include destructuring |
reassigning to @nikomatsakis |
Indeed, the already accepted RFC 48 permitted this sort of syntax. That was not implemented. I have some concerns that we may not be able to implement it backwards compatibly -- in particular, we currently use the |
Rendered.