summaryrefslogtreecommitdiffstats
path: root/src/test/ui/variance/variance-use-covariant-struct-2.rs
blob: ecd2204c991c6963c49780028c8937e38a26f558 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Test that a covariant struct permits the lifetime of a reference to
// be shortened.

#![allow(dead_code)]
// build-pass (FIXME(62277): could be check-pass?)

struct SomeStruct<T>(T);

fn foo<'min,'max>(v: SomeStruct<&'max ()>)
                  -> SomeStruct<&'min ()>
    where 'max : 'min
{
    v
}

fn main() { }