fn main() { { let mut _thing1 = D(Box::new("thing1")); { let _thing2 = D("thing2"); side_effects(); D("other").next(&_thing1) //~^ ERROR does not live long enough } } ; } #[derive(Debug)] struct D(T); impl Drop for D { fn drop(&mut self) { println!("dropping {:?})", self); } } impl D { fn next(&self, _other: U) -> D { D(_other) } fn end(&self) { } } fn side_effects() { }