]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-use-covariant-struct-1.rs
Rollup merge of #56425 - scottmcm:redo-vec-set_len-docs, r=Centril
[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 //~ ERROR mismatched types
11 }
12
13 fn main() { }