]> git.lizzy.rs Git - rust.git/blob - tests/ui/variance/variance-use-covariant-struct-1.rs
Rollup merge of #103236 - tspiteri:redoc-int-adc-sbb, r=m-ou-se
[rust.git] / tests / 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() { }