]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-use-contravariant-struct-1.rs
More nll revisions
[rust.git] / src / test / ui / variance / variance-use-contravariant-struct-1.rs
1 // Test various uses of structs with distint variances to make sure
2 // they permit lifetimes to be approximated as expected.
3
4 // revisions: base nll
5 // ignore-compare-mode-nll
6 //[nll] compile-flags: -Z borrowck=mir
7
8 struct SomeStruct<T>(fn(T));
9
10 fn foo<'min,'max>(v: SomeStruct<&'max ()>)
11                   -> SomeStruct<&'min ()>
12     where 'max : 'min
13 {
14     v
15     //[base]~^ ERROR mismatched types
16     //[nll]~^^ ERROR lifetime may not live long enough
17 }
18
19
20 fn main() { }