diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-07-10 15:19:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-10 15:19:30 +0200 |
| commit | bdf1941c1277042fc93ba7e12a34db0a074f27de (patch) | |
| tree | 5263f6d1d80f0a79cbcbd7da552e9e196706300e | |
| parent | a0c78871996bfffbfb43a34518cb69d1fc1eddf6 (diff) | |
| parent | c9ff1609d4f7ccd001d9a1487e644831d0b06947 (diff) | |
Rollup merge of #143652 - moulins:doc-unsize-trait-upcasting, r=compiler-errors
docs: document trait upcasting rules in `Unsize` trait The trait upcasting feature stabilized in 1.86 added new `Unsize` implementation, but this wasn't reflected in the trait's documentation.
| -rw-r--r-- | library/core/src/marker.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 1c0629f259d..6531d3ec766 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: |
