rust/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs
Felix S. Klock II ae7eff0be5 Desugars contract into the internal AST extensions
Check ensures on early return due to Try / Yeet

Expand these two expressions to include a call to contract checking
2025-02-03 13:54:32 -08:00

15 lines
247 B
Rust

//@ run-pass
//@ compile-flags: -Zcontract-checks=yes
#![feature(rustc_contracts)]
#[core::contracts::ensures(|ret| *ret > 0)]
fn outer() -> i32 {
let inner_closure = || -> i32 { 0 };
inner_closure();
10
}
fn main() {
outer();
}