File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,9 @@ pub use intrinsics::transmute;
88
88
/// ptr::copy_nonoverlapping(&*y, x, 1);
89
89
/// ptr::copy_nonoverlapping(&t, y, 1);
90
90
///
91
- /// // y and t now point to the same thing, but we need to completely forget `t`
92
- /// // because it's no longer relevant.
91
+ /// // y and t now point to the same thing, but we need to completely
92
+ /// // forget `t` because we do not want to run the destructor for `T`
93
+ /// // on its value, which is still owned somewhere outside this function.
93
94
/// forget(t);
94
95
/// }
95
96
/// }
@@ -295,8 +296,9 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
295
296
ptr:: copy_nonoverlapping ( & * y, x, 1 ) ;
296
297
ptr:: copy_nonoverlapping ( & t, y, 1 ) ;
297
298
298
- // y and t now point to the same thing, but we need to completely forget `t`
299
- // because it's no longer relevant.
299
+ // y and t now point to the same thing, but we need to completely
300
+ // forget `t` because we do not want to run the destructor for `T`
301
+ // on its value, which is still owned somewhere outside this function.
300
302
forget ( t) ;
301
303
}
302
304
}
You can’t perform that action at this time.
0 commit comments