diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-03-01 17:23:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-01 17:23:32 +0100 |
| commit | 8ffbf9033b74209a0e4fe52a9b80da52e0b8f373 (patch) | |
| tree | 77f99d01a381db2d511ffcec3436796894588096 | |
| parent | 87284d7e79da9eb106ba120600d4fb4767897869 (diff) | |
| parent | 6fba47f66f12212c7da504702aff7c69a8e15d02 (diff) | |
| download | rust-8ffbf9033b74209a0e4fe52a9b80da52e0b8f373.tar.gz rust-8ffbf9033b74209a0e4fe52a9b80da52e0b8f373.zip | |
Rollup merge of #69577 - GuillaumeGomez:cleanup-e0375, r=Dylan-DPC
Clean up E0375 explanation r? @Dylan-DPC
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0375.md | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/librustc_error_codes/error_codes/E0375.md b/src/librustc_error_codes/error_codes/E0375.md index 31fcd85cb07..71e53057165 100644 --- a/src/librustc_error_codes/error_codes/E0375.md +++ b/src/librustc_error_codes/error_codes/E0375.md @@ -1,12 +1,7 @@ -A struct with more than one field containing an unsized type cannot implement -`CoerceUnsized`. This only occurs when you are trying to coerce one of the -types in your struct to another type in the struct. In this case we try to -impl `CoerceUnsized` from `T` to `U` which are both types that the struct -takes. 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. +`CoerceUnsized` was implemented on a struct which contains more than one field +with an unsized type. -Example of erroneous code: +Erroneous code example: ```compile_fail,E0375 #![feature(coerce_unsized)] @@ -22,6 +17,14 @@ struct Foo<T: ?Sized, U: ?Sized> { impl<T, U> CoerceUnsized<Foo<U, T>> for Foo<T, U> {} ``` +A struct with more than one field containing an unsized type cannot implement +`CoerceUnsized`. This only occurs when you are trying to coerce one of the +types in your struct to another type in the struct. In this case we try to +impl `CoerceUnsized` from `T` to `U` which are both types that the struct +takes. 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. + `CoerceUnsized` only allows for coercion from a structure with a single unsized type field to another struct with a single unsized type field. In fact Rust only allows for a struct to have one unsized type in a struct |
