-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix RFC 2302 to support unit structs, fn pointers, and use value namespace instead for exprs #5
Fix RFC 2302 to support unit structs, fn pointers, and use value namespace instead for exprs #5
Conversation
…nit structs, change reference explanation, etc. + consequence changes.
text/0000-tuple-struct-self-ctor.md
Outdated
Rust (now) allows usage of `Self(v0, v1, ..)` inside inherent | ||
and trait `impl`s of tuple structs, either when mentioning the | ||
tuple struct directly in the `impl` header, or via a type alias. | ||
Rust (now) allows usage of `Self(v0, v1, ..)` inside inherent and |
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.
I find this now
confusing. Does it mean before or after the RFC?
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.
After the RFC :)
text/0000-tuple-struct-self-ctor.md
Outdated
Rust (now) allows usage of `Self(v0, v1, ..)` inside inherent and | ||
trait `impl`s of tuple structs, either when mentioning the tuple struct | ||
directly in the `impl` header, or via a type alias. | ||
This usage is permitted both in expression and pattern contexts. |
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.
I think I would prefer if we can rewrite this Reference-Level Explanation to be a little more "implementation focused". Right now it reads a bit to me like restating the premise of the RFC. For example, I think I would prefer to say:
When entering one of the following contexts, the value namespace is extended with Self
which maps to the tuple constructor fn (or constant, in the case of a unit struct):
- inherent impls where the
Self
type is a tuple or unit struct - trait impls where the
Self
type is a tuple or unit struct
text/0000-tuple-struct-self-ctor.md
Outdated
directly in the `impl` header, or via a type alias. | ||
This usage is permitted both in expression and pattern contexts. | ||
|
||
Furthermore, `Self`, when referring to a tuple struct, can be legally coerced |
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.
I think this basically follows from the description I gave before; it could be rewritten to say "This should allow Self
to be legally coerced..."
Changes:
Self
is permitted as a function pointer,