Auto merge of #53088 - matthewjasper:closure-region-spans, r=nikomatsakis

[NLL] Use span of the closure args in free region errors

Also adds a note when one of the free regions is BrEnv.
In a future PR I'll change these messages to say "return requires", which should improve them a bit more.

r? @nikomatsakis
This commit is contained in:
bors 2018-08-08 12:48:32 +00:00
commit 63fe441db8
6 changed files with 112 additions and 63 deletions

View file

@ -8,11 +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