about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs58
-rw-r--r--src/test/ui/async-await/issues/issue-62097.stderr2
-rw-r--r--src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr46
-rw-r--r--src/test/ui/impl-trait/static-return-lifetime-infered.stderr8
-rw-r--r--src/test/ui/issues/issue-16922.stderr4
-rw-r--r--src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr2
-rw-r--r--src/test/ui/regions/region-object-lifetime-in-coercion.stderr16
-rw-r--r--src/test/ui/regions/regions-close-object-into-object-2.stderr6
-rw-r--r--src/test/ui/regions/regions-close-object-into-object-4.stderr6
-rw-r--r--src/test/ui/regions/regions-proc-bound-capture.stderr6
-rw-r--r--src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr2
-rw-r--r--src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr4
-rw-r--r--src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr4
-rw-r--r--src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr2
14 files changed, 85 insertions, 81 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 4e16e8c2c57..86f310eb71d 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
@@ -75,18 +75,18 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                             //    |           ----                               ^
                             err.span_label(
                                 sup_origin.span(),
-                                "...is captured here requiring it to live as long as `'static`",
+                                "...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 live as long as `'static` by this",
+                                "...and is required to live as long as `'static` here",
                             );
                         } else {
                             err.span_label(
                                 return_sp,
-                                "...is required to live as long as `'static` by this...",
+                                "...is required to live as long as `'static` here...",
                             );
                             err.span_label(sup_origin.span(), "...and is captured here");
                         }
@@ -101,6 +101,20 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                     // explicit non-desugar'able return.
                     if fn_return.span.desugaring_kind().is_none() {
                         // FIXME: account for the need of parens in `&(dyn Trait + '_)`
+
+                        let consider = "consider changing the";
+                        let declare = "to declare that the";
+                        let arg = match param_info.param.pat.simple_ident() {
+                            Some(simple_ident) => format!("argument `{}`", simple_ident),
+                            None => "the argument".to_string(),
+                        };
+                        let explicit =
+                            format!("you can add an explicit `{}` lifetime bound", lifetime_name);
+                        let explicit_static = format!("explicit `'static` bound to {}", arg);
+                        let captures = format!("captures data from {}", arg);
+                        let add_static_bound =
+                            "alternatively, add an explicit `'static` bound to this reference";
+                        let plus_lt = format!(" + {}", lifetime_name);
                         match fn_return.kind {
                             TyKind::Def(item_id, _) => {
                                 let item = self.tcx().hir().item(item_id.id);
@@ -126,18 +140,13 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                                 {
                                     err.span_suggestion_verbose(
                                         span,
-                                        &format!(
-                                            "consider changing the `impl Trait`'s explicit \
-                                             `'static` bound to {}",
-                                            lifetime,
-                                        ),
+                                        &format!("{} `impl Trait`'s {}", consider, explicit_static),
                                         lifetime_name,
                                         Applicability::MaybeIncorrect,
                                     );
                                     err.span_suggestion_verbose(
                                         param_info.param_ty_span,
-                                        "alternatively, set an explicit `'static` lifetime to \
-                                         this parameter",
+                                        add_static_bound,
                                         param_info.param_ty.to_string(),
                                         Applicability::MaybeIncorrect,
                                     );
@@ -145,11 +154,12 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                                     err.span_suggestion_verbose(
                                         fn_return.span.shrink_to_hi(),
                                         &format!(
-                                            "to permit non-static references in an `impl Trait` \
-                                             value, you can add an explicit bound for {}",
-                                            lifetime,
+                                            "{declare} `impl Trait` {captures}, {explicit}",
+                                            declare = declare,
+                                            captures = captures,
+                                            explicit = explicit,
                                         ),
-                                        format!(" + {}", lifetime_name),
+                                        plus_lt,
                                         Applicability::MaybeIncorrect,
                                     );
                                 };
@@ -159,31 +169,25 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
                                     err.span_suggestion_verbose(
                                         fn_return.span.shrink_to_hi(),
                                         &format!(
-                                            "to permit non-static references in a trait object \
-                                             value, you can add an explicit bound for {}",
-                                            lifetime,
+                                            "{declare} trait object {captures}, {explicit}",
+                                            declare = declare,
+                                            captures = captures,
+                                            explicit = explicit,
                                         ),
-                                        format!(" + {}", lifetime_name),
+                                        plus_lt,
                                         Applicability::MaybeIncorrect,
                                     );
                                 }
                                 _ => {
                                     err.span_suggestion_verbose(
                                         lt.span,
-                                        &format!(
-                                            "consider changing the trait object's explicit \
-                                             `'static` bound to {}",
-                                            lifetime,
-                                        ),
+                                        &format!("{} trait object's {}", consider, explicit_static),
                                         lifetime_name,
                                         Applicability::MaybeIncorrect,
                                     );
                                     err.span_suggestion_verbose(
                                         param_info.param_ty_span,
-                                        &format!(
-                                            "alternatively, set an explicit `'static` lifetime \
-                                             in this parameter",
-                                        ),
+                                        add_static_bound,
                                         param_info.param_ty.to_string(),
                                         Applicability::MaybeIncorrect,
                                     );
diff --git a/src/test/ui/async-await/issues/issue-62097.stderr b/src/test/ui/async-await/issues/issue-62097.stderr
index 558d89f9289..e9f155c6ced 100644
--- a/src/test/ui/async-await/issues/issue-62097.stderr
+++ b/src/test/ui/async-await/issues/issue-62097.stderr
@@ -7,7 +7,7 @@ LL |     pub async fn run_dummy_fn(&self) {
    |                               this data with an anonymous lifetime `'_`...
    |                               ...is captured here...
 LL |         foo(|| self.bar()).await;
-   |         --- ...and required to live as long as `'static` by this
+   |         --- ...and is required to live as long as `'static` here
 
 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 eff56ddc440..a9fa0e93fed 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
@@ -4,10 +4,10 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn elided(x: &i32) -> impl Copy { x }
    |              ----     ---------   ^ ...and is captured here
    |              |        |
-   |              |        ...is required to live as long as `'static` by this...
+   |              |        ...is required to live as long as `'static` here...
    |              this data with an anonymous lifetime `'_`...
    |
-help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for an anonymous lifetime `'_`
+help: to declare that the `impl Trait` captures data from argument `x`, you can add an explicit `'_` lifetime bound
    |
 LL | fn elided(x: &i32) -> impl Copy + '_ { x }
    |                                 ^^^^
@@ -18,10 +18,10 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
    |                    -------     ---------   ^ ...and is captured here
    |                    |           |
-   |                    |           ...is required to live as long as `'static` by this...
+   |                    |           ...is required to live as long as `'static` here...
    |                    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`
+help: to declare that the `impl Trait` captures data from argument `x`, you can add an explicit `'a` lifetime bound
    |
 LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
    |                                          ^^^^
@@ -32,14 +32,14 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
    |               ----     -------------------   ^ ...and is captured here
    |               |        |
-   |               |        ...is required to live as long as `'static` by this...
+   |               |        ...is required to live as long as `'static` here...
    |               this data with an anonymous lifetime `'_`...
    |
-help: consider changing the `impl Trait`'s explicit `'static` bound to an anonymous lifetime `'_`
+help: consider changing the `impl Trait`'s explicit `'static` bound to argument `x`
    |
 LL | fn elided2(x: &i32) -> impl Copy + '_ { x }
    |                                    ^^
-help: alternatively, set an explicit `'static` lifetime to this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x }
    |               ^^^^^^^^^^^^
@@ -50,14 +50,14 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
    |                     -------     -------------------   ^ ...and is captured here
    |                     |           |
-   |                     |           ...is required to live as long as `'static` by this...
+   |                     |           ...is required to live as long as `'static` here...
    |                     this data with lifetime `'a`...
    |
-help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a`
+help: consider changing the `impl Trait`'s explicit `'static` bound to argument `x`
    |
 LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'a { x }
    |                                             ^^
-help: alternatively, set an explicit `'static` lifetime to this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn explicit2<'a>(x: &'static i32) -> impl Copy + 'static { x }
    |                     ^^^^^^^^^^^^
@@ -76,14 +76,14 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
    |                      -------     --------------------------------   ^ ...and is captured here
    |                      |           |
-   |                      |           ...is required to live as long as `'static` by this...
+   |                      |           ...is required to live as long as `'static` here...
    |                      this data with lifetime `'a`...
    |
-help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a`
+help: consider changing the `impl Trait`'s explicit `'static` bound to argument `x`
    |
 LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'a { x }
    |                                                           ^^
-help: alternatively, set an explicit `'static` lifetime to this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x }
    |                      ^^^^^^^^^^^^
@@ -109,11 +109,11 @@ 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 requiring it to live as long as `'static`
+   |               ----                               ^ ...is captured here, requiring it to live as long as `'static`
    |               |
    |               this data with an anonymous lifetime `'_`...
    |
-help: to permit non-static references in a trait object value, you can add an explicit bound for an anonymous lifetime `'_`
+help: to declare that the trait object captures data from argument `x`, you can add an explicit `'_` lifetime bound
    |
 LL | fn elided3(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
    |                                      ^^^^
@@ -122,11 +122,11 @@ 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 requiring it to live as long as `'static`
+   |                     -------                               ^ ...is captured here, requiring it to live as long as `'static`
    |                     |
    |                     this data with lifetime `'a`...
    |
-help: to permit non-static references in a trait object value, you can add an explicit bound for lifetime `'a`
+help: to declare that the trait object captures data from argument `x`, you can add an explicit `'a` lifetime bound
    |
 LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
    |                                               ^^^^
@@ -135,15 +135,15 @@ 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 requiring it to live as long as `'static`
+   |               ----                                         ^ ...is captured here, requiring it to live as long as `'static`
    |               |
    |               this data with an anonymous lifetime `'_`...
    |
-help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to argument `x`
    |
 LL | fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
    |                                        ^^
-help: alternatively, set an explicit `'static` lifetime in this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
    |               ^^^^^^^^^^^^
@@ -152,13 +152,13 @@ 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 requiring it to live as long as `'static`
+   |                     ------- 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`
+help: consider changing the trait object's explicit `'static` bound to argument `x`
    |
 LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
    |                                                 ^^
-help: alternatively, set an explicit `'static` lifetime in this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn explicit4<'a>(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
    |                     ^^^^^^^^^^^^
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 a48580ee2d2..6681eaa909e 100644
--- a/src/test/ui/impl-trait/static-return-lifetime-infered.stderr
+++ b/src/test/ui/impl-trait/static-return-lifetime-infered.stderr
@@ -2,7 +2,7 @@ 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 live as long as `'static` by this...
+   |                         -----     ----------------------- ...is required to live as long as `'static` here...
    |                         |
    |                         this data with an anonymous lifetime `'_`...
 LL |         self.x.iter().map(|a| a.0)
@@ -10,7 +10,7 @@ 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 an anonymous lifetime `'_`
+help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound
    |
 LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
    |                                                           ^^^^
@@ -19,7 +19,7 @@ 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 live as long as `'static` by this...
+   |                        --------     ----------------------- ...is required to live as long as `'static` here...
    |                        |
    |                        this data with lifetime `'a`...
 LL |         self.x.iter().map(|a| a.0)
@@ -27,7 +27,7 @@ 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 lifetime `'a`
+help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'a` lifetime bound
    |
 LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
    |                                                             ^^^^
diff --git a/src/test/ui/issues/issue-16922.stderr b/src/test/ui/issues/issue-16922.stderr
index 53fd658800a..95f46bd7f3e 100644
--- a/src/test/ui/issues/issue-16922.stderr
+++ b/src/test/ui/issues/issue-16922.stderr
@@ -4,9 +4,9 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
    |                       -- this data with an anonymous lifetime `'_`...
 LL |     Box::new(value) as Box<dyn Any>
-   |              ^^^^^ ...is captured here requiring it to live as long as `'static`
+   |              ^^^^^ ...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 an anonymous lifetime `'_`
+help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound
    |
 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 04a06104faf..e585db262f2 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
@@ -7,7 +7,7 @@ LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
 LL |     ss.r
    |     ^^^^ ...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 an anonymous lifetime `'_`
+help: to declare that the trait object captures data from argument `ss`, you can add an explicit `'_` lifetime bound
    |
 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 34cf131319a..8d048d90cb3 100644
--- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
+++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
@@ -4,13 +4,13 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> {
    |         ----- this data with an anonymous lifetime `'_`...
 LL |     let x: Box<dyn Foo + 'static> = Box::new(v);
-   |                                              ^ ...is captured here requiring it to live as long as `'static`
+   |                                              ^ ...is captured here, requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to argument `v`
    |
 LL | fn a(v: &[u8]) -> Box<dyn Foo + '_> {
    |                                 ^^
-help: alternatively, set an explicit `'static` lifetime in this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn a(v: &'static [u8]) -> Box<dyn Foo + 'static> {
    |         ^^^^^^^^^^^^^
@@ -21,13 +21,13 @@ error[E0758]: cannot infer an appropriate lifetime
 LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
    |         ----- this data with an anonymous lifetime `'_`...
 LL |     Box::new(v)
-   |              ^ ...is captured here requiring it to live as long as `'static`
+   |              ^ ...is captured here, requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to argument `v`
    |
 LL | fn b(v: &[u8]) -> Box<dyn Foo + '_> {
    |                                 ^^
-help: alternatively, set an explicit `'static` lifetime in this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn b(v: &'static [u8]) -> Box<dyn Foo + 'static> {
    |         ^^^^^^^^^^^^^
@@ -39,9 +39,9 @@ LL | fn c(v: &[u8]) -> Box<dyn Foo> {
    |         ----- this data with an anonymous lifetime `'_`...
 ...
 LL |     Box::new(v)
-   |              ^ ...is captured here requiring it to live as long as `'static`
+   |              ^ ...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 an anonymous lifetime `'_`
+help: to declare that the trait object captures data from argument `v`, you can add an explicit `'_` lifetime bound
    |
 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 be47ef589af..5dfe384112b 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
@@ -4,13 +4,13 @@ error[E0758]: cannot infer an appropriate lifetime
 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 requiring it to live as long as `'static`
+   |           ^^^ ...is captured here, requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to lifetime `'a`
+help: consider changing the trait object's explicit `'static` bound to argument `v`
    |
 LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'a> {
    |                                                            ^^
-help: alternatively, set an explicit `'static` lifetime in this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn g<'a, T: 'static>(v: std::boxed::Box<(dyn A<T> + 'static)>) -> Box<dyn X + 'static> {
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 1b099c7d8bd..4d23118ba06 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
@@ -4,13 +4,13 @@ error[E0758]: cannot infer an appropriate lifetime
 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 requiring it to live as long as `'static`
+   |           ^^^ ...is captured here, requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to lifetime `'a`
+help: consider changing the trait object's explicit `'static` bound to argument `v`
    |
 LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'a> {
    |                                                    ^^
-help: alternatively, set an explicit `'static` lifetime in this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn i<'a, T, U>(v: std::boxed::Box<(dyn A<U> + 'static)>) -> Box<dyn X + 'static> {
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr
index e8baf44bd10..e36f77ec1da 100644
--- a/src/test/ui/regions/regions-proc-bound-capture.stderr
+++ b/src/test/ui/regions/regions-proc-bound-capture.stderr
@@ -5,13 +5,13 @@ LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + 'static> {
    |                   ------ 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 requiring it to live as long as `'static`
+   |              ^^^^^^^^^^^^^^ ...is captured here, requiring it to live as long as `'static`
    |
-help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
+help: consider changing the trait object's explicit `'static` bound to argument `x`
    |
 LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + '_> {
    |                                                           ^^
-help: alternatively, set an explicit `'static` lifetime in this parameter
+help: alternatively, add an explicit `'static` bound to this reference
    |
 LL | fn static_proc(x: &'static isize) -> Box<dyn FnMut() -> (isize) + 'static> {
    |                   ^^^^^^^^^^^^^^
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 92e1473a5da..365e38515b1 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
@@ -2,7 +2,7 @@ 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 live as long as `'static` by this
+   |                ^^^^  ----------     ---------- ...and is required to live as long as `'static` here
    |                |     |
    |                |     this data with an anonymous lifetime `'_`...
    |                ...is captured here...
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 6721d41bb73..bd3f3efad82 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
@@ -4,10 +4,10 @@ error[E0758]: cannot infer an appropriate lifetime
 LL |     fn f(self: Pin<&Self>) -> impl Clone { self }
    |                ----------     ----------   ^^^^ ...and is captured here
    |                |              |
-   |                |              ...is required to live as long as `'static` by this...
+   |                |              ...is required to live as long as `'static` here...
    |                this data with an anonymous lifetime `'_`...
    |
-help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for an anonymous lifetime `'_`
+help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound
    |
 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 ba56255af5b..d96a5f961bd 100644
--- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
+++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
@@ -10,7 +10,7 @@ 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 live as long as `'static` by this...
+   |                            ------     ------------- ...is required to live as long as `'static` here...
    |                            |
    |                            this data with an anonymous lifetime `'_`...
 ...
@@ -19,7 +19,7 @@ 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 an anonymous lifetime `'_`
+help: to declare that the `impl Trait` captures data from argument `dest`, you can add an explicit `'_` lifetime bound
    |
 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 20d3640d411..7c649f9c08d 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
@@ -7,7 +7,7 @@ LL |     //                      ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to
 LL |     Box::new(items.iter())
    |     ---------------^^^^--- ...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 an anonymous lifetime `'_`
+help: to declare that the trait object captures data from argument `items`, you can add an explicit `'_` lifetime bound
    |
 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> {
    |                                                   ^^^^