about summary refs log tree commit diff
path: root/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs')
-rw-r--r--tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs
new file mode 100644
index 00000000000..9872fdb1a18
--- /dev/null
+++ b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs
@@ -0,0 +1,14 @@
+//@ 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();
+}