]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-use-covariant-struct-1.rs
Auto merge of #100845 - timvermeulen:iter_compare, r=scottmcm
[rust.git] / src / test / ui / variance / variance-use-covariant-struct-1.rs
1 // Test that a covariant struct does not permit the lifetime of a
2 // reference to be enlarged.
3
4 struct SomeStruct<T>(T);
5
6 fn foo<'min,'max>(v: SomeStruct<&'min ()>)
7                   -> SomeStruct<&'max ()>
8     where 'max : 'min
9 {
10     v
11     //~^ ERROR lifetime may not live long enough
12 }
13
14 fn main() { }