about summary refs log tree commit diff
diff options
context:
space:
mode:
-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##"