mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-30 20:17:50 +00:00

Check ensures on early return due to Try / Yeet Expand these two expressions to include a call to contract checking
15 lines
247 B
Rust
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();
|
|
}
|