about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLin Clark <lclark@mozilla.com>2017-01-05 13:42:22 -0500
committerLin Clark <lclark@mozilla.com>2017-01-05 13:42:22 -0500
commitac28aba886c92ff3b81347425c7b09cdfaf88ec8 (patch)
tree0733086bb2d852738b8b3b349c8673acda1a02b5
parent437c66cce5b13e18fa7ae09a4bb7fa9d86b01ec3 (diff)
added how to fix the problem block
-rw-r--r--src/librustc_typeck/diagnostics.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index 1a87a5e709b..28f4cacd635 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -3091,7 +3091,7 @@ E0328: r##"
 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 @@ conversion from a sized to an unsized type with the [DST coercion system]
 (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##"