Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
checkpoint pcwalton test of new destructor static semantics.
  • Loading branch information
pnkfelix committed Jan 12, 2015
commit 42618e7f50f591eb1054e205d519a67065d0fba1
21 changes: 21 additions & 0 deletions src/test/compile-fail/destructor-restrictions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Tests the new destructor semantics.

use std::cell::RefCell;

fn main() {
let b = {
let a = box RefCell::new(4i);
*a.borrow() + 1i //~ ERROR `*a` does not live long enough
};
println!("{}", b);
}