File tree 1 file changed +11
-9
lines changed
1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -215,14 +215,16 @@ unsafe impl AllocRef for Global {
215
215
}
216
216
ReallocPlacement :: MayMove => {
217
217
// `realloc` probably checks for `new_size > size` or something similar.
218
- unsafe {
218
+ let ptr = unsafe {
219
219
intrinsics:: assume ( new_size > size) ;
220
- let ptr = realloc ( ptr. as_ptr ( ) , layout, new_size) ;
221
- let memory =
222
- MemoryBlock { ptr : NonNull :: new ( ptr) . ok_or ( AllocErr ) ?, size : new_size } ;
220
+ realloc ( ptr. as_ptr ( ) , layout, new_size)
221
+ } ;
222
+ let memory =
223
+ MemoryBlock { ptr : NonNull :: new ( ptr) . ok_or ( AllocErr ) ?, size : new_size } ;
224
+ unsafe {
223
225
init. init_offset ( memory, size) ;
224
- Ok ( memory)
225
226
}
227
+ Ok ( memory)
226
228
}
227
229
}
228
230
}
@@ -255,11 +257,11 @@ unsafe impl AllocRef for Global {
255
257
}
256
258
ReallocPlacement :: MayMove => {
257
259
// `realloc` probably checks for `new_size < size` or something similar.
258
- unsafe {
260
+ let ptr = unsafe {
259
261
intrinsics:: assume ( new_size < size) ;
260
- let ptr = realloc ( ptr. as_ptr ( ) , layout, new_size) ;
261
- Ok ( MemoryBlock { ptr : NonNull :: new ( ptr ) . ok_or ( AllocErr ) ? , size : new_size } )
262
- }
262
+ realloc ( ptr. as_ptr ( ) , layout, new_size)
263
+ } ;
264
+ Ok ( MemoryBlock { ptr : NonNull :: new ( ptr ) . ok_or ( AllocErr ) ? , size : new_size } )
263
265
}
264
266
}
265
267
}
You can’t perform that action at this time.
0 commit comments