Skip to content

Commit 6fba47f

Browse files
Clean up E0375 explanation
1 parent abc3073 commit 6fba47f

File tree

1 file changed

+11
-8
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+11
-8
lines changed

src/librustc_error_codes/error_codes/E0375.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
A struct with more than one field containing an unsized type cannot implement
2-
`CoerceUnsized`. This only occurs when you are trying to coerce one of the
3-
types in your struct to another type in the struct. In this case we try to
4-
impl `CoerceUnsized` from `T` to `U` which are both types that the struct
5-
takes. An [unsized type][1] is any type that the compiler doesn't know the
6-
length or alignment of at compile time. Any struct containing an unsized type
7-
is also unsized.
1+
`CoerceUnsized` was implemented on a struct which contains more than one field
2+
with an unsized type.
83

9-
Example of erroneous code:
4+
Erroneous code example:
105

116
```compile_fail,E0375
127
#![feature(coerce_unsized)]
@@ -22,6 +17,14 @@ struct Foo<T: ?Sized, U: ?Sized> {
2217
impl<T, U> CoerceUnsized<Foo<U, T>> for Foo<T, U> {}
2318
```
2419

20+
A struct with more than one field containing an unsized type cannot implement
21+
`CoerceUnsized`. This only occurs when you are trying to coerce one of the
22+
types in your struct to another type in the struct. In this case we try to
23+
impl `CoerceUnsized` from `T` to `U` which are both types that the struct
24+
takes. An [unsized type][1] is any type that the compiler doesn't know the
25+
length or alignment of at compile time. Any struct containing an unsized type
26+
is also unsized.
27+
2528
`CoerceUnsized` only allows for coercion from a structure with a single
2629
unsized type field to another struct with a single unsized type field.
2730
In fact Rust only allows for a struct to have one unsized type in a struct

0 commit comments

Comments
 (0)