Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions library/core/src/ops/index_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ mod verify {
fn proof_for_index_range_next_unchecked() {
let start = kani::any::<usize>();
let end = kani::any::<usize>();
// Respect new_unchecked's safety precondition (start <= end); the
// stronger requirement of next_unchecked (start < end) is assumed
// from its contract.
kani::assume(start <= end);
Comment on lines +253 to +256

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be part of the requires clause for new_unchecked?


let mut range = unsafe { IndexRange::new_unchecked(start, end) };

Expand All @@ -260,6 +264,10 @@ mod verify {
fn proof_for_index_range_next_back_unchecked() {
let start = kani::any::<usize>();
let end = kani::any::<usize>();
// Respect new_unchecked's safety precondition (start <= end); the
// stronger requirement of next_back_unchecked (start < end) is
// assumed from its contract.
kani::assume(start <= end);

let mut range = unsafe { IndexRange::new_unchecked(start, end) };

Expand Down
Loading