Skip to content

Commit ff54fce

Browse files
committed
Mark finish_grow as unsafe as well
1 parent 8fa3ed3 commit ff54fce

File tree

1 file changed

+3
-3
lines changed
  • library/alloc/src/raw_vec

1 file changed

+3
-3
lines changed

library/alloc/src/raw_vec/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ impl<A: Allocator> RawVecInner<A> {
680680

681681
// SAFETY: Precondition passed to caller
682682
let ptr =
683-
finish_grow(new_layout, unsafe { self.current_memory(elem_layout) }, &mut self.alloc)?;
683+
unsafe { finish_grow(new_layout, self.current_memory(elem_layout), &mut self.alloc)? };
684684
// SAFETY: finish_grow would have resulted in a capacity overflow if we tried to allocate more than `isize::MAX` items
685685

686686
unsafe { self.set_ptr_and_cap(ptr, cap) };
@@ -704,7 +704,7 @@ impl<A: Allocator> RawVecInner<A> {
704704

705705
// SAFETY: Precondition passed to caller
706706
let ptr =
707-
finish_grow(new_layout, unsafe { self.current_memory(elem_layout) }, &mut self.alloc)?;
707+
unsafe { finish_grow(new_layout, self.current_memory(elem_layout), &mut self.alloc)? };
708708
// SAFETY: finish_grow would have resulted in a capacity overflow if we tried to allocate more than `isize::MAX` items
709709
unsafe {
710710
self.set_ptr_and_cap(ptr, cap);
@@ -789,7 +789,7 @@ impl<A: Allocator> RawVecInner<A> {
789789
// not marked inline(never) since we want optimizers to be able to observe the specifics of this
790790
// function, see tests/codegen-llvm/vec-reserve-extend.rs.
791791
#[cold]
792-
fn finish_grow<A>(
792+
unsafe fn finish_grow<A>(
793793
new_layout: Layout,
794794
current_memory: Option<(NonNull<u8>, Layout)>,
795795
alloc: &mut A,

0 commit comments

Comments
 (0)