Clean up E0374 explanation
This commit is contained in:
parent
abc3073c92
commit
45053d1fa6
1 changed files with 8 additions and 6 deletions
|
@ -1,9 +1,5 @@
|
||||||
A struct without a field containing an unsized type cannot implement
|
`CoerceUnsized` was implemented on a struct which does not contain a field with
|
||||||
`CoerceUnsized`. An [unsized type][1] is any type that the compiler
|
an unsized type.
|
||||||
doesn't know the length or alignment of at compile time. Any struct
|
|
||||||
containing an unsized type is also unsized.
|
|
||||||
|
|
||||||
[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
|
|
||||||
|
|
||||||
Example of erroneous code:
|
Example of erroneous code:
|
||||||
|
|
||||||
|
@ -20,6 +16,12 @@ impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
|
||||||
where T: CoerceUnsized<U> {}
|
where T: CoerceUnsized<U> {}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
An [unsized type][1] is any type where the compiler does not know the length or
|
||||||
|
alignment of at compile time. Any struct containing an unsized type is also
|
||||||
|
unsized.
|
||||||
|
|
||||||
|
[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
|
||||||
|
|
||||||
`CoerceUnsized` is used to coerce one struct containing an unsized type
|
`CoerceUnsized` is used to coerce one struct containing an unsized type
|
||||||
into another struct containing a different unsized type. If the struct
|
into another struct containing a different unsized type. If the struct
|
||||||
doesn't have any fields of unsized types then you don't need explicit
|
doesn't have any fields of unsized types then you don't need explicit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue