Skip to content

Commit 33735c2

Browse files
committed
[PERF ONLY] Spam it all over and see how things differ
1 parent 096c41f commit 33735c2

39 files changed

+305
-305
lines changed

library/alloc/src/boxed.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl<T> Box<T> {
252252
/// let five = Box::new(5);
253253
/// ```
254254
#[cfg(not(no_global_oom_handling))]
255-
#[inline(always)]
255+
#[rustc_early_inline]
256256
#[stable(feature = "rust1", since = "1.0.0")]
257257
#[must_use]
258258
#[rustc_diagnostic_item = "box_new"]
@@ -317,7 +317,7 @@ impl<T> Box<T> {
317317
#[cfg(not(no_global_oom_handling))]
318318
#[stable(feature = "pin", since = "1.33.0")]
319319
#[must_use]
320-
#[inline(always)]
320+
#[rustc_early_inline]
321321
pub fn pin(x: T) -> Pin<Box<T>> {
322322
Box::new(x).into()
323323
}
@@ -594,7 +594,7 @@ impl<T, A: Allocator> Box<T, A> {
594594
#[cfg(not(no_global_oom_handling))]
595595
#[unstable(feature = "allocator_api", issue = "32838")]
596596
#[must_use]
597-
#[inline(always)]
597+
#[rustc_early_inline]
598598
pub fn pin_in(x: T, alloc: A) -> Pin<Self>
599599
where
600600
A: 'static + Allocator,

library/alloc/src/collections/binary_heap/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ impl<T: Ord, A: Allocator> BinaryHeap<T, A> {
875875

876876
let tail_len = self.len() - start;
877877

878-
#[inline(always)]
878+
#[rustc_early_inline]
879879
fn log2_fast(x: usize) -> usize {
880880
(usize::BITS - x.leading_zeros() - 1) as usize
881881
}

library/alloc/src/collections/linked_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ impl<'a, T, A: Allocator> Cursor<'a, T, A> {
15071507

15081508
/// Provides a reference to the cursor's parent list.
15091509
#[must_use]
1510-
#[inline(always)]
1510+
#[rustc_early_inline]
15111511
#[unstable(feature = "linked_list_cursors", issue = "58533")]
15121512
pub fn as_list(&self) -> &'a LinkedList<T, A> {
15131513
self.list
@@ -1629,7 +1629,7 @@ impl<'a, T, A: Allocator> CursorMut<'a, T, A> {
16291629
/// `CursorMut`, which means it cannot outlive the `CursorMut` and that the
16301630
/// `CursorMut` is frozen for the lifetime of the reference.
16311631
#[must_use]
1632-
#[inline(always)]
1632+
#[rustc_early_inline]
16331633
#[unstable(feature = "linked_list_cursors", issue = "58533")]
16341634
pub fn as_list(&self) -> &LinkedList<T, A> {
16351635
self.list

library/alloc/src/ffi/c_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl CString {
269269
}
270270

271271
// Specialization for avoiding reallocation
272-
#[inline(always)] // Without that it is not inlined into specializations
272+
#[rustc_early_inline] // Without that it is not inlined into specializations
273273
fn spec_new_impl_bytes(bytes: &[u8]) -> Result<CString, NulError> {
274274
// We cannot have such large slice that we would overflow here
275275
// but using `checked_add` allows LLVM to assume that capacity never overflows

library/alloc/src/rc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ impl<T: ?Sized> Rc<T> {
351351
}
352352

353353
impl<T: ?Sized, A: Allocator> Rc<T, A> {
354-
#[inline(always)]
354+
#[rustc_early_inline]
355355
fn inner(&self) -> &RcInner<T> {
356356
// This unsafety is ok because while this Rc is alive we're guaranteed
357357
// that the inner pointer is valid.
@@ -2251,7 +2251,7 @@ impl<T: Copy> RcFromSlice<T> for Rc<[T]> {
22512251
impl<T: ?Sized, A: Allocator> Deref for Rc<T, A> {
22522252
type Target = T;
22532253

2254-
#[inline(always)]
2254+
#[rustc_early_inline]
22552255
fn deref(&self) -> &T {
22562256
&self.inner().value
22572257
}

library/alloc/src/task.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,18 @@ impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for RawWaker {
133133
// trait dispatch - instead both impls call this function directly and
134134
// explicitly.
135135
#[cfg(target_has_atomic = "ptr")]
136-
#[inline(always)]
136+
#[rustc_early_inline]
137137
fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
138138
// Increment the reference count of the arc to clone it.
139139
//
140-
// The #[inline(always)] is to ensure that raw_waker and clone_waker are
140+
// The #[rustc_early_inline] is to ensure that raw_waker and clone_waker are
141141
// always generated in the same code generation unit as one another, and
142142
// therefore that the structurally identical const-promoted RawWakerVTable
143143
// within both functions is deduplicated at LLVM IR code generation time.
144144
// This allows optimizing Waker::will_wake to a single pointer comparison of
145145
// the vtable pointers, rather than comparing all four function pointers
146146
// within the vtables.
147-
#[inline(always)]
147+
#[rustc_early_inline]
148148
unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawWaker {
149149
unsafe { Arc::increment_strong_count(waker as *const W) };
150150
RawWaker::new(
@@ -311,13 +311,13 @@ impl<W: LocalWake + 'static> From<Rc<W>> for RawWaker {
311311
// the safety of `From<Rc<W>> for Waker` does not depend on the correct
312312
// trait dispatch - instead both impls call this function directly and
313313
// explicitly.
314-
#[inline(always)]
314+
#[rustc_early_inline]
315315
fn local_raw_waker<W: LocalWake + 'static>(waker: Rc<W>) -> RawWaker {
316316
// Increment the reference count of the Rc to clone it.
317317
//
318318
// Refer to the comment on raw_waker's clone_waker regarding why this is
319319
// always inline.
320-
#[inline(always)]
320+
#[rustc_early_inline]
321321
unsafe fn clone_waker<W: LocalWake + 'static>(waker: *const ()) -> RawWaker {
322322
unsafe { Rc::increment_strong_count(waker as *const W) };
323323
RawWaker::new(

library/alloctests/tests/sort/known_good_stable_sort.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ use std::ptr;
1919
/// interior mutability will be observable. Same is true if `T: Ord` panics.
2020
///
2121
/// Panics if allocating the auxiliary memory fails.
22-
#[inline(always)]
22+
#[rustc_early_inline]
2323
pub fn sort<T: Ord>(v: &mut [T]) {
2424
stable_sort(v, |a, b| a.lt(b))
2525
}
2626

27-
#[inline(always)]
27+
#[rustc_early_inline]
2828
fn stable_sort<T, F: FnMut(&T, &T) -> bool>(v: &mut [T], mut is_less: F) {
2929
if size_of::<T>() == 0 {
3030
return;
@@ -65,7 +65,7 @@ unsafe fn mergesort_main<T, F: FnMut(&T, &T) -> bool>(v: &mut [T], is_less: &mut
6565
/// no run detection, etc.
6666
///
6767
/// Buffer as pointed to by `scratch` must have space for `v.len()` writes. And must not alias `v`.
68-
#[inline(always)]
68+
#[rustc_early_inline]
6969
unsafe fn mergesort_core<T, F: FnMut(&T, &T) -> bool>(
7070
v: &mut [T],
7171
scratch_ptr: *mut T,
@@ -96,7 +96,7 @@ unsafe fn mergesort_core<T, F: FnMut(&T, &T) -> bool>(
9696
///
9797
/// SAFETY: The caller must ensure that `scratch_ptr` is valid for `v.len()` writes. And that mid is
9898
/// in-bounds.
99-
#[inline(always)]
99+
#[rustc_early_inline]
100100
unsafe fn merge<T, F>(v: &mut [T], scratch_ptr: *mut T, is_less: &mut F, mid: usize)
101101
where
102102
F: FnMut(&T, &T) -> bool,

library/core/src/alloc/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Layout {
8383
true
8484
}
8585

86-
#[inline(always)]
86+
#[rustc_early_inline]
8787
const fn max_size_for_align(align: Alignment) -> usize {
8888
// (power-of-two implies align != 0.)
8989

library/core/src/cell.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,12 @@ const fn panic_already_mutably_borrowed(err: BorrowError) -> ! {
816816
type BorrowCounter = isize;
817817
const UNUSED: BorrowCounter = 0;
818818

819-
#[inline(always)]
819+
#[rustc_early_inline]
820820
const fn is_writing(x: BorrowCounter) -> bool {
821821
x < UNUSED
822822
}
823823

824-
#[inline(always)]
824+
#[rustc_early_inline]
825825
const fn is_reading(x: BorrowCounter) -> bool {
826826
x > UNUSED
827827
}
@@ -2112,7 +2112,7 @@ impl<T> UnsafeCell<T> {
21122112
/// ```
21132113
#[stable(feature = "rust1", since = "1.0.0")]
21142114
#[rustc_const_stable(feature = "const_unsafe_cell_new", since = "1.32.0")]
2115-
#[inline(always)]
2115+
#[rustc_early_inline]
21162116
pub const fn new(value: T) -> UnsafeCell<T> {
21172117
UnsafeCell { value }
21182118
}
@@ -2128,7 +2128,7 @@ impl<T> UnsafeCell<T> {
21282128
///
21292129
/// let five = uc.into_inner();
21302130
/// ```
2131-
#[inline(always)]
2131+
#[rustc_early_inline]
21322132
#[stable(feature = "rust1", since = "1.0.0")]
21332133
#[rustc_const_stable(feature = "const_cell_into_inner", since = "1.83.0")]
21342134
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
@@ -2180,7 +2180,7 @@ impl<T: ?Sized> UnsafeCell<T> {
21802180
/// *uc.get_mut() -= 1;
21812181
/// assert_eq!(*uc.get_mut(), 41);
21822182
/// ```
2183-
#[inline(always)]
2183+
#[rustc_early_inline]
21842184
#[stable(feature = "unsafe_cell_from_mut", since = "1.84.0")]
21852185
#[rustc_const_stable(feature = "unsafe_cell_from_mut", since = "1.84.0")]
21862186
pub const fn from_mut(value: &mut T) -> &mut UnsafeCell<T> {
@@ -2203,7 +2203,7 @@ impl<T: ?Sized> UnsafeCell<T> {
22032203
///
22042204
/// let five = uc.get();
22052205
/// ```
2206-
#[inline(always)]
2206+
#[rustc_early_inline]
22072207
#[stable(feature = "rust1", since = "1.0.0")]
22082208
#[rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0")]
22092209
#[rustc_as_ptr]
@@ -2230,7 +2230,7 @@ impl<T: ?Sized> UnsafeCell<T> {
22302230
///
22312231
/// assert_eq!(*c.get_mut(), 6);
22322232
/// ```
2233-
#[inline(always)]
2233+
#[rustc_early_inline]
22342234
#[stable(feature = "unsafe_cell_get_mut", since = "1.50.0")]
22352235
#[rustc_const_stable(feature = "const_unsafecell_get_mut", since = "1.83.0")]
22362236
pub const fn get_mut(&mut self) -> &mut T {
@@ -2264,7 +2264,7 @@ impl<T: ?Sized> UnsafeCell<T> {
22642264
///
22652265
/// assert_eq!(uc.into_inner(), 5);
22662266
/// ```
2267-
#[inline(always)]
2267+
#[rustc_early_inline]
22682268
#[stable(feature = "unsafe_cell_raw_get", since = "1.56.0")]
22692269
#[rustc_const_stable(feature = "unsafe_cell_raw_get", since = "1.56.0")]
22702270
#[rustc_diagnostic_item = "unsafe_cell_raw_get"]

library/core/src/convert/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub use num::FloatToInt;
100100
/// ```
101101
#[stable(feature = "convert_id", since = "1.33.0")]
102102
#[rustc_const_stable(feature = "const_identity", since = "1.33.0")]
103-
#[inline(always)]
103+
#[rustc_early_inline]
104104
#[rustc_diagnostic_item = "convert_identity"]
105105
pub const fn identity<T>(x: T) -> T {
106106
x

0 commit comments

Comments
 (0)