Do not limit Self usage in trait implementation

e.g. the following `Self` usage is valid
```rust
struct S { s: Option<Box<Self>> } ;
impl S {
    pub fn new() -> Self {
        S { s: None }
    }
}
```
This commit is contained in:
king6cong
2019-12-26 15:26:52 +08:00
parent 5c5cfd2e94
commit 331ce5b2ba
+1 -1
View File
@@ -40,7 +40,7 @@ The following keywords currently have the functionality described.
* `pub` - denote public visibility in struct fields, `impl` blocks, or modules
* `ref` - bind by reference
* `return` - return from function
* `Self` - a type alias for the type implementing a trait
* `Self` - a type alias for the type we are defining or implementing
* `self` - method subject or current module
* `static` - global variable or lifetime lasting the entire program execution
* `struct` - define a structure