diff --git a/src/paths.md b/src/paths.md index 9efbda701..30c076143 100644 --- a/src/paths.md +++ b/src/paths.md @@ -202,11 +202,20 @@ mod b { `self` resolves the path relative to the current module. `self` can only be used as the first segment, without a preceding `::`. +In a method body, a path which consists of a single `self` segment resolves to the method's self parameter. + + ```rust fn foo() {} fn bar() { self::foo(); } +struct S(bool); +impl S { + fn baz(self) { + self.0; + } +} # fn main() {} ```