Commit c841a12
Contract and harness for as_ptr, cast, as_mut_ptr, and as_non_null_ptr (#126)
### Description
This PR includes contracts and proof harnesses for the four APIs as_ptr,
cast, as_mut_ptr, and as_non_null_ptr which are part of the NonNull
library in Rust.
### Changes Overview:
Covered APIs:
NonNull::as_ptr: Acquires the underlying *mut pointer
NonNull::cast: Casts to a pointer of another type
NonNull:: as_mut_ptr: Returns raw pointer to array's buffer
NonNull::as_non_null_ptr: Returns a non-null pointer to slice's buffer
Proof harness:
non_null_check_as_ptr
non_null_check_cast
non_null_check_as_mut_ptr
non_null_check_as_non_null_ptr
Revalidation
To revalidate the verification results, run kani verify-std -Z
unstable-options "path/to/library" -Z function-contracts -Z
mem-predicates --harness ptr::non_null::verify. This will run all four
harnesses in the module. All default checks should pass:
```
SUMMARY:
** 0 of 128 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 0.8232234s
Complete - 4 successfully verified harnesses, 0 failures, 4 total.
```
Towards issue #53
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
---------
Co-authored-by: Zyad Hassan <88045115+zhassan-aws@users.noreply.github.com>
Co-authored-by: Zyad Hassan <zyadh@amazon.com>
Co-authored-by: Michael Tautschnig <mt@debian.org>
Co-authored-by: Qinyuan Wu <53478459+QinyuanWu@users.noreply.github.com>1 parent 2338dad commit c841a12
1 file changed
+44
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
356 | 358 | | |
357 | 359 | | |
358 | 360 | | |
| |||
454 | 456 | | |
455 | 457 | | |
456 | 458 | | |
| 459 | + | |
| 460 | + | |
457 | 461 | | |
458 | 462 | | |
459 | 463 | | |
| |||
1470 | 1474 | | |
1471 | 1475 | | |
1472 | 1476 | | |
| 1477 | + | |
| 1478 | + | |
1473 | 1479 | | |
1474 | 1480 | | |
1475 | 1481 | | |
| |||
1489 | 1495 | | |
1490 | 1496 | | |
1491 | 1497 | | |
| 1498 | + | |
| 1499 | + | |
1492 | 1500 | | |
1493 | 1501 | | |
1494 | 1502 | | |
| |||
2186 | 2194 | | |
2187 | 2195 | | |
2188 | 2196 | | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
2189 | 2233 | | |
2190 | 2234 | | |
2191 | 2235 | | |
| |||
0 commit comments