4 impl<T> Trait<'_, '_> for T {}
6 // `Ordinary<'a> <: Ordinary<'b>` if `'a: 'b`, as with most types.
8 // I am purposefully avoiding the terms co- and contra-variant because
9 // their application to regions depends on how you interpreted Rust
10 // regions. -nikomatsakis
11 struct Ordinary<'a>(&'a u8);
13 // Here we need something outlived by `'a` *and* outlived by `'b`, but
14 // we can only name `'a` and `'b` (and neither suits). So we get an
15 // error. Somewhat unfortunate, though, since the caller would have to
16 // consider the loans for both `'a` and `'b` alive.
18 fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
28 // but we don't have it.
30 // We are forced to pick that '0 = 'e, because only 'e is outlived by *both* 'a and 'b.
31 if condition() { a } else { b }
32 //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
35 fn condition() -> bool {