Skip to content

Commit

Permalink
Clean up E0374 explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 29, 2020
1 parent abc3073 commit 45053d1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/librustc_error_codes/error_codes/E0374.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
A struct without a field containing an unsized type cannot implement
`CoerceUnsized`. An [unsized type][1] is any type that the compiler
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
`CoerceUnsized` was implemented on a struct which does not contain a field with
an unsized type.

Example of erroneous code:

Expand All @@ -20,6 +16,12 @@ impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
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
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
Expand Down

0 comments on commit 45053d1

Please sign in to comment.