about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-08-04 15:39:20 +0000
committerbors <bors@rust-lang.org>2021-08-04 15:39:20 +0000
commit6fe0886723c9e08b800c9951f1c6f6a57b2bf22c (patch)
treeebc889bb654271d838892f67de0d223adaeb53c0 /library
parent7f3dc0464422ebadf3b8647f591bcf6e3107e805 (diff)
parente44d39a5b78376cb0d55c440e3bf0d08b492c61c (diff)
downloadrust-6fe0886723c9e08b800c9951f1c6f6a57b2bf22c.tar.gz
rust-6fe0886723c9e08b800c9951f1c6f6a57b2bf22c.zip
Auto merge of #87736 - the8472:inline-advance-by, r=Mark-Simulacrum
#[inline] slice::Iter::advance_by

https://github.com/rust-lang/rust/pull/87387#issuecomment-891942661 was marked as a regression. One of the methods in the PR was missing an inline annotation unlike all the other methods on slice iterators.

Let's see if that makes a difference.
Diffstat (limited to 'library')
-rw-r--r--library/core/src/slice/iter/macros.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/library/core/src/slice/iter/macros.rs b/library/core/src/slice/iter/macros.rs
index 791a88dd97f..cf15756868e 100644
--- a/library/core/src/slice/iter/macros.rs
+++ b/library/core/src/slice/iter/macros.rs
@@ -185,8 +185,9 @@ macro_rules! iterator {
                 }
             }
 
+            #[inline]
             fn advance_by(&mut self, n: usize) -> Result<(), usize> {
-                let advance = cmp::min(n, len!(self));
+                let advance = cmp::min(len!(self), n);
                 // SAFETY: By construction, `advance` does not exceed `self.len()`.
                 unsafe { self.post_inc_start(advance as isize) };
                 if advance == n { Ok(()) } else { Err(advance) }
@@ -381,7 +382,7 @@ macro_rules! iterator {
 
             #[inline]
             fn advance_back_by(&mut self, n: usize) -> Result<(), usize> {
-                let advance = cmp::min(n, len!(self));
+                let advance = cmp::min(len!(self), n);
                 // SAFETY: By construction, `advance` does not exceed `self.len()`.
                 unsafe { self.pre_dec_end(advance as isize) };
                 if advance == n { Ok(()) } else { Err(advance) }