Skip to content

Commit 412771a

Browse files
authored
Cherry-pick rust-lang#3375 into verify-rust-std (Import apply_closure into kani_core) (rust-lang#3376)
This adds the commit from rust-lang#3375 to features/verify-rust-std.
1 parent 8d9d1e5 commit 412771a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/kani_core/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@ macro_rules! kani_intrinsics {
384384
#[doc(hidden)]
385385
#[rustc_diagnostic_item = "KaniInitContracts"]
386386
pub fn init_contracts() {}
387+
388+
/// This should only be used within contracts. The intent is to
389+
/// perform type inference on a closure's argument
390+
#[doc(hidden)]
391+
pub fn apply_closure<T, U: Fn(&T) -> bool>(f: U, x: &T) -> bool {
392+
f(x)
393+
}
387394
}
388395
};
389396
}

0 commit comments

Comments
 (0)