2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 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.
|
|
|
|
|
2012-01-04 16:16:41 -06:00
|
|
|
// Make sure #1399 stays fixed
|
|
|
|
|
2015-02-03 05:12:43 -06:00
|
|
|
struct A { a: Box<isize> }
|
2013-01-26 00:46:32 -06:00
|
|
|
|
2015-02-03 05:12:43 -06:00
|
|
|
fn foo() -> Box<FnMut() -> isize + 'static> {
|
2015-12-02 19:31:49 -06:00
|
|
|
let k: Box<_> = Box::new(22);
|
2013-03-15 17:27:15 -05:00
|
|
|
let _u = A {a: k.clone()};
|
2015-03-03 02:42:26 -06:00
|
|
|
let result = || 22;
|
2015-02-15 02:52:21 -06:00
|
|
|
Box::new(result)
|
2012-01-04 16:16:41 -06:00
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2015-12-02 19:31:49 -06:00
|
|
|
assert_eq!(foo()(), 22);
|
2012-01-04 16:16:41 -06:00
|
|
|
}
|