//@ compile-flags:-Zverbose-internals #![allow(warnings)] trait Anything { } impl Anything for T { } fn no_region<'a, T>(mut x: T) -> Box where T: Iterator, { Box::new(x.next()) //~^ ERROR the associated type `::Item` may not live long enough } fn correct_region<'a, T>(mut x: T) -> Box where T: 'a + Iterator, { Box::new(x.next()) } fn wrong_region<'a, 'b, T>(mut x: T) -> Box where T: 'b + Iterator, { Box::new(x.next()) //~^ ERROR the associated type `::Item` may not live long enough } fn outlives_region<'a, 'b, T>(mut x: T) -> Box where T: 'b + Iterator, 'b: 'a, { Box::new(x.next()) } fn main() {}