File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3091,7 +3091,7 @@ E0328: r##"
30913091The Unsize trait should not be implemented directly. All implementations of
30923092Unsize are provided automatically by the compiler.
30933093
3094- Here's an example of this error :
3094+ Erroneous code example:
30953095
30963096```compile_fail,E0328
30973097#![feature(unsize)]
@@ -3108,6 +3108,19 @@ conversion from a sized to an unsized type with the [DST coercion system]
31083108(https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md), use
31093109[`CoerceUnsized`](https://doc.rust-lang.org/std/ops/trait.CoerceUnsized.html)
31103110instead.
3111+
3112+ ```
3113+ #![feature(coerce_unsized)]
3114+
3115+ use std::ops::CoerceUnsized;
3116+
3117+ pub struct MyType<T: ?Sized> {
3118+ field_with_unsized_type: T,
3119+ }
3120+
3121+ impl<T, U> CoerceUnsized<MyType<U>> for MyType<T>
3122+ where T: CoerceUnsized<U> {}
3123+ ```
31113124"## ,
31123125
31133126E0329 : r##"
You can’t perform that action at this time.
0 commit comments