From 1bc095cd80124d71425bceb6542685f8d95afc1e Mon Sep 17 00:00:00 2001 From: The 8472 Date: Thu, 22 Jun 2023 22:57:46 +0200 Subject: [PATCH] add inline annotation to concrete impls otherwise they wouldn't be eligible for cross-crate inlining --- library/core/src/iter/adapters/step_by.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/core/src/iter/adapters/step_by.rs b/library/core/src/iter/adapters/step_by.rs index 2f7e66e8c60..ce7bd3b5cb1 100644 --- a/library/core/src/iter/adapters/step_by.rs +++ b/library/core/src/iter/adapters/step_by.rs @@ -395,6 +395,7 @@ macro_rules! spec_int_ranges { } } + #[inline] fn spec_size_hint(&self) -> (usize, Option) { let remaining = self.iter.end as usize; (remaining, Some(remaining)) @@ -403,11 +404,13 @@ macro_rules! spec_int_ranges { // The methods below are all copied from the Iterator trait default impls. // We have to repeat them here so that the specialization overrides the StepByImpl defaults + #[inline] fn spec_nth(&mut self, n: usize) -> Option { self.advance_by(n).ok()?; self.next() } + #[inline] fn spec_try_fold(&mut self, init: Acc, mut f: F) -> R where F: FnMut(Acc, Self::Item) -> R, @@ -449,6 +452,7 @@ macro_rules! spec_int_ranges_r { impl StepByBackImpl> for StepBy> { + #[inline] fn spec_next_back(&mut self) -> Option where Range<$t>: DoubleEndedIterator + ExactSizeIterator, { @@ -466,6 +470,7 @@ macro_rules! spec_int_ranges_r { // The methods below are all copied from the Iterator trait default impls. // We have to repeat them here so that the specialization overrides the StepByImplBack defaults + #[inline] fn spec_nth_back(&mut self, n: usize) -> Option where Self: DoubleEndedIterator, { @@ -475,6 +480,7 @@ macro_rules! spec_int_ranges_r { self.next_back() } + #[inline] fn spec_try_rfold(&mut self, init: Acc, mut f: F) -> R where Self: DoubleEndedIterator, @@ -488,6 +494,7 @@ macro_rules! spec_int_ranges_r { try { accum } } + #[inline] fn spec_rfold(mut self, init: Acc, mut f: F) -> Acc where Self: DoubleEndedIterator,