File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -175,8 +175,9 @@ impl Global {
175
175
}
176
176
}
177
177
178
+ // Safety: Same as `AllocRef::grow`
178
179
#[ inline]
179
- fn grow_impl (
180
+ unsafe fn grow_impl (
180
181
& mut self ,
181
182
ptr : NonNull < u8 > ,
182
183
layout : Layout ,
@@ -241,7 +242,8 @@ unsafe impl AllocRef for Global {
241
242
layout : Layout ,
242
243
new_size : usize ,
243
244
) -> Result < NonNull < [ u8 ] > , AllocErr > {
244
- self . grow_impl ( ptr, layout, new_size, false )
245
+ // SAFETY: all conditions must be upheld by the caller
246
+ unsafe { self . grow_impl ( ptr, layout, new_size, false ) }
245
247
}
246
248
247
249
#[ inline]
@@ -251,7 +253,8 @@ unsafe impl AllocRef for Global {
251
253
layout : Layout ,
252
254
new_size : usize ,
253
255
) -> Result < NonNull < [ u8 ] > , AllocErr > {
254
- self . grow_impl ( ptr, layout, new_size, true )
256
+ // SAFETY: all conditions must be upheld by the caller
257
+ unsafe { self . grow_impl ( ptr, layout, new_size, true ) }
255
258
}
256
259
257
260
#[ inline]
Original file line number Diff line number Diff line change @@ -149,8 +149,9 @@ impl System {
149
149
}
150
150
}
151
151
152
+ // Safety: Same as `AllocRef::grow`
152
153
#[ inline]
153
- fn grow_impl (
154
+ unsafe fn grow_impl (
154
155
& mut self ,
155
156
ptr : NonNull < u8 > ,
156
157
layout : Layout ,
@@ -217,7 +218,8 @@ unsafe impl AllocRef for System {
217
218
layout : Layout ,
218
219
new_size : usize ,
219
220
) -> Result < NonNull < [ u8 ] > , AllocErr > {
220
- self . grow_impl ( ptr, layout, new_size, false )
221
+ // SAFETY: all conditions must be upheld by the caller
222
+ unsafe { self . grow_impl ( ptr, layout, new_size, false ) }
221
223
}
222
224
223
225
#[ inline]
@@ -227,7 +229,8 @@ unsafe impl AllocRef for System {
227
229
layout : Layout ,
228
230
new_size : usize ,
229
231
) -> Result < NonNull < [ u8 ] > , AllocErr > {
230
- self . grow_impl ( ptr, layout, new_size, true )
232
+ // SAFETY: all conditions must be upheld by the caller
233
+ unsafe { self . grow_impl ( ptr, layout, new_size, true ) }
231
234
}
232
235
233
236
#[ inline]
You can’t perform that action at this time.
0 commit comments