about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-09-03 08:03:09 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-09-03 08:03:09 -0700
commit28b518474ed2a5dee812e4f356f71f4c60628421 (patch)
treec5d85641afd1087107c068b968f3f77246546f17
parentefe85943b3a5e7b3920db5a5a53183c75fc80d0c (diff)
downloadrust-28b518474ed2a5dee812e4f356f71f4c60628421.tar.gz
rust-28b518474ed2a5dee812e4f356f71f4c60628421.zip
review comments: error code text
-rw-r--r--src/librustc_typeck/error_codes.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/librustc_typeck/error_codes.rs b/src/librustc_typeck/error_codes.rs
index ebfa6acf23e..a2b1f16ef3d 100644
--- a/src/librustc_typeck/error_codes.rs
+++ b/src/librustc_typeck/error_codes.rs
@@ -2431,26 +2431,28 @@ This error indicates that the `self` parameter in a method has an invalid
 
 Methods take a special first parameter, of which there are three variants:
 `self`, `&self`, and `&mut self`. These are syntactic sugar for
-`self: Self`, `self: &Self`, and `self: &mut Self` respectively. The type
-`Self` acts as an alias to the type of the current trait implementer, or
-"receiver type". Besides the already mentioned `Self`, `&Self` and
-`&mut Self` valid receiver types, the following are also valid:
-`self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, and `self: Pin<P>`
-(where P is one of the previous types except `Self`).
+`self: Self`, `self: &Self`, and `self: &mut Self` respectively.
 
 ```
 # struct Foo;
 trait Trait {
     fn foo(&self);
+//         ^^^^^ `self` here is a reference to the receiver object
 }
 
 impl Trait for Foo {
     fn foo(&self) {}
-//         ^^^^^ this the receiver type `&Foo`
+//         ^^^^^ the receiver type is `&Foo`
 }
 ```
 
-The above is equivalent to:
+The type `Self` acts as an alias to the type of the current trait
+implementer, or "receiver type". Besides the already mentioned `Self`,
+`&Self` and `&mut Self` valid receiver types, the following are also valid:
+`self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, and `self: Pin<P>`
+(where P is one of the previous types except `Self`). Note that `Self` can
+also be the underlying implementing type, like `Foo` in the following
+example:
 
 ```
 # struct Foo;