From c9ff1609d4f7ccd001d9a1487e644831d0b06947 Mon Sep 17 00:00:00 2001 From: Moulins Date: Tue, 8 Jul 2025 21:10:40 +0200 Subject: [PATCH] docs: document trait upcasting rules in `Unsize` trait --- library/core/src/marker.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 2aeb0b0c31e46..f092916eb8c1c 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` +/// 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>` /// where any number of (type and const) parameters may be changed if all of these conditions /// are met: