]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.rs
Rollup merge of #58812 - jonhoo:floor_v_trunc, r=alexcrichton
[rust.git] / src / test / ui / rfc-2093-infer-outlives / regions-outlives-nominal-type-region.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_region {
10     struct Foo<'a> {
11         x: &'a i32,
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>; //~ ERROR reference has a longer lifetime
18     }
19 }
20
21
22 fn main() { }