Auto merge of #97993 - lengyijun:clean-variance, r=compiler-errors

clean variance test

Remove unnecessary generic parameter.
This commit is contained in:
bors 2022-06-12 06:43:18 +00:00
commit ae2aa18d74
6 changed files with 9 additions and 9 deletions

View File

@ -15,8 +15,8 @@ fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
//~^ ERROR lifetime may not live long enough
}
fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-> Box<dyn Get<&'max i32>>
fn get_max_from_min<'min, 'max>(v: Box<dyn Get<&'min i32>>)
-> Box<dyn Get<&'max i32>>
where 'max : 'min
{
// Previously OK:

View File

@ -14,7 +14,7 @@ LL | v
error: lifetime may not live long enough
--> $DIR/variance-contravariant-arg-object.rs:23:5
|
LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
LL | fn get_max_from_min<'min, 'max>(v: Box<dyn Get<&'min i32>>)
| ---- ---- lifetime `'max` defined here
| |
| lifetime `'min` defined here

View File

@ -16,8 +16,8 @@ fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
//~^ ERROR lifetime may not live long enough
}
fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-> Box<dyn Get<&'max i32>>
fn get_max_from_min<'min, 'max>(v: Box<dyn Get<&'min i32>>)
-> Box<dyn Get<&'max i32>>
where 'max : 'min
{
v

View File

@ -14,7 +14,7 @@ LL | v
error: lifetime may not live long enough
--> $DIR/variance-covariant-arg-object.rs:23:5
|
LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
LL | fn get_max_from_min<'min, 'max>(v: Box<dyn Get<&'min i32>>)
| ---- ---- lifetime `'max` defined here
| |
| lifetime `'min` defined here

View File

@ -12,8 +12,8 @@ fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
//~^ ERROR lifetime may not live long enough
}
fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
-> Box<dyn Get<&'max i32>>
fn get_max_from_min<'min, 'max>(v: Box<dyn Get<&'min i32>>)
-> Box<dyn Get<&'max i32>>
where 'max : 'min
{
v

View File

@ -14,7 +14,7 @@ LL | v
error: lifetime may not live long enough
--> $DIR/variance-invariant-arg-object.rs:19:5
|
LL | fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
LL | fn get_max_from_min<'min, 'max>(v: Box<dyn Get<&'min i32>>)
| ---- ---- lifetime `'max` defined here
| |
| lifetime `'min` defined here