1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
fn id<T>(x: T) -> T { x } trait Foo { } impl<'a> Foo for &'a isize { } fn main() { let blah; { let ss: &isize = &id(1); //~^ ERROR temporary value dropped while borrowed blah = Box::new(ss) as Box<dyn Foo>; } }