Using a closure inside a function marked with #[pure] causes Prusti to report that std::ops::Fn::call is impure. It also triggers an unsupported constant type error for the closure itself.
Reproduction
use prusti_contracts::*;
#[pure]
fn check() -> bool {
// A trivial closure inside a pure function
(|| { true })()
}
fn main() {}
Actual Behavior
Prusti reports the following errors:
error: [Prusti: invalid specification] use of impure function "std::ops::Fn::call" in pure code is not allowed
error: [Prusti: unsupported feature] unsupported constant type ... Closure(...)
Expected Behavior
Trivially pure closures (like the one above) should be accepted inside #[pure] functions.
Using a closure inside a function marked with
#[pure]causes Prusti to report thatstd::ops::Fn::callis impure. It also triggers an unsupported constant type error for the closure itself.Reproduction
Actual Behavior
Prusti reports the following errors:
error: [Prusti: invalid specification] use of impure function "std::ops::Fn::call" in pure code is not allowederror: [Prusti: unsupported feature] unsupported constant type ... Closure(...)Expected Behavior
Trivially pure closures (like the one above) should be accepted inside
#[pure]functions.