Skip to content

Commit 6fe0886

Browse files
committed
Auto merge of #87736 - the8472:inline-advance-by, r=Mark-Simulacrum
#[inline] slice::Iter::advance_by #87387 (comment) 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.
2 parents 7f3dc04 + e44d39a commit 6fe0886

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/core/src/slice/iter/macros.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,9 @@ macro_rules! iterator {
185185
}
186186
}
187187

188+
#[inline]
188189
fn advance_by(&mut self, n: usize) -> Result<(), usize> {
189-
let advance = cmp::min(n, len!(self));
190+
let advance = cmp::min(len!(self), n);
190191
// SAFETY: By construction, `advance` does not exceed `self.len()`.
191192
unsafe { self.post_inc_start(advance as isize) };
192193
if advance == n { Ok(()) } else { Err(advance) }
@@ -381,7 +382,7 @@ macro_rules! iterator {
381382

382383
#[inline]
383384
fn advance_back_by(&mut self, n: usize) -> Result<(), usize> {
384-
let advance = cmp::min(n, len!(self));
385+
let advance = cmp::min(len!(self), n);
385386
// SAFETY: By construction, `advance` does not exceed `self.len()`.
386387
unsafe { self.pre_dec_end(advance as isize) };
387388
if advance == n { Ok(()) } else { Err(advance) }

0 commit comments

Comments
 (0)