File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use crate::span::Span;
2
2
use core:: {
3
3
future:: Future ,
4
4
marker:: Sized ,
5
- mem:: { self , ManuallyDrop } ,
5
+ mem:: ManuallyDrop ,
6
6
pin:: Pin ,
7
7
task:: { Context , Poll } ,
8
8
} ;
@@ -392,12 +392,11 @@ impl<T> Instrumented<T> {
392
392
///
393
393
/// Note that this drops the span.
394
394
pub fn into_inner ( self ) -> T {
395
- // To manually destructure `Instrumented` without `Drop`, we save
396
- // pointers to the fields and use `mem::forget` to leave those pointers
397
- // valid.
398
- let span: * const Span = & self . span ;
399
- let inner: * const ManuallyDrop < T > = & self . inner ;
400
- mem:: forget ( self ) ;
395
+ // To manually destructure `Instrumented` without `Drop`, we
396
+ // move it into a ManuallyDrop and use pointers to its fields
397
+ let this = ManuallyDrop :: new ( self ) ;
398
+ let span: * const Span = & this. span ;
399
+ let inner: * const ManuallyDrop < T > = & this. inner ;
401
400
// SAFETY: Those pointers are valid for reads, because `Drop` didn't
402
401
// run, and properly aligned, because `Instrumented` isn't
403
402
// `#[repr(packed)]`.
You can’t perform that action at this time.
0 commit comments