diff options
| author | bors <bors@rust-lang.org> | 2021-08-04 15:39:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-04 15:39:20 +0000 |
| commit | 6fe0886723c9e08b800c9951f1c6f6a57b2bf22c (patch) | |
| tree | ebc889bb654271d838892f67de0d223adaeb53c0 /library | |
| parent | 7f3dc0464422ebadf3b8647f591bcf6e3107e805 (diff) | |
| parent | e44d39a5b78376cb0d55c440e3bf0d08b492c61c (diff) | |
| download | rust-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.rs | 5 |
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) } |
