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.rs15
1 files changed, 15 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..f01a852fbff
--- /dev/null
+++ b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs
@@ -0,0 +1,15 @@
+//@ run-pass
+//@ compile-flags: -Zcontract-checks=yes
+#![feature(contracts)]
+//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
+
+#[core::contracts::ensures(|ret| *ret > 0)]
+fn outer() -> i32 {
+    let inner_closure = || -> i32 { 0 };
+    inner_closure();
+    10
+}
+
+fn main() {
+    outer();
+}