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

struct SomeStruct<T>(T);

fn foo<'min,'max>(v: SomeStruct<&'min ()>)
                  -> SomeStruct<&'max ()>
    where 'max : 'min
{
    v
    //~^ ERROR lifetime may not live long enough
}

fn main() { }