about summary refs log tree commit diff
path: root/tests/ui/span/destructor-restrictions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/span/destructor-restrictions.rs')
-rw-r--r--tests/ui/span/destructor-restrictions.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/span/destructor-restrictions.rs b/tests/ui/span/destructor-restrictions.rs
new file mode 100644
index 00000000000..7fb348a14bf
--- /dev/null
+++ b/tests/ui/span/destructor-restrictions.rs
@@ -0,0 +1,11 @@
+// Tests the new destructor semantics.
+
+use std::cell::RefCell;
+
+fn main() {
+    let b = {
+        let a = Box::new(RefCell::new(4));
+        *a.borrow() + 1
+    }; //~^ ERROR `*a` does not live long enough
+    println!("{}", b);
+}