You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
some SmallVec methods use assertions that rely on a helper function marked as #[cold] and never inlined. this is to improve cache locality
take all the helper functions like that, rename them, and put it in an assertions.rs module
example in SmallVec::remove:
#[inline]pubfnremove(&mutself,index:usize) -> T{#[cold]#[inline(never)]#[track_caller]fnassert_failed(index:usize,len:usize) -> ! {panic!("removal index (is {index}) should be < len (is {len})");}let len = self.len();if index >= len {assert_failed(index, len);}let new_len = len - 1;unsafe{// SAFETY: new_len < lenself.set_len(new_len);let ptr = self.as_mut_ptr();let ith = ptr.add(index);// This item is initialized since index < lenlet ith_item = ith.read();copy(ith.add(1), ith, new_len - index);
ith_item
}}
Activity
lib.rsinto modules #427