diff options
| -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 |
