]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-use-invariant-struct-1.rs
Rollup merge of #92642 - avborhanian:master, r=Dylan-DPC
[rust.git] / src / test / ui / variance / variance-use-invariant-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
5
6 struct SomeStruct<T>(*mut T);
7
8 fn foo<'min,'max>(v: SomeStruct<&'max ()>)
9                   -> SomeStruct<&'min ()>
10     where 'max : 'min
11 {
12     v //~ ERROR mismatched types
13 }
14
15 fn bar<'min,'max>(v: SomeStruct<&'min ()>)
16                   -> SomeStruct<&'max ()>
17     where 'max : 'min
18 {
19     v //~ ERROR mismatched types
20 }
21
22
23 fn main() { }