Function build_check_ensures

Source
pub const fn build_check_ensures<Ret, C>(cond: C) -> C
where C: Fn(&Ret) -> bool + Copy + 'static,
🔬This is a nightly-only experimental API. (contracts_internals #128044)
Expand description

This is an identity function used as part of the desugaring of the #[ensures] attribute.

This is an existing hack to allow users to omit the type of the return value in their ensures attribute.

Ideally, rustc should be able to generate the type annotation. The existing lowering logic makes it rather hard to add the explicit type annotation, while the function call is fairly straight forward.