rust/tests/ui/last-use-is-capture.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
266 B
Rust
Raw Normal View History

// run-pass
#![allow(dead_code)]
// Make sure #1399 stays fixed
struct A { a: Box<isize> }
pub fn main() {
2015-01-02 22:32:54 +00:00
fn invoke<F>(f: F) where F: FnOnce() { f(); }
let k: Box<_> = 22.into();
2013-03-15 22:27:15 +00:00
let _u = A {a: k.clone()};
2014-10-15 01:07:11 +00:00
invoke(|| println!("{}", k.clone()) )
}