diff options
Diffstat (limited to 'tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs')
-rw-r--r-- | tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs new file mode 100644 index 000000000..36b024d2e --- /dev/null +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs @@ -0,0 +1,22 @@ +// Test that a nominal type (like `Foo<'a>`) outlives `'b` if its +// arguments (like `'a`) outlive `'b`. +// +// Rule OutlivesNominalType from RFC 1214. + + +#![allow(dead_code)] + +mod rev_variant_struct_region { + struct Foo<'a> { + x: fn(&'a i32), + } + trait Trait<'a, 'b> { + type Out; + } + impl<'a, 'b> Trait<'a, 'b> for usize { + type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime + } +} + + +fn main() { } |