File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -175,8 +175,9 @@ impl Global {
175175 }
176176 }
177177
178+ // Safety: Same as `AllocRef::grow`
178179 #[ inline]
179- fn grow_impl (
180+ unsafe fn grow_impl (
180181 & mut self ,
181182 ptr : NonNull < u8 > ,
182183 layout : Layout ,
@@ -241,7 +242,8 @@ unsafe impl AllocRef for Global {
241242 layout : Layout ,
242243 new_size : usize ,
243244 ) -> 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 ) }
245247 }
246248
247249 #[ inline]
@@ -251,7 +253,8 @@ unsafe impl AllocRef for Global {
251253 layout : Layout ,
252254 new_size : usize ,
253255 ) -> 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 ) }
255258 }
256259
257260 #[ inline]
Original file line number Diff line number Diff line change @@ -149,8 +149,9 @@ impl System {
149149 }
150150 }
151151
152+ // Safety: Same as `AllocRef::grow`
152153 #[ inline]
153- fn grow_impl (
154+ unsafe fn grow_impl (
154155 & mut self ,
155156 ptr : NonNull < u8 > ,
156157 layout : Layout ,
@@ -217,7 +218,8 @@ unsafe impl AllocRef for System {
217218 layout : Layout ,
218219 new_size : usize ,
219220 ) -> 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 ) }
221223 }
222224
223225 #[ inline]
@@ -227,7 +229,8 @@ unsafe impl AllocRef for System {
227229 layout : Layout ,
228230 new_size : usize ,
229231 ) -> 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 ) }
231234 }
232235
233236 #[ inline]
You can’t perform that action at this time.
0 commit comments