You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: verification success
Instead, this happened:
error: captured variable cannot escape `FnMut` closure body
--> src/lib.rs:12:5
|
11 | unsafe fn foo(val:&mut u8) -> &mut u8 {
| --- - inferred to be a `FnMut` closure
| |
| variable defined here
12 | val
| ^^^
| |
| returns a reference to a captured variable which escapes the closure body
| variable captured here
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
error: captured variable cannot escape `FnMut` closure body
--> src/lib.rs:10:1
|
10 | #[kani::requires(*val != 0)]
| ^^^^^^^^^^^^^^^^^^---^^^^^^^
| | |
| | variable captured here
| returns a reference to a captured variable which escapes the closure body
11 | unsafe fn foo(val:&mut u8) -> &mut u8 {
| --- - inferred to be a `FnMut` closure
| |
| variable defined here
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
= note: this error originates in the attribute macro `kani::requires` (in Nightly builds, run with -Z macro-backtrace for more info)
This is a minimal reproducer of a problem encountered trying to write contracts for NonZero::from_mut_unchecked, which has this function signature:
I tried this code:
using the following command line invocation:
with Kani version: 0.56
I expected to see this happen: verification success
Instead, this happened:
This is a minimal reproducer of a problem encountered trying to write contracts for
NonZero::from_mut_unchecked
, which has this function signature:The text was updated successfully, but these errors were encountered: