]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.rs
Rollup merge of #107442 - lukas-code:slice-panics, r=cuviper
[rust.git] / tests / ui / rfc-2093-infer-outlives / regions-outlives-nominal-type-type.rs
1 // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its
2 // arguments (like `'a`) outlive `'b`.
3 //
4 // Rule OutlivesNominalType from RFC 1214.
5
6
7 #![allow(dead_code)]
8
9 mod variant_struct_type {
10     struct Foo<T> {
11         x: T
12     }
13     trait Trait<'a, 'b> {
14         type Out;
15     }
16     impl<'a, 'b> Trait<'a, 'b> for usize {
17         type Out = &'a Foo<&'b i32>; //~ ERROR reference has a longer lifetime
18     }
19 }
20
21
22 fn main() { }