We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
self
In a method body, a path expression consisting only of the keyword self should resolve to the (binding of the) method's 'self parameter'.
I believe at the moment the FLS says this resolves to the containing module.
Example:
struct MyType { x: (), } impl MyType { fn simple_method(self) { self.x; } }
Looking at the self.x FieldAccessExpression:
self.x
FieldAccessExpression
The part before the . is an UnqualifiedPathExpression whose single SimplePathSegment is the keyword self.
.
UnqualifiedPathExpression
SimplePathSegment
§14.9.4.2 "Path Expression Resolution" says (in fls_dc0yv4306p82) that we resolve the leftmost (and only) segment using general path resolution.
fls_dc0yv4306p82
§14.9.4:12 (fls_ri50nc2dg7c4) says that a path segment which is the keyword self resolves to "the entity of the current module".
fls_ri50nc2dg7c4
I've also filed rust-lang/reference#1427
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In a method body, a path expression consisting only of the keyword
self
should resolve to the (binding of the) method's 'self parameter'.I believe at the moment the FLS says this resolves to the containing module.
Example:
Looking at the
self.x
FieldAccessExpression
:The part before the
.
is anUnqualifiedPathExpression
whose singleSimplePathSegment
is the keywordself
.§14.9.4.2 "Path Expression Resolution" says (in
fls_dc0yv4306p82
) that we resolve the leftmost (and only) segment using general path resolution.§14.9.4:12 (
fls_ri50nc2dg7c4
) says that a path segment which is the keywordself
resolves to "the entity of the current module".I've also filed rust-lang/reference#1427
The text was updated successfully, but these errors were encountered: