File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 33When an [ initialized]   ; [ variable] in Rust goes out of scope or a [ temporary]
44is no longer needed its _ destructor_ is run. [ Assignment] also runs the
55destructor 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.
6+ variable has been partially initialized, only its initialized fields are
7+ dropped.
88
99The destructor of a type consists of
1010
@@ -63,10 +63,11 @@ loop {
6363 moved = ShowOnDrop (" Drops when moved" );
6464 // drops now, but is then uninitialized
6565 moved ;
66+ // Uninitialized does not drop.
6667 let uninitialized : ShowOnDrop ;
6768 // Only first element drops
6869 let mut partially_initialized : (ShowOnDrop , ShowOnDrop );
69- partially_initialized . 0 = ShowOnDrop ( " Partial tuple first " );
70+ core :: mem :: forget ( partially_initialized . 1 );
7071}
7172```
7273
You can’t perform that action at this time.
0 commit comments