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 16:32:54 -06:00
fn invoke<F>(f: F) where F: FnOnce() { f(); }
let k: Box<_> = 22.into();
2013-03-15 17:27:15 -05:00
let _u = A {a: k.clone()};
2014-10-14 20:07:11 -05:00
invoke(|| println!("{}", k.clone()) )
}