File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -74,15 +74,15 @@ fn vec_reallocate() -> Vec<u8> {
74
74
fn vec_push_ptr_stable ( ) {
75
75
let mut v = Vec :: with_capacity ( 10 ) ;
76
76
v. push ( 0 ) ;
77
- let v0 = unsafe { & * ( & v[ 0 ] as * const _ ) } ; // laundering the lifetime -- we take care that `v` does not reallocate, so that's okay.
77
+ let v0 = unsafe { & mut * ( & mut v[ 0 ] as * mut _ ) } ; // laundering the lifetime -- we take care that `v` does not reallocate, so that's okay.
78
78
v. push ( 1 ) ;
79
79
let _val = * v0;
80
80
}
81
81
82
82
fn vec_extend_ptr_stable ( ) {
83
83
let mut v = Vec :: with_capacity ( 10 ) ;
84
84
v. push ( 0 ) ;
85
- let v0 = unsafe { & * ( & v[ 0 ] as * const _ ) } ; // laundering the lifetime -- we take care that `v` does not reallocate, so that's okay.
85
+ let v0 = unsafe { & mut * ( & mut v[ 0 ] as * mut _ ) } ; // laundering the lifetime -- we take care that `v` does not reallocate, so that's okay.
86
86
// `slice::Iter` (with `T: Copy`) specialization
87
87
v. extend ( & [ 1 ] ) ;
88
88
let _val = * v0;
@@ -99,7 +99,7 @@ fn vec_extend_ptr_stable() {
99
99
100
100
fn vec_truncate_ptr_stable ( ) {
101
101
let mut v = vec ! [ 0 ; 10 ] ;
102
- let v0 = unsafe { & * ( & v[ 0 ] as * const _ ) } ; // laundering the lifetime -- we take care that `v` does not reallocate, so that's okay.
102
+ let v0 = unsafe { & mut * ( & mut v[ 0 ] as * mut _ ) } ; // laundering the lifetime -- we take care that `v` does not reallocate, so that's okay.
103
103
v. truncate ( 5 ) ;
104
104
let _val = * v0;
105
105
}
You can’t perform that action at this time.
0 commit comments