Name return type in free region messages

This commit is contained in:
Matthew Jasper 2018-08-06 21:42:26 +01:00
parent f72b8a44c5
commit b13e3f8770
6 changed files with 36 additions and 23 deletions

View file

@ -8,10 +8,10 @@ error: unsatisfied lifetime constraints
--> $DIR/E0621-does-not-trigger-for-closures.rs:25:26
|
LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
| ------ ^^^^^ requires that `'1` must outlive `'2`
| | |
| | has type `&'1 i32`
| lifetime `'2` appears in return type
| -- ^^^^^ requires that `'1` must outlive `'2`
| ||
| |return type of closure is &'2 i32
| has type `&'1 i32`
error: aborting due to previous error

View file

@ -3,9 +3,9 @@ error: unsatisfied lifetime constraints
|
LL | || {
| --
| |
| ||
| |return type of closure is &'2 mut std::boxed::Box<()>
| lifetime `'1` represents this closure's body
| lifetime `'2` appears in return type
LL | &mut x
| ^^^^^^ return requires that `'1` must outlive `'2`
|

View file

@ -3,9 +3,9 @@ error: unsatisfied lifetime constraints
|
LL | || {
| --
| |
| ||
| |return type of closure is [closure@$DIR/issue-40510-3.rs:18:9: 20:10 x:&'2 mut std::vec::Vec<()>]
| lifetime `'1` represents this closure's body
| lifetime `'2` appears in return type
LL | / || {
LL | | x.push(())
LL | | }

View file

@ -3,9 +3,9 @@ error: unsatisfied lifetime constraints
|
LL | || {
| --
| |
| ||
| |return type of closure is [closure@$DIR/issue-49824.rs:22:9: 24:10 x:&'2 mut i32]
| lifetime `'1` represents this closure's body
| lifetime `'2` appears in return type
LL | / || {
LL | | let _y = &mut x;
LL | | }

View file

@ -3,9 +3,9 @@ error: unsatisfied lifetime constraints
|
LL | move || use_val(&orig); //~ ERROR
| ------- ^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
| |
| | |
| | return type of closure is &'2 u8
| lifetime `'1` represents this closure's body
| lifetime `'2` appears in return type
|
= note: closure implements `Fn`, so references to captured variables can't escape the closure