From 135a8afd7b2e969bac352baa5fef377c5c90476f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 18 Jul 2012 15:55:13 -0700 Subject: [PATCH] repair out of date text from ref manual regarding iface-less impls --- doc/rust.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/doc/rust.md b/doc/rust.md index d1def7cbf93..e8214030efe 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1350,20 +1350,13 @@ implemented. Implementation names do not conflict the way other names do: multiple implementations with the same name may exist in a scope at 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 +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. - -~~~~ -impl uint_loops for uint { - fn times(f: fn(uint)) { - let mut i = 0u; - while i < self { f(i); i += 1u; } - } -} -~~~~ +not given, and the name is mandatory. Such implementations are +limited to nominal types (enums, classes) and the implementation must +appear in the same module or a sub-module as the receiver type. _When_ a trait is specified, all methods declared as part of the trait must be present, with matching types and type parameter