]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-use-covariant-struct-2.rs
Auto merge of #94216 - psumbera:sparc64-abi-fix2, r=nagisa
[rust.git] / src / test / ui / variance / variance-use-covariant-struct-2.rs
1 // Test that a covariant struct permits the lifetime of a reference to
2 // be shortened.
3
4 #![allow(dead_code)]
5 // build-pass (FIXME(62277): could be check-pass?)
6
7 struct SomeStruct<T>(T);
8
9 fn foo<'min,'max>(v: SomeStruct<&'max ()>)
10                   -> SomeStruct<&'min ()>
11     where 'max : 'min
12 {
13     v
14 }
15
16 fn main() { }