1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(unsized_locals)]
15 fn gen_foo() -> Box<fmt::Display> {
16 Box::new(Box::new("foo"))
19 fn foo(x: fmt::Display) {
20 assert_eq!(x.to_string(), "foo");
23 fn foo_indirect(x: fmt::Display) {
29 foo_indirect(*gen_foo());
32 let x: fmt::Display = *gen_foo();
37 let x: fmt::Display = *gen_foo();
38 let y: fmt::Display = *gen_foo();
44 let mut cnt: usize = 3;
46 let x: fmt::Display = *gen_foo();
57 let x: fmt::Display = *gen_foo();