File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -142,23 +142,20 @@ E0383: r##"
142
142
This error occurs when an attempt is made to partially reinitialize a
143
143
structure that is currently uninitialized.
144
144
145
- For example, this can happen when a transfer of ownership has taken place:
145
+ For example, this can happen when a drop has taken place:
146
146
147
147
```
148
- let mut t = Test { a: 1, b: None};
149
- let mut u = Test { a: 2, b: Some(Box::new(t))}; // `t` is now uninitialized
150
- // because ownership has been
151
- // transferred
152
- t.b = Some(Box::new(u)); // error, partial reinitialization of uninitialized
153
- // structure `t`
148
+ let mut x = Foo { a: 1 };
149
+ drop(x); // `x` is now uninitialized
150
+ x.a = 2; // error, partial reinitialization of uninitialized structure `t`
154
151
```
155
152
156
153
This error can be fixed by fully reinitializing the structure in question:
157
154
158
155
```
159
- let mut t = Test { a: 1, b: None };
160
- let mut u = Test { a: 2, b: Some(Box::new(t))} ;
161
- t = Test { a: 1, b: Some(Box::new(u)) };
156
+ let mut x = Foo { a: 1 };
157
+ drop(x) ;
158
+ x = Foo { a: 2 };
162
159
```
163
160
"## ,
164
161
You can’t perform that action at this time.
0 commit comments