diff options
Diffstat (limited to 'tests/ui/span/destructor-restrictions.rs')
-rw-r--r-- | tests/ui/span/destructor-restrictions.rs | 11 |
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 000000000..7fb348a14 --- /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); +} |