rust/src/test/ui/variance/variance-use-covariant-struct-2.rs

17 lines
285 B
Rust
Raw Normal View History

// Test that a covariant struct permits the lifetime of a reference to
// be shortened.
#![allow(dead_code)]
// compile-pass
struct SomeStruct<T>(T);
fn foo<'min,'max>(v: SomeStruct<&'max ()>)
-> SomeStruct<&'min ()>
where 'max : 'min
{
v
}
fn main() { }