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-03-22 15:13:15 -05:00
|
|
|
|
2015-01-07 19:25:56 -06:00
|
|
|
#![allow(unknown_features)]
|
|
|
|
#![feature(box_syntax)]
|
2015-03-05 20:33:58 -06:00
|
|
|
#![feature(unboxed_closures, core)]
|
2014-05-05 20:56:44 -05:00
|
|
|
|
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-02-15 02:52:21 -06:00
|
|
|
let k: Box<_> = box 22;
|
2013-03-15 17:27:15 -05:00
|
|
|
let _u = A {a: k.clone()};
|
2015-03-03 02:42:26 -06:00
|
|
|
// FIXME(#16640) suffix in `22` suffix shouldn't be necessary
|
|
|
|
let result = || 22;
|
2015-02-15 02:52:21 -06:00
|
|
|
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
|
|
|
Box::new(result)
|
2012-01-04 16:16:41 -06:00
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2015-01-02 16:32:54 -06:00
|
|
|
assert_eq!(foo().call_mut(()), 22);
|
2012-01-04 16:16:41 -06:00
|
|
|
}
|