Skip to content

Commit 0152a93

Browse files
committed
Auto merge of #29317 - matklad:clarify-reference, r=steveklabnik
Rust reference is a bit confusing here, because it does not explicitly mention trait objects. See an example of confusion here https://users.rust-lang.org/t/confusion-about-impls-without-for/3379/2 :) r? @steveklabnik
2 parents 996ba1d + 32e4ba8 commit 0152a93

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)