Skip to content

Commit 32e4ba8

Browse files
committed
reference: clarify impl
Another kind of nominal types in Rust are trait objects, so the following is valid ```rust trait A { } impl A { } ```
1 parent 72ed590 commit 32e4ba8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/doc/reference.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1520,11 +1520,11 @@ impl Shape for Circle {
15201520
```
15211521

15221522
It is possible to define an implementation without referring to a trait. The
1523-
methods in such an implementation can only be used as direct calls on the
1524-
values of the type that the implementation targets. In such an implementation,
1525-
the trait type and `for` after `impl` are omitted. Such implementations are
1526-
limited to nominal types (enums, structs), and the implementation must appear
1527-
in the same crate as the `self` type:
1523+
methods in such an implementation can only be used as direct calls on the values
1524+
of the type that the implementation targets. In such an implementation, the
1525+
trait type and `for` after `impl` are omitted. Such implementations are limited
1526+
to nominal types (enums, structs, trait objects), and the implementation must
1527+
appear in the same crate as the `self` type:
15281528

15291529
```
15301530
struct Point {x: i32, y: i32}

0 commit comments

Comments
 (0)