File tree 1 file changed +2
-6
lines changed
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
When an [ initialized]   ; [ variable] in Rust goes out of scope or a [ temporary]
4
4
is no longer needed its _ destructor_ is run. [ Assignment] also runs the
5
- destructor of its left-hand operand, unless it's an uninitialized variable. If a
6
- [ struct] variable has been partially initialized, only its initialized fields
7
- are dropped.
5
+ destructor of its left-hand operand, unless it's an uninitialized variable.
8
6
9
7
The destructor of a type consists of
10
8
@@ -63,10 +61,8 @@ loop {
63
61
moved = ShowOnDrop (" Drops when moved" );
64
62
// drops now, but is then uninitialized
65
63
moved ;
64
+ // Uninitialized does not drop.
66
65
let uninitialized : ShowOnDrop ;
67
- // Only first element drops
68
- let mut partially_initialized : (ShowOnDrop , ShowOnDrop );
69
- partially_initialized . 0 = ShowOnDrop (" Partial tuple first" );
70
66
}
71
67
```
72
68
You can’t perform that action at this time.
0 commit comments