]> git.lizzy.rs Git - rust.git/commitdiff
vec: rm inline(never) hack
authorDaniel Micay <danielmicay@gmail.com>
Wed, 10 Jul 2013 19:46:03 +0000 (15:46 -0400)
committerDaniel Micay <danielmicay@gmail.com>
Thu, 11 Jul 2013 06:17:08 +0000 (02:17 -0400)
just avoid giving an inline hint in the first place

src/libstd/vec.rs

index 5576b4ad7043e4d11c2e72ad86612e7c34c07f7f..38212d0f29f11600baf3621d682e36858a1dae81 100644 (file)
@@ -1136,7 +1136,6 @@ fn consume_rev_iter(self) -> VecConsumeRevIterator<T> {
      *
      * * n - The number of elements to reserve space for
      */
-    #[inline]
     #[cfg(stage0)]
     fn reserve(&mut self, n: uint) {
         // Only make the (slow) call into the runtime if we have to
@@ -1170,7 +1169,6 @@ fn reserve(&mut self, n: uint) {
      *
      * * n - The number of elements to reserve space for
      */
-    #[inline]
     #[cfg(not(stage0))]
     fn reserve(&mut self, n: uint) {
         // Only make the (slow) call into the runtime if we have to
@@ -1228,21 +1226,12 @@ fn push(&mut self, t: T) {
             let repr: **raw::VecRepr = transmute(&mut *self);
             let fill = (**repr).unboxed.fill;
             if (**repr).unboxed.alloc <= fill {
-                // need more space
-                reserve_no_inline(self);
+                let new_len = self.len() + 1;
+                self.reserve_at_least(new_len);
             }
 
             self.push_fast(t);
         }
-
-        // this peculiar function is because reserve_at_least is very
-        // large (because of reserve), and will be inlined, which
-        // makes push too large.
-        #[inline(never)]
-        fn reserve_no_inline<T>(v: &mut ~[T]) {
-            let new_len = v.len() + 1;
-            v.reserve_at_least(new_len);
-        }
     }
 
     // This doesn't bother to make sure we have space.