added how to fix the problem block

This commit is contained in:
Lin Clark
2017-01-05 13:42:22 -05:00
parent 437c66cce5
commit ac28aba886
+14 -1
View File
@@ -3091,7 +3091,7 @@ impl Foo for Bar {
The Unsize trait should not be implemented directly. All implementations of
Unsize are provided automatically by the compiler.
Here's an example of this error:
Erroneous code example:
```compile_fail,E0328
#![feature(unsize)]
@@ -3108,6 +3108,19 @@ impl<T> Unsize<T> for MyType {}
(https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md), use
[`CoerceUnsized`](https://doc.rust-lang.org/std/ops/trait.CoerceUnsized.html)
instead.
```
#![feature(coerce_unsized)]
use std::ops::CoerceUnsized;
pub struct MyType<T: ?Sized> {
field_with_unsized_type: T,
}
impl<T, U> CoerceUnsized<MyType<U>> for MyType<T>
where T: CoerceUnsized<U> {}
```
"##,
E0329: r##"