Skip to content

Commit

Permalink
Apply review comments to trait upcasting description
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Dec 16, 2024
1 parent 7451a0e commit a7c967f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/type-coercions.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ relate to converting types to unsized types, and are permitted in a few
cases where other coercions are not, as described above. They can still happen
anywhere else a coercion can occur.

r[coerce.unsize.misnomer]
> Note: "unsizing" is a bit of a misnomer,
> since this covers unsized->unsized coercions too.
r[coerce.unsize.trait]
Two traits, [`Unsize`] and [`CoerceUnsized`], are used
to assist in this process and expose it for library use. The following
Expand All @@ -213,6 +217,8 @@ r[coerce.unsize.trait-object]

r[coerce.unsize.trait-upcast]
* `dyn T` to `dyn U`, when `U` is one of `T`'s supertraits.
* `dyn T` to `dyn U` when `U` is one of `T`'s [supertraits].
* This allows dropping auto traits, i.e. `dyn T + Auto` to `dyn U` is allowed.

r[coerce.unsized.composite]
* `Foo<..., T, ...>` to `Foo<..., U, ...>`, when:
Expand Down Expand Up @@ -330,3 +336,4 @@ precisely.
[`Unsize`]: std::marker::Unsize
[`CoerceUnsized`]: std::ops::CoerceUnsized
[method-call expressions]: expressions/method-call-expr.md
[supertraits]: items/traits.md#supertraits

0 comments on commit a7c967f

Please sign in to comment.