]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #87904 - kpreid:unsize, r=jyn514
authorJubilee <46493976+workingjubilee@users.noreply.github.com>
Sat, 11 Sep 2021 15:23:38 +0000 (08:23 -0700)
committerGitHub <noreply@github.com>
Sat, 11 Sep 2021 15:23:38 +0000 (08:23 -0700)
commit95b50eb6629a7877c06fb0ab545a6016ea579897
tree0e2e2131222cb03f0ae03c5960ec5f8aaf4e6bb0
parent641e02f388acc6b1d316a59c605a32d1711a8758
parent07988bb8a1ce5b6732d351c4299f0b0a4d51e192
Rollup merge of #87904 - kpreid:unsize, r=jyn514

Reword description of automatic impls of `Unsize`.

The existing documentation felt a little unhelpfully concise, so this change tries to improve it by using longer sentences, each of which specifies which kinds of types it applies to as early as possible. In particular, the third item starts with “Structs ...” instead of saying “Foo is a struct” later.

Also, the previous list items “Only the last field has a type involving `T`” and “`T` is not part of the type of any other fields” are, as far as I see, redundant with each other, so I removed the latter.

I have no particular knowledge of `Unsize`; I have attempted to leave the meaning entirely unchanged but may have missed a nuance.

Markdown preview of the edited documentation:

> All implementations of `Unsize` are provided automatically by the compiler.
> Those implementations are:
>
> - Arrays `[T; N]` implement `Unsize<[T]>`.
> - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
> - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
>   are met:
>   - `T: Unsize<U>`.
>   - Only the last field of `Foo` has a type involving `T`.
>   - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.
library/core/src/marker.rs