Skip to content

Commit

Permalink
Auto merge of #79113 - andjo403:raw_vec_ptr, r=m-ou-se
Browse files Browse the repository at this point in the history
mark raw_vec::ptr with inline

when a lot of vectors is used in a enum as in the example in #66617 if this function is not inlined and multiple cgus is used this results in huge compile times. with this fix the compile time is 6s from minutes for the example in #66617. I did not have the patience to wait for it to compile for more then 3 min.
  • Loading branch information
bors committed Jan 26, 2021
2 parents f4eb5d9 + 88d1f31 commit ff6ee2a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/alloc/src/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ impl<T, A: Allocator> RawVec<T, A> {
/// Gets a raw pointer to the start of the allocation. Note that this is
/// `Unique::dangling()` if `capacity == 0` or `T` is zero-sized. In the former case, you must
/// be careful.
#[inline]
pub fn ptr(&self) -> *mut T {
self.ptr.as_ptr()
}
Expand Down

0 comments on commit ff6ee2a

Please sign in to comment.