File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1- A struct without a field containing an unsized type cannot implement
2- ` CoerceUnsized ` . An [ unsized type] [ 1 ] is any type that the compiler
3- doesn't know the length or alignment of at compile time. Any struct
4- containing an unsized type is also unsized.
5-
6- [ 1 ] : https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
1+ ` CoerceUnsized ` was implemented on a struct which does not contain a field with
2+ an unsized type.
73
84Example of erroneous code:
95
@@ -20,6 +16,12 @@ impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
2016 where T: CoerceUnsized<U> {}
2117```
2218
19+ An [ unsized type] [ 1 ] is any type where the compiler does not know the length or
20+ alignment of at compile time. Any struct containing an unsized type is also
21+ unsized.
22+
23+ [ 1 ] : https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
24+
2325` CoerceUnsized ` is used to coerce one struct containing an unsized type
2426into another struct containing a different unsized type. If the struct
2527doesn't have any fields of unsized types then you don't need explicit
You can’t perform that action at this time.
0 commit comments