Skip to content

Commit ab019e2

Browse files
author
Fedor Ryabinin
committed
Another pass with Claude 3.7 as an arbiter
1 parent 1b1cfe6 commit ab019e2

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

library/core/src/iter/traits/iterator.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
use safety::{ensures,requires};
2+
#[cfg(kani)]
3+
use crate::kani;
4+
#[allow(unused_imports)]
5+
use crate::ub_checks::*;
6+
17
use super::super::{
28
ArrayChunks, ByRefSized, Chain, Cloned, Copied, Cycle, Enumerate, Filter, FilterMap, FlatMap,
39
Flatten, Fuse, Inspect, Intersperse, IntersperseWith, Map, MapWhile, MapWindows, Peekable,
@@ -1709,6 +1715,7 @@ pub trait Iterator {
17091715
/// ```
17101716
#[inline]
17111717
#[unstable(feature = "iter_map_windows", reason = "recently added", issue = "87155")]
1718+
#[requires(N > 0)]
17121719
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
17131720
where
17141721
Self: Sized,

library/core/src/range/iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl<A: Step> Iterator for IterRange<A> {
110110
}
111111

112112
#[inline]
113+
#[requires(idx < self.size_hint().0)]
113114
#[cfg_attr(kani, kani::modifies(self))]
114115
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item
115116
where

0 commit comments

Comments
 (0)