Skip to content

Commit 0ecbbf8

Browse files
committed
Review comment regarding Rc/etc.
1 parent cea25a8 commit 0ecbbf8

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/special-types-and-traits.md

+3-22
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,12 @@ r[lang-types.box.deref]
1717
* The [dereference operator] for `Box<T>` produces a place which can be moved
1818
from. This means that the `*` operator and the destructor of `Box<T>` are
1919
built-in to the language.
20-
21-
r[lang-types.box.receiver]
22-
* [Methods] can take `Box<Self>` as a receiver.
23-
2420
r[lang-types.box.fundamental]
2521
* A trait may be implemented for `Box<T>` in the same crate as `T`, which the
2622
[orphan rules] prevent for other generic types.
2723

2824
<!-- Editor Note: This is nowhere close to an exhaustive list -->
2925

30-
r[lang-types.rc]
31-
## `Rc<T>`
32-
33-
r[lang-types.rc.receiver]
34-
[Methods] can take [`Rc<Self>`] as a receiver.
35-
36-
r[lang-types.arc]
37-
## `Arc<T>`
38-
39-
r[lang-types.arc.receiver]
40-
[Methods] can take [`Arc<Self>`] as a receiver.
41-
42-
r[lang-types.pin]
43-
## `Pin<P>`
44-
45-
r[lang-types.pin.receiver]
46-
[Methods] can take [`Pin<P>`] as a receiver.
47-
4826
r[lang-types.unsafe-cell]
4927
## `UnsafeCell<T>`
5028

@@ -83,6 +61,9 @@ used as a method receiver; that is, the type of a `self` parameter for a
8361
method. There is a blanket implementation of `Receiver` for all `T: Deref`,
8462
so it's rare to implement `Receiver` directly: you'd only normally do this
8563
for smart pointer types which for some reason can't implement `Deref`.
64+
Built-in types which implement `Receiver` (via `Deref`) and are commonly
65+
used as method receivers include `Rc<T>`, `Arc<T>`, `Box<T>`, and `Pin<P>`
66+
where `P: Deref`.
8667

8768
r[lang-types.drop]
8869
## `Drop`

0 commit comments

Comments
 (0)