diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-03-01 17:23:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-01 17:23:27 +0100 |
| commit | 6fc73bc10a72d0e4475f8ab60e9902bddc03c1f6 (patch) | |
| tree | f9ce0961e2a98192ff08a0e3a55a6e966365d827 | |
| parent | e9e1ab10586bd07a58e7e5997622fb775b500d62 (diff) | |
| parent | 45053d1fa6a79baca1142b99ec9dcda89a61bf16 (diff) | |
| download | rust-6fc73bc10a72d0e4475f8ab60e9902bddc03c1f6.tar.gz rust-6fc73bc10a72d0e4475f8ab60e9902bddc03c1f6.zip | |
Rollup merge of #69554 - GuillaumeGomez:cleanup-e0374, r=Dylan-DPC
Cleanup e0374 r? @Dylan-DPC
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0374.md | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/librustc_error_codes/error_codes/E0374.md b/src/librustc_error_codes/error_codes/E0374.md index 0e1a4bf8099..6d7dc88823c 100644 --- a/src/librustc_error_codes/error_codes/E0374.md +++ b/src/librustc_error_codes/error_codes/E0374.md @@ -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: @@ -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 |
