2015-02-12 10:16:02 +00:00
|
|
|
// Test various uses of structs with distint variances to make sure
|
|
|
|
// they permit lifetimes to be approximated as expected.
|
|
|
|
|
2022-04-02 02:12:17 +00:00
|
|
|
// revisions: base nll
|
|
|
|
// ignore-compare-mode-nll
|
|
|
|
//[nll] compile-flags: -Z borrowck=mir
|
2015-02-18 22:31:42 +00:00
|
|
|
|
2015-02-12 10:16:02 +00:00
|
|
|
struct SomeStruct<T>(fn(T));
|
|
|
|
|
|
|
|
fn foo<'min,'max>(v: SomeStruct<&'max ()>)
|
|
|
|
-> SomeStruct<&'min ()>
|
|
|
|
where 'max : 'min
|
|
|
|
{
|
2022-04-02 02:12:17 +00:00
|
|
|
v
|
|
|
|
//[base]~^ ERROR mismatched types
|
|
|
|
//[nll]~^^ ERROR lifetime may not live long enough
|
2015-02-12 10:16:02 +00:00
|
|
|
}
|
|
|
|
|
2018-10-30 23:18:11 +00:00
|
|
|
|
2015-02-12 10:16:02 +00:00
|
|
|
fn main() { }
|