mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
14 lines
303 B
Rust
14 lines
303 B
Rust
// 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() { }
|