Skip to content

Commit 135a8af

Browse files
committed
repair out of date text from ref manual regarding iface-less impls
1 parent 9c1dea5 commit 135a8af

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

doc/rust.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,20 +1350,13 @@ implemented. Implementation names do not conflict the way other names
13501350
do: multiple implementations with the same name may exist in a scope at
13511351
the same time.
13521352

1353-
It is possible to define an implementation without referring to a trait.
1354-
The methods in such an implementation can only be used
1353+
It is possible to define an implementation without referring to a
1354+
trait. The methods in such an implementation can only be used
13551355
statically (as direct calls on the values of the type that the
13561356
implementation targets). In such an implementation, the `of` clause is
1357-
not given, and the name is mandatory.
1358-
1359-
~~~~
1360-
impl uint_loops for uint {
1361-
fn times(f: fn(uint)) {
1362-
let mut i = 0u;
1363-
while i < self { f(i); i += 1u; }
1364-
}
1365-
}
1366-
~~~~
1357+
not given, and the name is mandatory. Such implementations are
1358+
limited to nominal types (enums, classes) and the implementation must
1359+
appear in the same module or a sub-module as the receiver type.
13671360

13681361
_When_ a trait is specified, all methods declared as part of the
13691362
trait must be present, with matching types and type parameter

0 commit comments

Comments
 (0)