Skip to content

Commit 1bc095c

Browse files
committed
add inline annotation to concrete impls
otherwise they wouldn't be eligible for cross-crate inlining
1 parent 070ce23 commit 1bc095c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/core/src/iter/adapters/step_by.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ macro_rules! spec_int_ranges {
395395
}
396396
}
397397

398+
#[inline]
398399
fn spec_size_hint(&self) -> (usize, Option<usize>) {
399400
let remaining = self.iter.end as usize;
400401
(remaining, Some(remaining))
@@ -403,11 +404,13 @@ macro_rules! spec_int_ranges {
403404
// The methods below are all copied from the Iterator trait default impls.
404405
// We have to repeat them here so that the specialization overrides the StepByImpl defaults
405406

407+
#[inline]
406408
fn spec_nth(&mut self, n: usize) -> Option<Self::Item> {
407409
self.advance_by(n).ok()?;
408410
self.next()
409411
}
410412

413+
#[inline]
411414
fn spec_try_fold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
412415
where
413416
F: FnMut(Acc, Self::Item) -> R,
@@ -449,6 +452,7 @@ macro_rules! spec_int_ranges_r {
449452

450453
impl StepByBackImpl<Range<$t>> for StepBy<Range<$t>> {
451454

455+
#[inline]
452456
fn spec_next_back(&mut self) -> Option<Self::Item>
453457
where Range<$t>: DoubleEndedIterator + ExactSizeIterator,
454458
{
@@ -466,6 +470,7 @@ macro_rules! spec_int_ranges_r {
466470
// The methods below are all copied from the Iterator trait default impls.
467471
// We have to repeat them here so that the specialization overrides the StepByImplBack defaults
468472

473+
#[inline]
469474
fn spec_nth_back(&mut self, n: usize) -> Option<Self::Item>
470475
where Self: DoubleEndedIterator,
471476
{
@@ -475,6 +480,7 @@ macro_rules! spec_int_ranges_r {
475480
self.next_back()
476481
}
477482

483+
#[inline]
478484
fn spec_try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
479485
where
480486
Self: DoubleEndedIterator,
@@ -488,6 +494,7 @@ macro_rules! spec_int_ranges_r {
488494
try { accum }
489495
}
490496

497+
#[inline]
491498
fn spec_rfold<Acc, F>(mut self, init: Acc, mut f: F) -> Acc
492499
where
493500
Self: DoubleEndedIterator,

0 commit comments

Comments
 (0)