Skip to content

Commit 0ce88fe

Browse files
committed
Update docs to not refer to the of clause in an impl
Closes #3375
1 parent 46990ad commit 0ce88fe

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,8 +1309,8 @@ the same time.
13091309
It is possible to define an implementation without referring to a
13101310
trait. The methods in such an implementation can only be used
13111311
statically (as direct calls on the values of the type that the
1312-
implementation targets). In such an implementation, the `of` clause is
1313-
not given, and the name is mandatory. Such implementations are
1312+
implementation targets). In such an implementation, the type after the colon is omitted,
1313+
and the name is mandatory. Such implementations are
13141314
limited to nominal types (enums, structs) and the implementation must
13151315
appear in the same module or a sub-module as the receiver type.
13161316

doc/tutorial.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,8 +1951,8 @@ whose element type does not have a `to_str` implementation in scope.
19511951

19521952
## Polymorphic traits
19531953

1954-
Traits may contain type parameters. This defines a trait for
1955-
generalized sequence types:
1954+
Traits may contain type parameters. A trait for
1955+
generalized sequence types is:
19561956

19571957
~~~~
19581958
trait seq<T> {
@@ -1967,11 +1967,8 @@ impl<T> ~[T]: seq<T> {
19671967
}
19681968
~~~~
19691969

1970-
Note that the implementation has to explicitly declare the type
1971-
parameter that it binds, `T`, before using it to specify its trait type. This is
1972-
needed because it could also, for example, specify an implementation
1973-
of `seq<int>`—the `of` clause *refers* to a type, rather than defining
1974-
one.
1970+
The implementation has to explicitly declare the type
1971+
parameter that it binds, `T`, before using it to specify its trait type. Rust requires this declaration because the `impl` could also, for example, specify an implementation of `seq<int>`. The trait type -- appearing after the colon in the `impl` -- *refers* to a type, rather than defining one.
19751972

19761973
The type parameters bound by a trait are in scope in each of the
19771974
method declarations. So, re-declaring the type parameter
@@ -2066,7 +2063,7 @@ more expensive than statically resolved method calls.
20662063

20672064
If you only intend to use an implementation for static overloading,
20682065
and there is no trait available that it conforms to, you are free
2069-
to leave off the `of` clause. However, this is only possible when you
2066+
to leave off the type after the colon. However, this is only possible when you
20702067
are defining an implementation in the same module as the receiver
20712068
type, and the receiver type is a named type (i.e., an enum or a
20722069
class); [single-variant enums](#single_variant_enum) are a common

0 commit comments

Comments
 (0)