We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0927a7 commit d41de3fCopy full SHA for d41de3f
library/core/src/iter/adapters/step_by.rs
@@ -1,11 +1,10 @@
1
-use safety::requires;
2
-
3
use crate::intrinsics;
4
use crate::iter::{TrustedLen, TrustedRandomAccess, from_fn};
5
#[cfg(kani)]
6
use crate::kani;
7
use crate::num::NonZero;
8
use crate::ops::{Range, Try};
+use crate::ub_checks::Invariant;
9
10
/// An iterator for stepping iterators by a custom amount.
11
///
@@ -33,6 +32,12 @@ pub struct StepBy<I> {
33
32
first_take: bool,
34
}
35
+impl<I> Invariant for StepBy<I> {
36
+ fn is_safe(&self) -> bool {
37
+ step_minus_one < usize::MAX
38
+ }
39
+}
40
+
41
impl<I> StepBy<I> {
42
#[inline]
43
pub(in crate::iter) fn new(iter: I, step: usize) -> StepBy<I> {
0 commit comments