Skip to content

Commit cd05ef2

Browse files
committed
Explain what the macro requires without reference to DispatchFromDyn
1 parent 44e8727 commit cd05ef2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

text/3621-derive-smart-pointer.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,16 @@ The macro sets the following requirements on its input:
255255
`#[pointee]` derive helper attribute.
256256
3. The struct must not be `#[repr(packed)]` or `#[repr(C)]`.
257257
4. Other than one-aligned, zero-sized fields, the struct must have exactly one
258-
field and that field’s type must be must implement `DispatchFromDyn<F>`
259-
where `F` is the type of `T`’s field type.
258+
field.
259+
5. Assume that `T` is a type that can be unsized to `U`, and let `FT` and `FU`
260+
be the type of the struct's field when the pointee is equal to `T` and `U`
261+
respectively. If the struct's trait bounds are satisfied for both `T` and
262+
`U`, then it must be possible to convert `FT` to `FU` using an unsizing
263+
coercion.
260264

261265
(Adapted from the docs for [`DispatchFromDyn`].)
262266

263-
Point 1 and 2 are verified syntactically by the derive macro, whereas 3 and 4
267+
Point 1 and 2 are verified syntactically by the derive macro, whereas 3, 4 and 5
264268
are verified semantically by the compiler when checking the generated
265269
[`DispatchFromDyn`] implementation as it does today.
266270

0 commit comments

Comments
 (0)