about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMoulins <arthur.heuillard@orange.fr>2025-07-08 21:10:40 +0200
committerMoulins <arthur.heuillard@orange.fr>2025-07-08 23:35:15 +0200
commitc9ff1609d4f7ccd001d9a1487e644831d0b06947 (patch)
tree030d4677be6ed0ef723fbe940f73ba18ca03abe2
parentab68b0fb26485ab1fa6977b2d8b59cc8a171c4aa (diff)
downloadrust-c9ff1609d4f7ccd001d9a1487e644831d0b06947.tar.gz
rust-c9ff1609d4f7ccd001d9a1487e644831d0b06947.zip
docs: document trait upcasting rules in `Unsize` trait
-rw-r--r--library/core/src/marker.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs
index 2aeb0b0c31e..f092916eb8c 100644
--- a/library/core/src/marker.rs
+++ b/library/core/src/marker.rs
@@ -210,6 +210,11 @@ pub trait PointeeSized {
 ///   - `Trait` is dyn-compatible[^1].
 ///   - The type is sized.
 ///   - The type outlives `'a`.
+/// - Trait objects `dyn TraitA + AutoA... + 'a` implement `Unsize<dyn TraitB + AutoB... + 'b>`
+///    if all of these conditions are met:
+///   - `TraitB` is a supertrait of `TraitA`.
+///   - `AutoB...` is a subset of `AutoA...`.
+///   - `'a` outlives `'b`.
 /// - Structs `Foo<..., T1, ..., Tn, ...>` implement `Unsize<Foo<..., U1, ..., Un, ...>>`
 /// where any number of (type and const) parameters may be changed if all of these conditions
 /// are met: