Update docs to not refer to the of clause in an impl

Closes #3375
This commit is contained in:
Tim Chevalier 2012-09-06 16:19:34 -07:00
parent 46990ad111
commit 0ce88fe401
2 changed files with 7 additions and 10 deletions

View File

@ -1309,8 +1309,8 @@ the same time.
It is possible to define an implementation without referring to a
trait. The methods in such an implementation can only be used
statically (as direct calls on the values of the type that the
implementation targets). In such an implementation, the `of` clause is
not given, and the name is mandatory. Such implementations are
implementation targets). In such an implementation, the type after the colon is omitted,
and the name is mandatory. Such implementations are
limited to nominal types (enums, structs) and the implementation must
appear in the same module or a sub-module as the receiver type.

View File

@ -1951,8 +1951,8 @@ whose element type does not have a `to_str` implementation in scope.
## Polymorphic traits
Traits may contain type parameters. This defines a trait for
generalized sequence types:
Traits may contain type parameters. A trait for
generalized sequence types is:
~~~~
trait seq<T> {
@ -1967,11 +1967,8 @@ impl<T> ~[T]: seq<T> {
}
~~~~
Note that the implementation has to explicitly declare the type
parameter that it binds, `T`, before using it to specify its trait type. This is
needed because it could also, for example, specify an implementation
of `seq<int>`—the `of` clause *refers* to a type, rather than defining
one.
The implementation has to explicitly declare the type
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.
The type parameters bound by a trait are in scope in each of the
method declarations. So, re-declaring the type parameter
@ -2066,7 +2063,7 @@ more expensive than statically resolved method calls.
If you only intend to use an implementation for static overloading,
and there is no trait available that it conforms to, you are free
to leave off the `of` clause. However, this is only possible when you
to leave off the type after the colon. However, this is only possible when you
are defining an implementation in the same module as the receiver
type, and the receiver type is a named type (i.e., an enum or a
class); [single-variant enums](#single_variant_enum) are a common