@@ -2431,26 +2431,28 @@ This error indicates that the `self` parameter in a method has an invalid
24312431
24322432Methods take a special first parameter, of which there are three variants:
24332433`self`, `&self`, and `&mut self`. These are syntactic sugar for
2434- `self: Self`, `self: &Self`, and `self: &mut Self` respectively. The type
2435- `Self` acts as an alias to the type of the current trait implementer, or
2436- "receiver type". Besides the already mentioned `Self`, `&Self` and
2437- `&mut Self` valid receiver types, the following are also valid:
2438- `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, and `self: Pin<P>`
2439- (where P is one of the previous types except `Self`).
2434+ `self: Self`, `self: &Self`, and `self: &mut Self` respectively.
24402435
24412436```
24422437# struct Foo;
24432438trait Trait {
24442439 fn foo(&self);
2440+ // ^^^^^ `self` here is a reference to the receiver object
24452441}
24462442
24472443impl Trait for Foo {
24482444 fn foo(&self) {}
2449- // ^^^^^ this the receiver type `&Foo`
2445+ // ^^^^^ the receiver type is `&Foo`
24502446}
24512447```
24522448
2453- The above is equivalent to:
2449+ The type `Self` acts as an alias to the type of the current trait
2450+ implementer, or "receiver type". Besides the already mentioned `Self`,
2451+ `&Self` and `&mut Self` valid receiver types, the following are also valid:
2452+ `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, and `self: Pin<P>`
2453+ (where P is one of the previous types except `Self`). Note that `Self` can
2454+ also be the underlying implementing type, like `Foo` in the following
2455+ example:
24542456
24552457```
24562458# struct Foo;
0 commit comments