]> git.lizzy.rs Git - rust.git/blob - tests/ui/variance/variance-use-contravariant-struct-1.rs
Rollup merge of #106979 - Nilstrieb:type-of-default-assoc-type, r=petrochenkov
[rust.git] / tests / ui / variance / variance-use-contravariant-struct-1.rs
1 // Test various uses of structs with distinct variances to make sure
2 // they permit lifetimes to be approximated as expected.
3
4 struct SomeStruct<T>(fn(T));
5
6 fn foo<'min,'max>(v: SomeStruct<&'max ()>)
7                   -> SomeStruct<&'min ()>
8     where 'max : 'min
9 {
10     v
11     //~^ ERROR lifetime may not live long enough
12 }
13
14
15 fn main() { }