1
Fork 0

Tweak wording

This commit is contained in:
Esteban Kuber 2021-10-15 15:13:21 +00:00
parent ff13ad710f
commit 83ce1aad42
21 changed files with 50 additions and 50 deletions

View file

@ -76,7 +76,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
err.span_label( err.span_label(
cause.span, cause.span,
&format!( &format!(
"...is captured and required to live as long as `'static` here \ "...is used and required to live as long as `'static` here \
because of an implicit lifetime bound on the {}", because of an implicit lifetime bound on the {}",
match ctxt.assoc_item.container { match ctxt.assoc_item.container {
AssocItemContainer::TraitContainer(id) => AssocItemContainer::TraitContainer(id) =>
@ -158,7 +158,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
// We try to make the output have fewer overlapping spans if possible. // We try to make the output have fewer overlapping spans if possible.
let require_msg = if spans.is_empty() { let require_msg = if spans.is_empty() {
"...is captured and required to live as long as `'static` here" "...is used and required to live as long as `'static` here"
} else { } else {
"...and is required to live as long as `'static` here" "...and is required to live as long as `'static` here"
}; };
@ -166,7 +166,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
if sup_origin.span().overlaps(return_sp) { sup_origin.span() } else { return_sp }; if sup_origin.span().overlaps(return_sp) { sup_origin.span() } else { return_sp };
for span in &spans { for span in &spans {
err.span_label(*span, "...is captured here..."); err.span_label(*span, "...is used here...");
} }
if spans.iter().any(|sp| sp.overlaps(return_sp) || *sp > return_sp) { if spans.iter().any(|sp| sp.overlaps(return_sp) || *sp > return_sp) {

View file

@ -4,7 +4,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 { LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
| ------- this data with lifetime `'a`... | ------- this data with lifetime `'a`...
LL | bar(foo, x) LL | bar(foo, x)
| ^^^ - ...is captured and required to live as long as `'static` here | ^^^ - ...is used and required to live as long as `'static` here
error: aborting due to previous error error: aborting due to previous error

View file

@ -5,7 +5,7 @@ LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
| -------- this data with lifetime `'a`... | -------- this data with lifetime `'a`...
... ...
LL | bar(foo, x) LL | bar(foo, x)
| ^^^ - ...is captured and required to live as long as `'static` here | ^^^ - ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/project-fn-ret-invariant.rs:45:37 --> $DIR/project-fn-ret-invariant.rs:45:37

View file

@ -4,7 +4,7 @@ error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'
LL | pub async fn run_dummy_fn(&self) { LL | pub async fn run_dummy_fn(&self) {
| ^^^^^ this data with an anonymous lifetime `'_`... | ^^^^^ this data with an anonymous lifetime `'_`...
LL | foo(|| self.bar()).await; LL | foo(|| self.bar()).await;
| --- ...is captured and required to live as long as `'static` here | --- ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by this bound note: `'static` lifetime requirement introduced by this bound
--> $DIR/issue-62097.rs:4:19 --> $DIR/issue-62097.rs:4:19

View file

@ -11,7 +11,7 @@ impl Problem {
//~^ NOTE this data with an anonymous lifetime `'_` //~^ NOTE this data with an anonymous lifetime `'_`
//~| NOTE in this expansion of desugaring of `async` block or function //~| NOTE in this expansion of desugaring of `async` block or function
require_static(async move { //~ NOTE ...and is required to live as long as `'static` here require_static(async move { //~ NOTE ...and is required to live as long as `'static` here
&self; //~ NOTE ...is captured here... &self; //~ NOTE ...is used here...
}); });
} }
} }

View file

@ -5,7 +5,7 @@ LL | pub async fn start(&self) {
| ^^^^^ this data with an anonymous lifetime `'_`... | ^^^^^ this data with an anonymous lifetime `'_`...
... ...
LL | &self; LL | &self;
| ----- ...is captured here... | ----- ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/issue-72312.rs:13:9 --> $DIR/issue-72312.rs:13:9

View file

@ -4,7 +4,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) { LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
| ------------------- this data with lifetime `'a`... | ------------------- this data with lifetime `'a`...
LL | static_val(x); LL | static_val(x);
| ^ ...is captured here... | ^ ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/dyn-trait.rs:20:5 --> $DIR/dyn-trait.rs:20:5

View file

@ -28,7 +28,7 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
--> $DIR/must_outlive_least_region_or_bound.rs:9:46 --> $DIR/must_outlive_least_region_or_bound.rs:9:46
| |
LL | fn elided2(x: &i32) -> impl Copy + 'static { x } LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
| ---- ^ ...is captured here... | ---- ^ ...is used here...
| | | |
| this data with an anonymous lifetime `'_`... | this data with an anonymous lifetime `'_`...
| |
@ -50,7 +50,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
--> $DIR/must_outlive_least_region_or_bound.rs:11:55 --> $DIR/must_outlive_least_region_or_bound.rs:11:55
| |
LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x } LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
| ------- ^ ...is captured here... | ------- ^ ...is used here...
| | | |
| this data with lifetime `'a`... | this data with lifetime `'a`...
| |
@ -80,7 +80,7 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
--> $DIR/must_outlive_least_region_or_bound.rs:24:65 --> $DIR/must_outlive_least_region_or_bound.rs:24:65
| |
LL | fn elided5(x: &i32) -> (Box<dyn Debug>, impl Debug) { (Box::new(x), x) } LL | fn elided5(x: &i32) -> (Box<dyn Debug>, impl Debug) { (Box::new(x), x) }
| ---- this data with an anonymous lifetime `'_`... ^ ...is captured and required to live as long as `'static` here | ---- this data with an anonymous lifetime `'_`... ^ ...is used and required to live as long as `'static` here
| |
help: to declare that the trait object captures data from argument `x`, you can add an explicit `'_` lifetime bound help: to declare that the trait object captures data from argument `x`, you can add an explicit `'_` lifetime bound
| |
@ -95,7 +95,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
--> $DIR/must_outlive_least_region_or_bound.rs:29:69 --> $DIR/must_outlive_least_region_or_bound.rs:29:69
| |
LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
| ------- this data with lifetime `'a`... ^ ...is captured here... | ------- this data with lifetime `'a`... ^ ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/must_outlive_least_region_or_bound.rs:29:34 --> $DIR/must_outlive_least_region_or_bound.rs:29:34
@ -136,12 +136,12 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
--> $DIR/must_outlive_least_region_or_bound.rs:16:50 --> $DIR/must_outlive_least_region_or_bound.rs:16:50
| |
LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) } LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) }
| ---- ^ ...is captured and required to live as long as `'static` here | ---- ^ ...is used and required to live as long as `'static` here
| | | |
| this data with an anonymous lifetime `'_`... | this data with an anonymous lifetime `'_`...
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/must_outlive_least_region_or_bound.rs:14:28 --> $DIR/must_outlive_least_region_or_bound.rs:16:28
| |
LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) } LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) }
| ^^^^^^^^^ ----------- because of this returned expression | ^^^^^^^^^ ----------- because of this returned expression
@ -156,12 +156,12 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
--> $DIR/must_outlive_least_region_or_bound.rs:18:59 --> $DIR/must_outlive_least_region_or_bound.rs:18:59
| |
LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) } LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) }
| ------- ^ ...is captured and required to live as long as `'static` here | ------- ^ ...is used and required to live as long as `'static` here
| | | |
| this data with lifetime `'a`... | this data with lifetime `'a`...
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/must_outlive_least_region_or_bound.rs:16:37 --> $DIR/must_outlive_least_region_or_bound.rs:18:37
| |
LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) } LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) }
| ^^^^^^^^^ ----------- because of this returned expression | ^^^^^^^^^ ----------- because of this returned expression
@ -176,12 +176,12 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
--> $DIR/must_outlive_least_region_or_bound.rs:20:60 --> $DIR/must_outlive_least_region_or_bound.rs:20:60
| |
LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) } LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) }
| ---- ^ ...is captured and required to live as long as `'static` here | ---- ^ ...is used and required to live as long as `'static` here
| | | |
| this data with an anonymous lifetime `'_`... | this data with an anonymous lifetime `'_`...
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/must_outlive_least_region_or_bound.rs:18:40 --> $DIR/must_outlive_least_region_or_bound.rs:20:40
| |
LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) } LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) }
| ^^^^^^^ ----------- because of this returned expression | ^^^^^^^ ----------- because of this returned expression
@ -200,10 +200,10 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
--> $DIR/must_outlive_least_region_or_bound.rs:22:69 --> $DIR/must_outlive_least_region_or_bound.rs:22:69
| |
LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) } LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) }
| ------- this data with lifetime `'a`... ^ ...is captured and required to live as long as `'static` here | ------- this data with lifetime `'a`... ^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/must_outlive_least_region_or_bound.rs:20:49 --> $DIR/must_outlive_least_region_or_bound.rs:22:49
| |
LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) } LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) }
| ^^^^^^^ ----------- because of this returned expression | ^^^^^^^ ----------- because of this returned expression

View file

@ -4,7 +4,7 @@ error[E0759]: `value` has an anonymous lifetime `'_` but it needs to satisfy a `
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> { LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
| -- this data with an anonymous lifetime `'_`... | -- this data with an anonymous lifetime `'_`...
LL | Box::new(value) as Box<dyn Any> LL | Box::new(value) as Box<dyn Any>
| ^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^ ...is used and required to live as long as `'static` here
| |
help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound
| |

View file

@ -4,7 +4,7 @@ error[E0759]: `fn` parameter has lifetime `'a` but it needs to satisfy a `'stati
LL | fn foo<'a>(_: &'a u32) -> &'static u32 { LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| ------- this data with lifetime `'a`... | ------- this data with lifetime `'a`...
LL | <Foo<'a>>::C LL | <Foo<'a>>::C
| ^^^^^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
error: aborting due to previous error error: aborting due to previous error

View file

@ -5,7 +5,7 @@ LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
| --------------- this data with an anonymous lifetime `'_`... | --------------- this data with an anonymous lifetime `'_`...
... ...
LL | ss.r LL | ss.r
| ^^^^ ...is captured and required to live as long as `'static` here | ^^^^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/object-lifetime-default-from-box-error.rs:14:37 --> $DIR/object-lifetime-default-from-box-error.rs:14:37

View file

@ -4,7 +4,7 @@ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> { LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> {
| ----- this data with an anonymous lifetime `'_`... | ----- this data with an anonymous lifetime `'_`...
LL | let x: Box<dyn Foo + 'static> = Box::new(v); LL | let x: Box<dyn Foo + 'static> = Box::new(v);
| ^ ...is captured and required to live as long as `'static` here | ^ ...is used and required to live as long as `'static` here
| |
help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v`
| |
@ -21,7 +21,7 @@ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> { LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
| ----- this data with an anonymous lifetime `'_`... | ----- this data with an anonymous lifetime `'_`...
LL | Box::new(v) LL | Box::new(v)
| ^ ...is captured and required to live as long as `'static` here | ^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/region-object-lifetime-in-coercion.rs:12:33 --> $DIR/region-object-lifetime-in-coercion.rs:12:33
@ -46,7 +46,7 @@ LL | fn c(v: &[u8]) -> Box<dyn Foo> {
| ----- this data with an anonymous lifetime `'_`... | ----- this data with an anonymous lifetime `'_`...
... ...
LL | Box::new(v) LL | Box::new(v)
| ^ ...is captured and required to live as long as `'static` here | ^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/region-object-lifetime-in-coercion.rs:16:23 --> $DIR/region-object-lifetime-in-coercion.rs:16:23

View file

@ -4,7 +4,7 @@ error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'
LL | pub fn chase_cat(&mut self) { LL | pub fn chase_cat(&mut self) {
| --------- this data with an anonymous lifetime `'_`... | --------- this data with an anonymous lifetime `'_`...
LL | let p: &'static mut usize = &mut self.cats_chased; LL | let p: &'static mut usize = &mut self.cats_chased;
| ^^^^^^^^^^^^^^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime
LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> { LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
| ------------------ this data with lifetime `'a`... | ------------------ this data with lifetime `'a`...
LL | Box::new(B(&*v)) as Box<dyn X> LL | Box::new(B(&*v)) as Box<dyn X>
| ^^^ ...is captured and required to live as long as `'static` here | ^^^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/regions-close-object-into-object-2.rs:8:60 --> $DIR/regions-close-object-into-object-2.rs:8:60

View file

@ -4,7 +4,7 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime
LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> { LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| ---------------- this data with lifetime `'a`... | ---------------- this data with lifetime `'a`...
LL | Box::new(B(&*v)) as Box<dyn X> LL | Box::new(B(&*v)) as Box<dyn X>
| ^^^ ...is captured and required to live as long as `'static` here | ^^^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/regions-close-object-into-object-4.rs:8:52 --> $DIR/regions-close-object-into-object-4.rs:8:52

View file

@ -5,7 +5,7 @@ LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + 'static> {
| ------ this data with an anonymous lifetime `'_`... | ------ this data with an anonymous lifetime `'_`...
LL | // This is illegal, because the region bound on `proc` is 'static. LL | // This is illegal, because the region bound on `proc` is 'static.
LL | Box::new(move || { *x }) LL | Box::new(move || { *x })
| ^^^^^^^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/regions-proc-bound-capture.rs:7:59 --> $DIR/regions-proc-bound-capture.rs:7:59

View file

@ -22,7 +22,7 @@ error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an impli
LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () { LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
| -------------------------------------- this data with lifetime `'a`... | -------------------------------------- this data with lifetime `'a`...
LL | val.use_self() LL | val.use_self()
| ^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^ ...is used and required to live as long as `'static` here
| |
note: the used `impl` has a `'static` requirement note: the used `impl` has a `'static` requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:60:30 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:60:30

View file

@ -4,7 +4,7 @@ error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifeti
LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> + 'a { LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> + 'a {
| ---------------------- this data with lifetime `'a`... | ---------------------- this data with lifetime `'a`...
LL | val.use_self::<T>() LL | val.use_self::<T>()
| ^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^ ...is used and required to live as long as `'static` here
| |
note: the used `impl` has a `'static` requirement note: the used `impl` has a `'static` requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:14:32 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:14:32
@ -24,7 +24,7 @@ error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an impli
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
| ------------------- this data with lifetime `'a`... | ------------------- this data with lifetime `'a`...
LL | val.use_self() LL | val.use_self()
| ^^^^^^^^ ...is captured and required to live as long as `'static` here because of an implicit lifetime bound on the inherent `impl` | ^^^^^^^^ ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the inherent `impl`
| |
note: the used `impl` has a `'static` requirement note: the used `impl` has a `'static` requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:64:14 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:64:14
@ -44,7 +44,7 @@ error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifeti
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> { LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> {
| ------------------- this data with lifetime `'a`... | ------------------- this data with lifetime `'a`...
LL | val.use_self() LL | val.use_self()
| ^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^ ...is used and required to live as long as `'static` here
| |
note: the used `impl` has a `'static` requirement note: the used `impl` has a `'static` requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:85:26 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:85:26
@ -69,7 +69,7 @@ error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifeti
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
| ------------------- this data with lifetime `'a`... | ------------------- this data with lifetime `'a`...
LL | MyTrait::use_self(val) LL | MyTrait::use_self(val)
| ^^^ ...is captured here... | ^^^ ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:108:9 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:108:9
@ -95,7 +95,7 @@ error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an impli
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () { LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
| ------------------- this data with lifetime `'a`... | ------------------- this data with lifetime `'a`...
LL | val.use_self() LL | val.use_self()
| ^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^ ...is used and required to live as long as `'static` here
| |
note: the used `impl` has a `'static` requirement note: the used `impl` has a `'static` requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:31:26 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:31:26
@ -115,7 +115,7 @@ error[E0772]: `val` has lifetime `'a` but calling `use_self` introduces an impli
LL | fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () { LL | fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
| ----------------------------- this data with lifetime `'a`... | ----------------------------- this data with lifetime `'a`...
LL | val.use_self() LL | val.use_self()
| ^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^ ...is used and required to live as long as `'static` here
| |
note: the used `impl` has a `'static` requirement note: the used `impl` has a `'static` requirement
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:48:30 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:48:30

View file

@ -7,7 +7,7 @@ LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
LL | remaining: self.0.iter(), LL | remaining: self.0.iter(),
| ------ ^^^^ | ------ ^^^^
| | | |
| ...is captured here... | ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:27:23 --> $DIR/trait-object-nested-in-impl-trait.rs:27:23
@ -32,7 +32,7 @@ LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
LL | remaining: self.0.iter(), LL | remaining: self.0.iter(),
| ------ ^^^^ | ------ ^^^^
| | | |
| ...is captured here... | ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:38:23 --> $DIR/trait-object-nested-in-impl-trait.rs:38:23
@ -53,7 +53,7 @@ LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
LL | remaining: self.0.iter(), LL | remaining: self.0.iter(),
| ------ ^^^^ | ------ ^^^^
| | | |
| ...is captured here... | ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:49:30 --> $DIR/trait-object-nested-in-impl-trait.rs:49:30
@ -74,7 +74,7 @@ LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
LL | remaining: self.0.iter(), LL | remaining: self.0.iter(),
| ------ ^^^^ | ------ ^^^^
| | | |
| ...is captured here... | ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:60:30 --> $DIR/trait-object-nested-in-impl-trait.rs:60:30

View file

@ -36,10 +36,10 @@ LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
LL | let y = x as &dyn Bar<'_, '_>; LL | let y = x as &dyn Bar<'_, '_>;
| - ^^ | - ^^
| | | |
| ...is captured here... | ...is used here...
LL | LL |
LL | y.get_b() // ERROR LL | y.get_b() // ERROR
| - ...is captured here... | - ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/type-checking-test-4.rs:29:5 --> $DIR/type-checking-test-4.rs:29:5
@ -61,7 +61,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
| ------------ this data with lifetime `'a`... | ------------ this data with lifetime `'a`...
LL | <_ as Bar>::get_b(x) // ERROR LL | <_ as Bar>::get_b(x) // ERROR
| ^^^^^^^^^^^^^^^^^ ...is captured and required to live as long as `'static` here | ^^^^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/type-checking-test-4.rs:32:48 --> $DIR/type-checking-test-4.rs:32:48
@ -77,7 +77,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
| ------------ this data with lifetime `'a`... | ------------ this data with lifetime `'a`...
LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR
| ----------^^------------- ...is captured and required to live as long as `'static` here | ----------^^------------- ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/type-checking-test-4.rs:37:48 --> $DIR/type-checking-test-4.rs:37:48
@ -95,13 +95,13 @@ LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
LL | let y = x as &dyn Bar<'_, '_>; LL | let y = x as &dyn Bar<'_, '_>;
| - ^^ | - ^^
| | | |
| ...is captured here... | ...is used here...
LL | LL |
LL | y.get_b(); // ERROR LL | y.get_b(); // ERROR
| - ...is captured here... | - ...is used here...
LL | let z = y; LL | let z = y;
LL | z.get_b() // ERROR LL | z.get_b() // ERROR
| - ...is captured here... | - ...is used here...
| |
note: ...and is required to live as long as `'static` here note: ...and is required to live as long as `'static` here
--> $DIR/type-checking-test-4.rs:47:5 --> $DIR/type-checking-test-4.rs:47:5

View file

@ -7,7 +7,7 @@ LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to
LL | Box::new(items.iter()) LL | Box::new(items.iter())
| ----- ^^^^ | ----- ^^^^
| | | |
| ...is captured and required to live as long as `'static` here | ...is used and required to live as long as `'static` here
| |
note: `'static` lifetime requirement introduced by the return type note: `'static` lifetime requirement introduced by the return type
--> $DIR/dyn-trait-underscore.rs:6:29 --> $DIR/dyn-trait-underscore.rs:6:29