about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-05-30 10:15:58 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-06-15 09:06:57 -0700
commit539e9783dfb713b3af0a9967af8fd0639d700555 (patch)
treeb2dc9150dcebb59547eeaaba340c4fb44454a0b1
parentbc1579060981b5e95a18409e876c92bf0c9307e6 (diff)
Tweak wording and add error code
-rw-r--r--src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs35
-rw-r--r--src/test/ui/async-await/issues/issue-62097.stderr6
-rw-r--r--src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr52
-rw-r--r--src/test/ui/impl-trait/static-return-lifetime-infered.stderr12
-rw-r--r--src/test/ui/issues/issue-16922.stderr8
-rw-r--r--src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr8
-rw-r--r--src/test/ui/regions/region-object-lifetime-in-coercion.stderr24
-rw-r--r--src/test/ui/regions/regions-close-object-into-object-2.stderr4
-rw-r--r--src/test/ui/regions/regions-close-object-into-object-4.stderr4
-rw-r--r--src/test/ui/regions/regions-proc-bound-capture.stderr8
-rw-r--r--src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr6
-rw-r--r--src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr8
-rw-r--r--src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr8
-rw-r--r--src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr8
14 files changed, 97 insertions, 94 deletions
diff --git a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs
index 253057536f1..4e16e8c2c57 100644
--- a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs
+++ b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs
@@ -2,7 +2,7 @@
 
 use crate::infer::error_reporting::nice_region_error::NiceRegionError;
 use crate::infer::lexical_region_resolve::RegionResolutionError;
-use rustc_errors::{Applicability, ErrorReported};
+use rustc_errors::{struct_span_err, Applicability, ErrorReported};
 use rustc_hir::{GenericBound, ItemKind, Lifetime, LifetimeName, TyKind};
 use rustc_middle::ty::RegionKind;
 
@@ -35,10 +35,14 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                     let (lifetime_name, lifetime) = if sup_r.has_name() {
                         (sup_r.to_string(), format!("lifetime `{}`", sup_r))
                     } else {
-                        ("'_".to_owned(), "the anonymous lifetime `'_`".to_string())
+                        ("'_".to_owned(), "an anonymous lifetime `'_`".to_string())
                     };
-                    let mut err =
-                        self.tcx().sess.struct_span_err(sp, "cannot infer an appropriate lifetime");
+                    let mut err = struct_span_err!(
+                        self.tcx().sess,
+                        sp,
+                        E0758,
+                        "cannot infer an appropriate lifetime"
+                    );
                     err.span_label(
                         param_info.param_ty_span,
                         &format!("this data with {}...", lifetime),
@@ -61,10 +65,6 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                             //    |
                             // LL | fn foo(x: &i32) -> Box<dyn Debug> { Box::new(x) }
                             //    |           ----                      ---------^-
-                            //    |           |                         |        |
-                            //    |           |                         |   ...and is captured here
-                            //    |           |           ...is required to be `'static` by this...
-                            //    |           this data with the anonymous lifetime `'_`...
                             //
                             // and instead show:
                             //
@@ -72,25 +72,28 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                             //   --> $DIR/must_outlive_least_region_or_bound.rs:18:50
                             //    |
                             // LL | fn foo(x: &i32) -> Box<dyn Debug> { Box::new(x) }
-                            //    |           ----                               ^ ...is captured here with a `'static` requirement
-                            //    |           |
-                            //    |           this data with the anonymous lifetime `'_`...
-                            //    |
+                            //    |           ----                               ^
                             err.span_label(
                                 sup_origin.span(),
-                                "...is captured here with a `'static` requirement",
+                                "...is captured here requiring it to live as long as `'static`",
                             );
                         } else if sup_origin.span() <= return_sp {
                             err.span_label(sup_origin.span(), "...is captured here...");
-                            err.span_label(return_sp, "...and required to be `'static` by this");
+                            err.span_label(
+                                return_sp,
+                                "...and required to live as long as `'static` by this",
+                            );
                         } else {
-                            err.span_label(return_sp, "...is required to be `'static` by this...");
+                            err.span_label(
+                                return_sp,
+                                "...is required to live as long as `'static` by this...",
+                            );
                             err.span_label(sup_origin.span(), "...and is captured here");
                         }
                     } else {
                         err.span_label(
                             return_sp,
-                            "...is captured and required to be `'static` here",
+                            "...is captured and required live as long as `'static` here",
                         );
                     }
 
diff --git a/src/test/ui/async-await/issues/issue-62097.stderr b/src/test/ui/async-await/issues/issue-62097.stderr
index fff43ae9f47..558d89f9289 100644
--- a/src/test/ui/async-await/issues/issue-62097.stderr
+++ b/src/test/ui/async-await/issues/issue-62097.stderr
@@ -1,13 +1,13 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/issue-62097.rs:12:31
    |
 LL |     pub async fn run_dummy_fn(&self) {
    |                               ^^^^^
    |                               |
-   |                               this data with the anonymous lifetime `'_`...
+   |                               this data with an anonymous lifetime `'_`...
    |                               ...is captured here...
 LL |         foo(|| self.bar()).await;
-   |         --- ...and required to be `'static` by this
+   |         --- ...and required to live as long as `'static` by this
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr
index 82e44cff9cc..eff56ddc440 100644
--- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr
+++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr
@@ -1,24 +1,24 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:3:35
    |
 LL | fn elided(x: &i32) -> impl Copy { x }
    |              ----     ---------   ^ ...and is captured here
    |              |        |
-   |              |        ...is required to be `'static` by this...
-   |              this data with the anonymous lifetime `'_`...
+   |              |        ...is required to live as long as `'static` by this...
+   |              this data with an anonymous lifetime `'_`...
    |
-help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL | fn elided(x: &i32) -> impl Copy + '_ { x }
    |                                 ^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:6:44
    |
 LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
    |                    -------     ---------   ^ ...and is captured here
    |                    |           |
-   |                    |           ...is required to be `'static` by this...
+   |                    |           ...is required to live as long as `'static` by this...
    |                    this data with lifetime `'a`...
    |
 help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for lifetime `'a`
@@ -26,16 +26,16 @@ help: to permit non-static references in an `impl Trait` value, you can add an e
 LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
    |                                          ^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:9:46
    |
 LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
    |               ----     -------------------   ^ ...and is captured here
    |               |        |
-   |               |        ...is required to be `'static` by this...
-   |               this data with the anonymous lifetime `'_`...
+   |               |        ...is required to live as long as `'static` by this...
+   |               this data with an anonymous lifetime `'_`...
    |
-help: consider changing the `impl Trait`'s explicit `'static` bound to the anonymous lifetime `'_`
+help: consider changing the `impl Trait`'s explicit `'static` bound to an anonymous lifetime `'_`
    |
 LL | fn elided2(x: &i32) -> impl Copy + '_ { x }
    |                                    ^^
@@ -44,13 +44,13 @@ help: alternatively, set an explicit `'static` lifetime to this parameter
 LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x }
    |               ^^^^^^^^^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:12:55
    |
 LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
    |                     -------     -------------------   ^ ...and is captured here
    |                     |           |
-   |                     |           ...is required to be `'static` by this...
+   |                     |           ...is required to live as long as `'static` by this...
    |                     this data with lifetime `'a`...
    |
 help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a`
@@ -70,13 +70,13 @@ LL | fn foo<'a>(x: &i32) -> impl Copy + 'a { x }
    |               |
    |               help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:33:69
    |
 LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
    |                      -------     --------------------------------   ^ ...and is captured here
    |                      |           |
-   |                      |           ...is required to be `'static` by this...
+   |                      |           ...is required to live as long as `'static` by this...
    |                      this data with lifetime `'a`...
    |
 help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a`
@@ -105,24 +105,24 @@ LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
    |                                 |
    |                                 help: consider adding an explicit lifetime bound...: `T: 'static +`
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:18:50
    |
 LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) }
-   |               ----                               ^ ...is captured here with a `'static` requirement
+   |               ----                               ^ ...is captured here requiring it to live as long as `'static`
    |               |
-   |               this data with the anonymous lifetime `'_`...
+   |               this data with an anonymous lifetime `'_`...
    |
-help: to permit non-static references in a trait object value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in a trait object value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL | fn elided3(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
    |                                      ^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:21:59
    |
 LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) }
-   |                     -------                               ^ ...is captured here with a `'static` requirement
+   |                     -------                               ^ ...is captured here requiring it to live as long as `'static`
    |                     |
    |                     this data with lifetime `'a`...
    |
@@ -131,15 +131,15 @@ help: to permit non-static references in a trait object value, you can add an ex
 LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
    |                                               ^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:24:60
    |
 LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) }
-   |               ----                                         ^ ...is captured here with a `'static` requirement
+   |               ----                                         ^ ...is captured here requiring it to live as long as `'static`
    |               |
-   |               this data with the anonymous lifetime `'_`...
+   |               this data with an anonymous lifetime `'_`...
    |
-help: consider changing the trait object's explicit `'static` bound to the anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
    |
 LL | fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
    |                                        ^^
@@ -148,11 +148,11 @@ help: alternatively, set an explicit `'static` lifetime in this parameter
 LL | fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
    |               ^^^^^^^^^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/must_outlive_least_region_or_bound.rs:27:69
    |
 LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) }
-   |                     ------- this data with lifetime `'a`...         ^ ...is captured here with a `'static` requirement
+   |                     ------- this data with lifetime `'a`...         ^ ...is captured here requiring it to live as long as `'static`
    |
 help: consider changing the trait object's explicit `'static` bound to lifetime `'a`
    |
diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.stderr
index 67d4f60dff6..a48580ee2d2 100644
--- a/src/test/ui/impl-trait/static-return-lifetime-infered.stderr
+++ b/src/test/ui/impl-trait/static-return-lifetime-infered.stderr
@@ -1,25 +1,25 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/static-return-lifetime-infered.rs:7:16
    |
 LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
-   |                         -----     ----------------------- ...is required to be `'static` by this...
+   |                         -----     ----------------------- ...is required to live as long as `'static` by this...
    |                         |
-   |                         this data with the anonymous lifetime `'_`...
+   |                         this data with an anonymous lifetime `'_`...
 LL |         self.x.iter().map(|a| a.0)
    |         ------ ^^^^
    |         |
    |         ...and is captured here
    |
-help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
    |                                                           ^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/static-return-lifetime-infered.rs:11:16
    |
 LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
-   |                        --------     ----------------------- ...is required to be `'static` by this...
+   |                        --------     ----------------------- ...is required to live as long as `'static` by this...
    |                        |
    |                        this data with lifetime `'a`...
 LL |         self.x.iter().map(|a| a.0)
diff --git a/src/test/ui/issues/issue-16922.stderr b/src/test/ui/issues/issue-16922.stderr
index a254343cd1b..53fd658800a 100644
--- a/src/test/ui/issues/issue-16922.stderr
+++ b/src/test/ui/issues/issue-16922.stderr
@@ -1,12 +1,12 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/issue-16922.rs:4:14
    |
 LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
-   |                       -- this data with the anonymous lifetime `'_`...
+   |                       -- this data with an anonymous lifetime `'_`...
 LL |     Box::new(value) as Box<dyn Any>
-   |              ^^^^^ ...is captured here with a `'static` requirement
+   |              ^^^^^ ...is captured here requiring it to live as long as `'static`
    |
-help: to permit non-static references in a trait object value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in a trait object value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> {
    |                                          ^^^^
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr
index 6edef8086b9..04a06104faf 100644
--- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr
@@ -1,13 +1,13 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/object-lifetime-default-from-box-error.rs:18:5
    |
 LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
-   |             --------------- this data with the anonymous lifetime `'_`...
+   |             --------------- this data with an anonymous lifetime `'_`...
 ...
 LL |     ss.r
-   |     ^^^^ ...is captured and required to be `'static` here
+   |     ^^^^ ...is captured and required live as long as `'static` here
    |
-help: to permit non-static references in a trait object value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in a trait object value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait + '_> {
    |                                                   ^^^^
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
index 97d1f3579fc..34cf131319a 100644
--- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
+++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
@@ -1,12 +1,12 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/region-object-lifetime-in-coercion.rs:8:46
    |
 LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> {
-   |         ----- this data with the anonymous lifetime `'_`...
+   |         ----- this data with an anonymous lifetime `'_`...
 LL |     let x: Box<dyn Foo + 'static> = Box::new(v);
-   |                                              ^ ...is captured here with a `'static` requirement
+   |                                              ^ ...is captured here requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to the anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
    |
 LL | fn a(v: &[u8]) -> Box<dyn Foo + '_> {
    |                                 ^^
@@ -15,15 +15,15 @@ help: alternatively, set an explicit `'static` lifetime in this parameter
 LL | fn a(v: &'static [u8]) -> Box<dyn Foo + 'static> {
    |         ^^^^^^^^^^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/region-object-lifetime-in-coercion.rs:13:14
    |
 LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
-   |         ----- this data with the anonymous lifetime `'_`...
+   |         ----- this data with an anonymous lifetime `'_`...
 LL |     Box::new(v)
-   |              ^ ...is captured here with a `'static` requirement
+   |              ^ ...is captured here requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to the anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
    |
 LL | fn b(v: &[u8]) -> Box<dyn Foo + '_> {
    |                                 ^^
@@ -32,16 +32,16 @@ help: alternatively, set an explicit `'static` lifetime in this parameter
 LL | fn b(v: &'static [u8]) -> Box<dyn Foo + 'static> {
    |         ^^^^^^^^^^^^^
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/region-object-lifetime-in-coercion.rs:19:14
    |
 LL | fn c(v: &[u8]) -> Box<dyn Foo> {
-   |         ----- this data with the anonymous lifetime `'_`...
+   |         ----- this data with an anonymous lifetime `'_`...
 ...
 LL |     Box::new(v)
-   |              ^ ...is captured here with a `'static` requirement
+   |              ^ ...is captured here requiring it to live as long as `'static`
    |
-help: to permit non-static references in a trait object value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in a trait object value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL | fn c(v: &[u8]) -> Box<dyn Foo + '_> {
    |                               ^^^^
diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr
index 3d707f2d999..be47ef589af 100644
--- a/src/test/ui/regions/regions-close-object-into-object-2.stderr
+++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr
@@ -1,10 +1,10 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/regions-close-object-into-object-2.rs:10:11
    |
 LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
    |                         ------------------ this data with lifetime `'a`...
 LL |     box B(&*v) as Box<dyn X>
-   |           ^^^ ...is captured here with a `'static` requirement
+   |           ^^^ ...is captured here requiring it to live as long as `'static`
    |
 help: consider changing the trait object's explicit `'static` bound to lifetime `'a`
    |
diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr
index 70282c8cbdb..1b099c7d8bd 100644
--- a/src/test/ui/regions/regions-close-object-into-object-4.stderr
+++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr
@@ -1,10 +1,10 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/regions-close-object-into-object-4.rs:10:11
    |
 LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
    |                   ---------------- this data with lifetime `'a`...
 LL |     box B(&*v) as Box<dyn X>
-   |           ^^^ ...is captured here with a `'static` requirement
+   |           ^^^ ...is captured here requiring it to live as long as `'static`
    |
 help: consider changing the trait object's explicit `'static` bound to lifetime `'a`
    |
diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr
index 8f93fad7fe9..e8baf44bd10 100644
--- a/src/test/ui/regions/regions-proc-bound-capture.stderr
+++ b/src/test/ui/regions/regions-proc-bound-capture.stderr
@@ -1,13 +1,13 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/regions-proc-bound-capture.rs:9:14
    |
 LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + 'static> {
-   |                   ------ this data with the anonymous lifetime `'_`...
+   |                   ------ this data with an anonymous lifetime `'_`...
 LL |     // This is illegal, because the region bound on `proc` is 'static.
 LL |     Box::new(move || { *x })
-   |              ^^^^^^^^^^^^^^ ...is captured here with a `'static` requirement
+   |              ^^^^^^^^^^^^^^ ...is captured here requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to the anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
    |
 LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + '_> {
    |                                                           ^^
diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr
index 5520341b5b1..92e1473a5da 100644
--- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr
+++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr
@@ -1,10 +1,10 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:16
    |
 LL |     async fn f(self: Pin<&Self>) -> impl Clone { self }
-   |                ^^^^  ----------     ---------- ...and required to be `'static` by this
+   |                ^^^^  ----------     ---------- ...and required to live as long as `'static` by this
    |                |     |
-   |                |     this data with the anonymous lifetime `'_`...
+   |                |     this data with an anonymous lifetime `'_`...
    |                ...is captured here...
 
 error: aborting due to previous error
diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr
index 5374929f3a4..6721d41bb73 100644
--- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr
+++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr
@@ -1,13 +1,13 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait.rs:6:44
    |
 LL |     fn f(self: Pin<&Self>) -> impl Clone { self }
    |                ----------     ----------   ^^^^ ...and is captured here
    |                |              |
-   |                |              ...is required to be `'static` by this...
-   |                this data with the anonymous lifetime `'_`...
+   |                |              ...is required to live as long as `'static` by this...
+   |                this data with an anonymous lifetime `'_`...
    |
-help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL |     fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
    |                                          ^^^^
diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
index 471f3cd14aa..ba56255af5b 100644
--- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
+++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
@@ -6,20 +6,20 @@ LL | fn baz<G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
    |        |
    |        help: consider introducing lifetime `'a` here: `'a,`
 
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/missing-lifetimes-in-signature.rs:19:5
    |
 LL |   fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce()
-   |                            ------     ------------- ...is required to be `'static` by this...
+   |                            ------     ------------- ...is required to live as long as `'static` by this...
    |                            |
-   |                            this data with the anonymous lifetime `'_`...
+   |                            this data with an anonymous lifetime `'_`...
 ...
 LL | /     move || {
 LL | |         *dest = g.get();
 LL | |     }
    | |_____^ ...and is captured here
    |
-help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
    |                                                   ^^^^
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
index 5fd03f9770e..20d3640d411 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
@@ -1,13 +1,13 @@
-error: cannot infer an appropriate lifetime
+error[E0758]: cannot infer an appropriate lifetime
   --> $DIR/dyn-trait-underscore.rs:8:20
    |
 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
-   |                ---- this data with the anonymous lifetime `'_`...
+   |                ---- this data with an anonymous lifetime `'_`...
 LL |     //                      ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
 LL |     Box::new(items.iter())
-   |     ---------------^^^^--- ...is captured and required to be `'static` here
+   |     ---------------^^^^--- ...is captured and required live as long as `'static` here
    |
-help: to permit non-static references in a trait object value, you can add an explicit bound for the anonymous lifetime `'_`
+help: to permit non-static references in a trait object value, you can add an explicit bound for an anonymous lifetime `'_`
    |
 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> {
    |                                                   ^^^^