-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
A-resolveName resolution, paths, namespaces, preludes, etc.Name resolution, paths, namespaces, preludes, etc.C-bugCategory: This is a bug.Category: This is a bug.
Description
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:
The part before the . is an UnqualifiedPathExpression whose single SimplePathSegment is the keyword self.
§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 keyword self resolves to "the entity of the current module".
I've also filed rust-lang/reference#1427
Metadata
Metadata
Assignees
Labels
A-resolveName resolution, paths, namespaces, preludes, etc.Name resolution, paths, namespaces, preludes, etc.C-bugCategory: This is a bug.Category: This is a bug.