Skip to content

Commit 43bd16d

Browse files
committed
docs: document trait upcasting rules in Unsize trait
1 parent f838cbc commit 43bd16d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/core/src/marker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ pub trait PointeeSized {
210210
/// - `Trait` is dyn-compatible[^1].
211211
/// - The type is sized.
212212
/// - The type outlives `'a`.
213+
/// - Trait objects `dyn TraitA + AutoA... + 'a` implement `Unsize<dyn TraitB + AutoB... + 'b>`
214+
/// if all of these conditions are met:
215+
/// - `TraitB`` is a supertrait of `TraitA`.
216+
/// - `AutoB...` is a subset of `AutoA...`.
217+
/// - `'a` outlives `'b`.
213218
/// - Structs `Foo<..., T1, ..., Tn, ...>` implement `Unsize<Foo<..., U1, ..., Un, ...>>`
214219
/// where any number of (type and const) parameters may be changed if all of these conditions
215220
/// are met:

0 commit comments

Comments
 (0)