File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3091,7 +3091,7 @@ E0328: r##"
3091
3091
The Unsize trait should not be implemented directly. All implementations of
3092
3092
Unsize are provided automatically by the compiler.
3093
3093
3094
- Here's an example of this error :
3094
+ Erroneous code example:
3095
3095
3096
3096
```compile_fail,E0328
3097
3097
#![feature(unsize)]
@@ -3108,6 +3108,19 @@ conversion from a sized to an unsized type with the [DST coercion system]
3108
3108
(https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md), use
3109
3109
[`CoerceUnsized`](https://doc.rust-lang.org/std/ops/trait.CoerceUnsized.html)
3110
3110
instead.
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
+ ```
3111
3124
"## ,
3112
3125
3113
3126
E0329 : r##"
You can’t perform that action at this time.
0 commit comments