Skip to content

Commit 9d33008

Browse files
committed
tutorial: Fix 'self' to 'Self'
1 parent ea74f68 commit 9d33008

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

doc/tutorial.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,11 +2056,10 @@ method declarations. So, re-declaring the type parameter
20562056
`T` as an explicit type parameter for `len`, in either the trait or
20572057
the impl, would be a compile-time error.
20582058

2059-
Within a trait definition, `self` is a special type that you can think
2059+
Within a trait definition, `Self` is a special type that you can think
20602060
of as a type parameter. An implementation of the trait for any given
2061-
type `T` replaces the `self` type parameter with `T`. Simply, in a
2062-
trait, `self` is a type, and in an impl, `self` is a value. The
2063-
following trait describes types that support an equality operation:
2061+
type `T` replaces the `Self` type parameter with `T`. The following
2062+
trait describes types that support an equality operation:
20642063

20652064
~~~~
20662065
// In a trait, `self` refers to the self argument.
@@ -2076,7 +2075,7 @@ impl Eq for int {
20762075
~~~~
20772076

20782077
Notice that in the trait definition, `equals` takes a
2079-
second parameter of type `self`.
2078+
second parameter of type `Self`.
20802079
In contrast, in the `impl`, `equals` takes a second parameter of
20812080
type `int`, only using `self` as the name of the receiver.
20822081

0 commit comments

Comments
 (0)