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