Skip to content

Commit 3b3e4f6

Browse files
committed
Fix contracts
1 parent a8e23b3 commit 3b3e4f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/core/src/iter/range.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ macro_rules! step_unsigned_methods {
212212
unsafe { start.unchecked_add(n as Self) }
213213
}
214214

215-
#[requires(start >= n)]
215+
#[requires(start >= (n as Self))]
216216
#[inline]
217217
unsafe fn backward_unchecked(start: Self, n: usize) -> Self {
218218
// SAFETY: the caller has to guarantee that `start - n` doesn't overflow.
@@ -506,7 +506,7 @@ impl Step for char {
506506
#[requires({
507507
let dist = (start as u32).checked_add(count as u32);
508508
dist.is_some() &&
509-
(start >= 0xD800 || dist.unwrap() < 0xD800 ||
509+
((start as u32) >= 0xD800 || dist.unwrap() < 0xD800 ||
510510
dist.unwrap().checked_add(0x800).is_some())
511511
})]
512512
#[inline]
@@ -528,7 +528,7 @@ impl Step for char {
528528
#[requires({
529529
let dist = (start as u32).checked_sub(count as u32);
530530
dist.is_some() &&
531-
(start < 0xE000 || dist.unwrap() >= 0xE000 ||
531+
((start as u32) < 0xE000 || dist.unwrap() >= 0xE000 ||
532532
dist.unwrap().checked_sub(0x800).is_some())
533533
})]
534534
#[inline]

0 commit comments

Comments
 (0)