diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 4f2686abf4515..8d3be70bac2a3 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -204,6 +204,7 @@ impl RawVec { /// Gets a raw pointer to the start of the allocation. Note that this is /// Unique::empty() if `cap = 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() } diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 5efe1e23309a7..a4e2fd4455c8c 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1734,6 +1734,7 @@ where impl ops::Deref for Vec { type Target = [T]; + #[inline] fn deref(&self) -> &[T] { unsafe { let p = self.buf.ptr(); @@ -1745,6 +1746,7 @@ impl ops::Deref for Vec { #[stable(feature = "rust1", since = "1.0.0")] impl ops::DerefMut for Vec { + #[inline] fn deref_mut(&mut self) -> &mut [T] { unsafe { let ptr = self.buf.ptr(); diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index be82ab44cd1fc..b6c7465c9b4a1 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2762,6 +2762,7 @@ impl Unique { } /// Acquires the underlying `*mut` pointer. + #[inline] pub fn as_ptr(self) -> *mut T { self.pointer.0 as *mut T }