@@ -32,16 +32,16 @@ pub unsafe fn DoStuffWithSafePointer_0(safe_ptr: *mut Option<Box<SafePointer>>)
3232 let mut x1: Option < Box < i32 > > = Some ( Box :: new ( 0 ) ) ;
3333 let mut x2: Option < Box < i32 > > = Some ( Box :: new ( 0 ) ) ;
3434 ( * x2. as_deref_mut ( ) . unwrap ( ) ) = 1 ;
35- x1 = x2;
35+ x1 = x2. take ( ) ;
3636 let mut raw_ptr1: * mut i32 = ( & mut ( * x1. as_deref_mut ( ) . unwrap ( ) ) as * mut i32 ) ;
3737 ( * raw_ptr1) . prefix_inc ( ) ;
38- ( * ( * safe_ptr) . as_deref_mut ( ) . unwrap ( ) ) . ptr = x1;
38+ ( * ( * safe_ptr) . as_deref_mut ( ) . unwrap ( ) ) . ptr = x1. take ( ) ;
3939 ( unsafe { SafePointer :: inc ( & mut ( * ( * safe_ptr) . as_deref_mut ( ) . unwrap ( ) ) ) } ) ;
4040 ( unsafe { SafePointer :: inc ( & mut ( * ( * safe_ptr) . as_deref_mut ( ) . unwrap ( ) ) ) } ) ;
4141 let mut x3: Option < Box < i32 > > = Some ( Box :: new ( 10 ) ) ;
4242 let mut x4: Option < Box < i32 > > = Some ( Box :: new ( 20 ) ) ;
4343 ( * x3. as_deref_mut ( ) . unwrap ( ) ) = ( ( * x3. as_deref_mut ( ) . unwrap ( ) ) + ( * x4. as_deref_mut ( ) . unwrap ( ) ) ) ;
44- x4 = x3;
44+ x4 = x3. take ( ) ;
4545 let mut raw_ptr2: * mut i32 = ( & mut ( * x4. as_deref_mut ( ) . unwrap ( ) ) as * mut i32 ) ;
4646 ( * raw_ptr2) += 1 ;
4747 let mut pair: Option < Box < Pair > > = Some ( Box :: new ( Pair {
@@ -60,7 +60,7 @@ pub unsafe fn DoStuffWithSafePointer_0(safe_ptr: *mut Option<Box<SafePointer>>)
6060 + ( ( * pair. as_deref_mut ( ) . unwrap ( ) ) . y ) ) ;
6161}
6262pub unsafe fn Consume_1 ( mut safe_ptr : Option < Box < SafePointer > > ) -> i32 {
63- let mut x: Option < Box < SafePointer > > = safe_ptr;
63+ let mut x: Option < Box < SafePointer > > = safe_ptr. take ( ) ;
6464 let mut p: Option < Box < Pair > > = Some ( Box :: from_raw (
6565 ( Box :: leak ( Box :: new ( <Pair >:: default ( ) ) ) as * mut Pair ) ,
6666 ) ) ;
@@ -149,8 +149,8 @@ pub fn main() {
149149}
150150unsafe fn main_0 ( ) -> i32 {
151151 let mut x: Option < Box < i32 > > = Some ( Box :: new ( 0 ) ) ;
152- let mut safe_ptr: Option < Box < SafePointer > > = Some ( Box :: new ( SafePointer { ptr : x } ) ) ;
152+ let mut safe_ptr: Option < Box < SafePointer > > = Some ( Box :: new ( SafePointer { ptr : x. take ( ) } ) ) ;
153153 ( unsafe { DoStuffWithSafePointer_0 ( & mut safe_ptr as * mut Option < Box < SafePointer > > ) } ) ;
154- assert ! ( ( ( unsafe { Consume_1 ( safe_ptr, ) } ) == ( 60 ) ) ) ;
154+ assert ! ( ( ( unsafe { Consume_1 ( safe_ptr. take ( ) , ) } ) == ( 60 ) ) ) ;
155155 return 0 ;
156156}
0 commit comments