about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-27 13:01:48 +0000
committerbors <bors@rust-lang.org>2018-07-27 13:01:48 +0000
commitb6cbc1e1479d1ac5e66565d3b3e2cc54f767d2a0 (patch)
tree5f1edc4fd5141ec935c2155ea94b4a6a2c4d99b3 /src/test/ui
parent6998b369faf3daf849f538d636bac9eda659fa5a (diff)
parent2e4224a9983cacf6ef1a2787c0084d743abb27e1 (diff)
downloadrust-b6cbc1e1479d1ac5e66565d3b3e2cc54f767d2a0.tar.gz
rust-b6cbc1e1479d1ac5e66565d3b3e2cc54f767d2a0.zip
Auto merge of #52648 - davidtwco:issue-52533, r=nikomatsakis
[nll] improve the "fully elaborated type" case in region errors

Fixes #52533.

r? @nikomatsakis
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr4
-rw-r--r--src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr12
-rw-r--r--src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr6
-rw-r--r--src/test/ui/issue-10291.nll.stderr2
-rw-r--r--src/test/ui/issue-16683.nll.stderr6
-rw-r--r--src/test/ui/issue-17758.nll.stderr6
-rw-r--r--src/test/ui/issue-40510-1.nll.stderr2
-rw-r--r--src/test/ui/issue-40510-3.nll.stderr2
-rw-r--r--src/test/ui/issue-52213.nll.stderr2
-rw-r--r--src/test/ui/issue-52533-1.nll.stderr17
-rw-r--r--src/test/ui/issue-52533-1.rs21
-rw-r--r--src/test/ui/issue-52533-1.stderr22
-rw-r--r--src/test/ui/issue-52533.nll.stderr17
-rw-r--r--src/test/ui/issue-52533.rs17
-rw-r--r--src/test/ui/issue-52533.stderr20
-rw-r--r--src/test/ui/nll/closure-requirements/escape-argument-callee.stderr6
-rw-r--r--src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr4
-rw-r--r--src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr6
-rw-r--r--src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr6
-rw-r--r--src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr4
-rw-r--r--src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr4
-rw-r--r--src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr2
-rw-r--r--src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr6
-rw-r--r--src/test/ui/nll/issue-50716.stderr6
-rw-r--r--src/test/ui/nll/mir_check_cast_reify.stderr6
-rw-r--r--src/test/ui/nll/mir_check_cast_unsafe_fn.stderr6
26 files changed, 162 insertions, 50 deletions
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
index 9c7e3db67a6..0ac295c54bc 100644
--- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
+++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
@@ -10,8 +10,8 @@ error: unsatisfied lifetime constraints
 LL |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
    |                ----------^^^^^-----------------
    |                |   |     |
-   |                |   |     free region requires that `'1` must outlive `'2`
-   |                |   lifetime `'1` appears in this argument
+   |                |   |     requires that `'1` must outlive `'2`
+   |                |   has type `&'1 i32`
    |                lifetime `'2` appears in return type
 
 error: aborting due to previous error
diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
index c6f8d2e519c..bbc63e6feca 100644
--- a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
+++ b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
@@ -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
+   |         ^^^^^^^^^^^^^ 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
+   |         ^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr b/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr
index e26b1956d5e..f5d98e04ad8 100644
--- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr
+++ b/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr
@@ -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
 
diff --git a/src/test/ui/issue-10291.nll.stderr b/src/test/ui/issue-10291.nll.stderr
index 1358fe010b4..6de00ffd48c 100644
--- a/src/test/ui/issue-10291.nll.stderr
+++ b/src/test/ui/issue-10291.nll.stderr
@@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
   --> $DIR/issue-10291.rs:12:5
    |
 LL |     drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ free region requires that `'x` must outlive `'static`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'x` must outlive `'static`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issue-16683.nll.stderr b/src/test/ui/issue-16683.nll.stderr
index f9dda27da09..890bb426441 100644
--- a/src/test/ui/issue-16683.nll.stderr
+++ b/src/test/ui/issue-16683.nll.stderr
@@ -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
 
diff --git a/src/test/ui/issue-17758.nll.stderr b/src/test/ui/issue-17758.nll.stderr
index 5775135aefc..c51a72f885d 100644
--- a/src/test/ui/issue-17758.nll.stderr
+++ b/src/test/ui/issue-17758.nll.stderr
@@ -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
 
diff --git a/src/test/ui/issue-40510-1.nll.stderr b/src/test/ui/issue-40510-1.nll.stderr
index 73a8d58290d..312ec6e742e 100644
--- a/src/test/ui/issue-40510-1.nll.stderr
+++ b/src/test/ui/issue-40510-1.nll.stderr
@@ -6,7 +6,7 @@ LL |        || {
    |  |_____|
    | ||
 LL | ||         &mut x
-   | ||         ^^^^^^ free region requires that `'1` must outlive `'2`
+   | ||         ^^^^^^ return requires that `'1` must outlive `'2`
 LL | ||     };
    | ||     -
    | ||_____|
diff --git a/src/test/ui/issue-40510-3.nll.stderr b/src/test/ui/issue-40510-3.nll.stderr
index 4133c69f031..eb44850e639 100644
--- a/src/test/ui/issue-40510-3.nll.stderr
+++ b/src/test/ui/issue-40510-3.nll.stderr
@@ -9,7 +9,7 @@ LL |  ||         || {
    |  ||_________^
 LL | |||             x.push(())
 LL | |||         }
-   | |||_________^ free region requires that `'1` must outlive `'2`
+   | |||_________^ requires that `'1` must outlive `'2`
 LL |  ||     };
    |  ||     -
    |  ||_____|
diff --git a/src/test/ui/issue-52213.nll.stderr b/src/test/ui/issue-52213.nll.stderr
index c288cf9ed82..7dd513d1b71 100644
--- a/src/test/ui/issue-52213.nll.stderr
+++ b/src/test/ui/issue-52213.nll.stderr
@@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
   --> $DIR/issue-52213.rs:13:11
    |
 LL |         ((u,),) => u,
-   |           ^ free region requires that `'a` must outlive `'b`
+   |           ^ requires that `'a` must outlive `'b`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issue-52533-1.nll.stderr b/src/test/ui/issue-52533-1.nll.stderr
new file mode 100644
index 00000000000..87fda1dd99c
--- /dev/null
+++ b/src/test/ui/issue-52533-1.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+  --> $DIR/issue-52533-1.rs:19:18
+   |
+LL |     gimme(|x, y| y)
+   |                  ^
+
+error: unsatisfied lifetime constraints
+  --> $DIR/issue-52533-1.rs:19:18
+   |
+LL |     gimme(|x, y| y)
+   |            -  -  ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
+   |            |  |
+   |            |  has type `&Foo<'_, '1, u32>`
+   |            has type `&Foo<'_, '2, u32>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-52533-1.rs b/src/test/ui/issue-52533-1.rs
new file mode 100644
index 00000000000..22af5a86702
--- /dev/null
+++ b/src/test/ui/issue-52533-1.rs
@@ -0,0 +1,21 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(warnings)]
+
+struct Foo<'a, 'b, T: 'a + 'b> { x: &'a T, y: &'b T }
+
+fn gimme(_: impl for<'a, 'b, 'c> FnOnce(&'a Foo<'a, 'b, u32>,
+                                        &'a Foo<'a, 'c, u32>) -> &'a Foo<'a, 'b, u32>) { }
+
+fn main() {
+    gimme(|x, y| y)
+    //~^ ERROR mismatched types [E0308]
+}
diff --git a/src/test/ui/issue-52533-1.stderr b/src/test/ui/issue-52533-1.stderr
new file mode 100644
index 00000000000..38deb7d66de
--- /dev/null
+++ b/src/test/ui/issue-52533-1.stderr
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-52533-1.rs:19:18
+   |
+LL |     gimme(|x, y| y)
+   |                  ^ lifetime mismatch
+   |
+   = note: expected type `&Foo<'_, '_, u32>`
+              found type `&Foo<'_, '_, u32>`
+note: the anonymous lifetime #4 defined on the body at 19:11...
+  --> $DIR/issue-52533-1.rs:19:11
+   |
+LL |     gimme(|x, y| y)
+   |           ^^^^^^^^
+note: ...does not necessarily outlive the anonymous lifetime #3 defined on the body at 19:11
+  --> $DIR/issue-52533-1.rs:19:11
+   |
+LL |     gimme(|x, y| y)
+   |           ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issue-52533.nll.stderr b/src/test/ui/issue-52533.nll.stderr
new file mode 100644
index 00000000000..a13b06e3204
--- /dev/null
+++ b/src/test/ui/issue-52533.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+  --> $DIR/issue-52533.rs:15:16
+   |
+LL |     foo(|a, b| b)
+   |                ^
+
+error: unsatisfied lifetime constraints
+  --> $DIR/issue-52533.rs:15:16
+   |
+LL |     foo(|a, b| b)
+   |          -  -  ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
+   |          |  |
+   |          |  has type `&'1 u32`
+   |          has type `&'2 u32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-52533.rs b/src/test/ui/issue-52533.rs
new file mode 100644
index 00000000000..08f2805cefd
--- /dev/null
+++ b/src/test/ui/issue-52533.rs
@@ -0,0 +1,17 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo(_: impl for<'a> FnOnce(&'a u32, &u32) -> &'a u32) {
+}
+
+fn main() {
+    foo(|a, b| b)
+    //~^ ERROR lifetime of reference outlives lifetime of borrowed content...
+}
diff --git a/src/test/ui/issue-52533.stderr b/src/test/ui/issue-52533.stderr
new file mode 100644
index 00000000000..76a2470a2e0
--- /dev/null
+++ b/src/test/ui/issue-52533.stderr
@@ -0,0 +1,20 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+  --> $DIR/issue-52533.rs:15:16
+   |
+LL |     foo(|a, b| b)
+   |                ^
+   |
+note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 15:9...
+  --> $DIR/issue-52533.rs:15:9
+   |
+LL |     foo(|a, b| b)
+   |         ^^^^^^^^
+note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined on the body at 15:9
+  --> $DIR/issue-52533.rs:15:9
+   |
+LL |     foo(|a, b| b)
+   |         ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0312`.
diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr
index d6f54218360..ccf116e640d 100644
--- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr
@@ -8,10 +8,10 @@ error: unsatisfied lifetime constraints
   --> $DIR/escape-argument-callee.rs:36:45
    |
 LL |         let mut closure = expect_sig(|p, y| *p = y);
-   |                                       -  -  ^^^^^^ free region requires that `'1` must outlive `'2`
+   |                                       -  -  ^^^^^^ requires that `'1` must outlive `'2`
    |                                       |  |
-   |                                       |  lifetime `'1` appears in this argument
-   |                                       lifetime `'2` appears in this argument
+   |                                       |  has type `&'1 i32`
+   |                                       has type `&mut &'2 i32`
 
 note: No external requirements
   --> $DIR/escape-argument-callee.rs:36:38
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
index a7a50a3a029..b4508824901 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr
@@ -8,9 +8,9 @@ error: unsatisfied lifetime constraints
   --> $DIR/propagate-approximated-fail-no-postdom.rs:57:13
    |
 LL |         |_outlives1, _outlives2, _outlives3, x, y| {
-   |          ----------              ---------- lifetime `'2` appears in this argument
+   |          ----------              ---------- has type `std::cell::Cell<&'2 &u32>`
    |          |
-   |          lifetime `'1` appears in this argument
+   |          has type `std::cell::Cell<&&'1 u32>`
 ...
 LL |             demand_y(x, y, p) //~ ERROR
    |             ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
index 3177cd7c28f..33e4240736f 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr
@@ -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
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
index 089c88abcdd..5f98a0fd36d 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr
@@ -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
diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
index fb98c506c7d..40ebda4419b 100644
--- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr
@@ -8,9 +8,9 @@ error: unsatisfied lifetime constraints
   --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:9
    |
 LL |     establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
-   |                                                ---------  - lifetime `'1` appears in this argument
+   |                                                ---------  - has type `&std::cell::Cell<&'1 u32>`
    |                                                |
-   |                                                lifetime `'2` appears in this argument
+   |                                                has type `&std::cell::Cell<&'2 &u32>`
 LL |         // Only works if 'x: 'y:
 LL |         demand_y(x, y, x.get())
    |         ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
index 73d39a8502b..37ea6103976 100644
--- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr
@@ -8,9 +8,9 @@ error: unsatisfied lifetime constraints
   --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:9
    |
 LL |     establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
-   |                                                ----------  ---------- lifetime `'2` appears in this argument
+   |                                                ----------  ---------- has type `&std::cell::Cell<&'2 &u32>`
    |                                                |
-   |                                                lifetime `'1` appears in this argument
+   |                                                has type `&std::cell::Cell<&'1 &u32>`
 LL |         // Only works if 'x: 'y:
 LL |         demand_y(x, y, x.get())
    |         ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr
index d012dca2527..b0562711627 100644
--- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr
+++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr
@@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
   --> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
    |
 LL |     &*x
-   |     ^^^ free region requires that `'a` must outlive `'static`
+   |     ^^^ requires that `'a` must outlive `'static`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
index 5724cdbd8c9..d6d1645ceea 100644
--- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
+++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
@@ -8,10 +8,10 @@ error: unsatisfied lifetime constraints
   --> $DIR/return-wrong-bound-region.rs:21:23
    |
 LL |     expect_sig(|a, b| b); // ought to return `a`
-   |                 -  -  ^ free region requires that `'1` must outlive `'2`
+   |                 -  -  ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
    |                 |  |
-   |                 |  lifetime `'1` appears in this argument
-   |                 lifetime `'2` appears in this argument
+   |                 |  has type `&'1 i32`
+   |                 has type `&'2 i32`
 
 note: No external requirements
   --> $DIR/return-wrong-bound-region.rs:21:16
diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.stderr
index 8acf2ef51ec..f12ab9b4f96 100644
--- a/src/test/ui/nll/issue-50716.stderr
+++ b/src/test/ui/nll/issue-50716.stderr
@@ -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
 
diff --git a/src/test/ui/nll/mir_check_cast_reify.stderr b/src/test/ui/nll/mir_check_cast_reify.stderr
index 13f90e1f159..d8f186a2232 100644
--- a/src/test/ui/nll/mir_check_cast_reify.stderr
+++ b/src/test/ui/nll/mir_check_cast_reify.stderr
@@ -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
 
diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr
index b08c6f32e6b..98c03e37814 100644
--- a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr
+++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr
@@ -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