Change label from closure to function where appropriate.

This commit is contained in:
David Wood 2018-07-24 16:22:41 +02:00
parent 055aaaf765
commit b377e7bbfb
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
11 changed files with 49 additions and 49 deletions

View file

@ -10,21 +10,19 @@ warning: not reporting region error due to nll
LL | self.x.iter().map(|a| a.0)
| ^^^^
error: borrowed data escapes outside of closure
error: unsatisfied lifetime constraints
--> $DIR/static-return-lifetime-infered.rs:17:9
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| ----- `self` is a reference that is only valid in the closure body
| - let's call the lifetime of this reference `'1`
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` escapes the closure body here
| ^^^^^^^^^^^^^ free region requires that `'1` must outlive `'static`
error: borrowed data escapes outside of closure
error: unsatisfied lifetime constraints
--> $DIR/static-return-lifetime-infered.rs:21:9
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| -------- `self` is a reference that is only valid in the closure body
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` escapes the closure body here
| ^^^^^^^^^^^^^ free region requires that `'a` must outlive `'static`
error: aborting due to 2 previous errors

View file

@ -4,13 +4,13 @@ warning: not reporting region error due to nll
LL | static_val(x); //~ ERROR cannot infer
| ^
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/dyn-trait.rs:32:5
|
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| - `x` is a reference that is only valid in the closure body
| - `x` is a reference that is only valid in the function body
LL | static_val(x); //~ ERROR cannot infer
| ^^^^^^^^^^^^^ `x` escapes the closure body here
| ^^^^^^^^^^^^^ `x` escapes the function body here
error: aborting due to previous error

View file

@ -10,13 +10,13 @@ warning: not reporting region error due to nll
LL | self.a(); //~ ERROR cannot infer
| ^
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/issue-16683.rs:14:9
|
LL | fn b(&self) {
| ----- `self` is a reference that is only valid in the closure body
| ----- `self` is a reference that is only valid in the function body
LL | self.a(); //~ ERROR cannot infer
| ^^^^^^^^ `self` escapes the closure body here
| ^^^^^^^^ `self` escapes the function body here
error: aborting due to previous error

View file

@ -10,13 +10,13 @@ warning: not reporting region error due to nll
LL | self.foo();
| ^^^
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/issue-17758.rs:17:9
|
LL | fn bar(&self) {
| ----- `self` is a reference that is only valid in the closure body
| ----- `self` is a reference that is only valid in the function body
LL | self.foo();
| ^^^^^^^^^^ `self` escapes the closure body here
| ^^^^^^^^^^ `self` escapes the function body here
error: aborting due to previous error

View file

@ -5,10 +5,10 @@ LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
| ^^^^^
error: unsatisfied lifetime constraints
--> $DIR/issue-52213.rs:12:11
--> $DIR/issue-52213.rs:13:11
|
LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
| ^^^^^ free region requires that `'a` must outlive `'b`
LL | ((u,),) => u,
| ^ free region requires that `'a` must outlive `'b`
error: aborting due to previous error

View file

@ -23,18 +23,18 @@ LL | | });
= note: number of external vids: 2
= note: where '_#1r: '_#0r
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:5
|
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| ------ `cell_a` is a reference that is only valid in the closure body
| ------ `cell_a` is a reference that is only valid in the function body
LL | / establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
LL | | //~^ ERROR
LL | |
LL | | // Only works if 'x: 'y:
LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
LL | | });
| |______^ `cell_a` escapes the closure body here
| |______^ `cell_a` escapes the function body here
note: No external requirements
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:44:1

View file

@ -23,18 +23,18 @@ LL | | });
= note: number of external vids: 3
= note: where '_#1r: '_#0r
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:5
|
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
| ------ `cell_a` is a reference that is only valid in the closure body
| ------ `cell_a` is a reference that is only valid in the function body
LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
LL | | //~^ ERROR
LL | | // Only works if 'x: 'y:
LL | | demand_y(x, y, x.get())
LL | | //~^ WARNING not reporting region error due to nll
LL | | });
| |______^ `cell_a` escapes the closure body here
| |______^ `cell_a` escapes the function body here
note: No external requirements
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:47:1

View file

@ -1,11 +1,11 @@
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/issue-50716.rs:25:14
|
LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
| - `s` is a reference that is only valid in the closure body
| - `s` is a reference that is only valid in the function body
...
LL | let _x = *s; //~ ERROR
| ^^ `s` escapes the closure body here
| ^^ `s` escapes the function body here
error: aborting due to previous error

View file

@ -4,14 +4,14 @@ warning: not reporting region error due to nll
LL | let f: fn(_) -> _ = foo;
| ^^^
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/mir_check_cast_reify.rs:48:5
|
LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
| - `x` is a reference that is only valid in the closure body
| - `x` is a reference that is only valid in the function body
...
LL | f(x)
| ^^^^ `x` escapes the closure body here
| ^^^^ `x` escapes the function body here
error: aborting due to previous error

View file

@ -4,14 +4,14 @@ warning: not reporting region error due to nll
LL | let g: unsafe fn(_) -> _ = f;
| ^
error: borrowed data escapes outside of closure
error: borrowed data escapes outside of function
--> $DIR/mir_check_cast_unsafe_fn.rs:20:14
|
LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
| ----- `input` is a reference that is only valid in the closure body
| ----- `input` is a reference that is only valid in the function body
...
LL | unsafe { g(input) }
| ^^^^^^^^ `input` escapes the closure body here
| ^^^^^^^^ `input` escapes the function body here
error: aborting due to previous error