Skip to content

Verify String::remove in alloc::string - #22

Merged
stogaru merged 41 commits into
usage_proofsfrom
verify/string_remove
Dec 6, 2024
Merged

stogaru merged 41 commits into
usage_proofsfrom
verify/string_remove

Conversation

@szlee118

@szlee118 szlee118 commented Dec 3, 2024

Copy link
Copy Markdown
Collaborator

Intro

This verification harness is designed to validate the behavior of the remove method on Rust's String type. The remove method removes a character at a specified index from a string and returns it. The harness leverages Kani's verification capabilities to ensure correctness under various constraints.

Key Pointer Functions Related:

  • *const T::add / *mut T::add:
    • Used in self.vec.as_ptr().add(next) and self.vec.as_mut_ptr().add(idx) to compute the addresses of the source and destination pointers for the copy operation.
  • *const T::sub / *mut T::sub:
    • Conceptually used for addressing adjustments (e.g., computing len - next).

Purpose

The primary goal of this harness is to verify:
The remove method correctly decreases the string length by one.
The character removed from the string is valid and remains consistent with the original input constraints.

Resolves model-checking#76

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

xsxszab and others added 30 commits October 7, 2024 12:44
implemented integer type proof for contract for fn add, sub and offset
Combines macros for different types.
…allocation api, modified their proof for harness accordingly
Comment thread library/alloc/src/string.rs Resolved
Comment thread library/alloc/src/string.rs Resolved
Comment thread library/alloc/src/string.rs Resolved
Comment thread library/alloc/src/string.rs Resolved
@stogaru
stogaru merged commit f552676 into usage_proofs Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants