Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 83ce1aa

Browse files
committed
Tweak wording
1 parent ff13ad7 commit 83ce1aa

21 files changed

+50
-50
lines changed

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
7676
err.span_label(
7777
cause.span,
7878
&format!(
79-
"...is captured and required to live as long as `'static` here \
79+
"...is used and required to live as long as `'static` here \
8080
because of an implicit lifetime bound on the {}",
8181
match ctxt.assoc_item.container {
8282
AssocItemContainer::TraitContainer(id) =>
@@ -158,15 +158,15 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
158158

159159
// We try to make the output have fewer overlapping spans if possible.
160160
let require_msg = if spans.is_empty() {
161-
"...is captured and required to live as long as `'static` here"
161+
"...is used and required to live as long as `'static` here"
162162
} else {
163163
"...and is required to live as long as `'static` here"
164164
};
165165
let require_span =
166166
if sup_origin.span().overlaps(return_sp) { sup_origin.span() } else { return_sp };
167167

168168
for span in &spans {
169-
err.span_label(*span, "...is captured here...");
169+
err.span_label(*span, "...is used here...");
170170
}
171171

172172
if spans.iter().any(|sp| sp.overlaps(return_sp) || *sp > return_sp) {

src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
44
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
55
| ------- this data with lifetime `'a`...
66
LL | bar(foo, x)
7-
| ^^^ - ...is captured and required to live as long as `'static` here
7+
| ^^^ - ...is used and required to live as long as `'static` here
88

99
error: aborting due to previous error
1010

src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
55
| -------- this data with lifetime `'a`...
66
...
77
LL | bar(foo, x)
8-
| ^^^ - ...is captured and required to live as long as `'static` here
8+
| ^^^ - ...is used and required to live as long as `'static` here
99
|
1010
note: `'static` lifetime requirement introduced by the return type
1111
--> $DIR/project-fn-ret-invariant.rs:45:37

src/test/ui/async-await/issues/issue-62097.stderr

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

src/test/ui/async-await/issues/issue-72312.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl Problem {
1111
//~^ NOTE this data with an anonymous lifetime `'_`
1212
//~| NOTE in this expansion of desugaring of `async` block or function
1313
require_static(async move { //~ NOTE ...and is required to live as long as `'static` here
14-
&self; //~ NOTE ...is captured here...
14+
&self; //~ NOTE ...is used here...
1515
});
1616
}
1717
}

src/test/ui/async-await/issues/issue-72312.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub async fn start(&self) {
55
| ^^^^^ this data with an anonymous lifetime `'_`...
66
...
77
LL | &self;
8-
| ----- ...is captured here...
8+
| ----- ...is used here...
99
|
1010
note: ...and is required to live as long as `'static` here
1111
--> $DIR/issue-72312.rs:13:9

src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
44
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
55
| ------------------- this data with lifetime `'a`...
66
LL | static_val(x);
7-
| ^ ...is captured here...
7+
| ^ ...is used here...
88
|
99
note: ...and is required to live as long as `'static` here
1010
--> $DIR/dyn-trait.rs:20:5

src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
2828
--> $DIR/must_outlive_least_region_or_bound.rs:9:46
2929
|
3030
LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
31-
| ---- ^ ...is captured here...
31+
| ---- ^ ...is used here...
3232
| |
3333
| this data with an anonymous lifetime `'_`...
3434
|
@@ -50,7 +50,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
5050
--> $DIR/must_outlive_least_region_or_bound.rs:11:55
5151
|
5252
LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
53-
| ------- ^ ...is captured here...
53+
| ------- ^ ...is used here...
5454
| |
5555
| this data with lifetime `'a`...
5656
|
@@ -80,7 +80,7 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
8080
--> $DIR/must_outlive_least_region_or_bound.rs:24:65
8181
|
8282
LL | fn elided5(x: &i32) -> (Box<dyn Debug>, impl Debug) { (Box::new(x), x) }
83-
| ---- this data with an anonymous lifetime `'_`... ^ ...is captured and required to live as long as `'static` here
83+
| ---- this data with an anonymous lifetime `'_`... ^ ...is used and required to live as long as `'static` here
8484
|
8585
help: to declare that the trait object captures data from argument `x`, you can add an explicit `'_` lifetime bound
8686
|
@@ -95,7 +95,7 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
9595
--> $DIR/must_outlive_least_region_or_bound.rs:29:69
9696
|
9797
LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
98-
| ------- this data with lifetime `'a`... ^ ...is captured here...
98+
| ------- this data with lifetime `'a`... ^ ...is used here...
9999
|
100100
note: ...and is required to live as long as `'static` here
101101
--> $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
136136
--> $DIR/must_outlive_least_region_or_bound.rs:16:50
137137
|
138138
LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) }
139-
| ---- ^ ...is captured and required to live as long as `'static` here
139+
| ---- ^ ...is used and required to live as long as `'static` here
140140
| |
141141
| this data with an anonymous lifetime `'_`...
142142
|
143143
note: `'static` lifetime requirement introduced by the return type
144-
--> $DIR/must_outlive_least_region_or_bound.rs:14:28
144+
--> $DIR/must_outlive_least_region_or_bound.rs:16:28
145145
|
146146
LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) }
147147
| ^^^^^^^^^ ----------- because of this returned expression
@@ -156,12 +156,12 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
156156
--> $DIR/must_outlive_least_region_or_bound.rs:18:59
157157
|
158158
LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) }
159-
| ------- ^ ...is captured and required to live as long as `'static` here
159+
| ------- ^ ...is used and required to live as long as `'static` here
160160
| |
161161
| this data with lifetime `'a`...
162162
|
163163
note: `'static` lifetime requirement introduced by the return type
164-
--> $DIR/must_outlive_least_region_or_bound.rs:16:37
164+
--> $DIR/must_outlive_least_region_or_bound.rs:18:37
165165
|
166166
LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) }
167167
| ^^^^^^^^^ ----------- because of this returned expression
@@ -176,12 +176,12 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
176176
--> $DIR/must_outlive_least_region_or_bound.rs:20:60
177177
|
178178
LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) }
179-
| ---- ^ ...is captured and required to live as long as `'static` here
179+
| ---- ^ ...is used and required to live as long as `'static` here
180180
| |
181181
| this data with an anonymous lifetime `'_`...
182182
|
183183
note: `'static` lifetime requirement introduced by the return type
184-
--> $DIR/must_outlive_least_region_or_bound.rs:18:40
184+
--> $DIR/must_outlive_least_region_or_bound.rs:20:40
185185
|
186186
LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) }
187187
| ^^^^^^^ ----------- because of this returned expression
@@ -200,10 +200,10 @@ error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime
200200
--> $DIR/must_outlive_least_region_or_bound.rs:22:69
201201
|
202202
LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) }
203-
| ------- this data with lifetime `'a`... ^ ...is captured and required to live as long as `'static` here
203+
| ------- this data with lifetime `'a`... ^ ...is used and required to live as long as `'static` here
204204
|
205205
note: `'static` lifetime requirement introduced by the return type
206-
--> $DIR/must_outlive_least_region_or_bound.rs:20:49
206+
--> $DIR/must_outlive_least_region_or_bound.rs:22:49
207207
|
208208
LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) }
209209
| ^^^^^^^ ----------- because of this returned expression

src/test/ui/issues/issue-16922.stderr

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

src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0759]: `fn` parameter has lifetime `'a` but it needs to satisfy a `'stati
44
LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
55
| ------- this data with lifetime `'a`...
66
LL | <Foo<'a>>::C
7-
| ^^^^^^^^^^^^ ...is captured and required to live as long as `'static` here
7+
| ^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
88

99
error: aborting due to previous error
1010

src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
55
| --------------- this data with an anonymous lifetime `'_`...
66
...
77
LL | ss.r
8-
| ^^^^ ...is captured and required to live as long as `'static` here
8+
| ^^^^ ...is used and required to live as long as `'static` here
99
|
1010
note: `'static` lifetime requirement introduced by the return type
1111
--> $DIR/object-lifetime-default-from-box-error.rs:14:37

src/test/ui/regions/region-object-lifetime-in-coercion.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
44
LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> {
55
| ----- this data with an anonymous lifetime `'_`...
66
LL | let x: Box<dyn Foo + 'static> = Box::new(v);
7-
| ^ ...is captured and required to live as long as `'static` here
7+
| ^ ...is used and required to live as long as `'static` here
88
|
99
help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v`
1010
|
@@ -21,7 +21,7 @@ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'sta
2121
LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
2222
| ----- this data with an anonymous lifetime `'_`...
2323
LL | Box::new(v)
24-
| ^ ...is captured and required to live as long as `'static` here
24+
| ^ ...is used and required to live as long as `'static` here
2525
|
2626
note: `'static` lifetime requirement introduced by the return type
2727
--> $DIR/region-object-lifetime-in-coercion.rs:12:33
@@ -46,7 +46,7 @@ LL | fn c(v: &[u8]) -> Box<dyn Foo> {
4646
| ----- this data with an anonymous lifetime `'_`...
4747
...
4848
LL | Box::new(v)
49-
| ^ ...is captured and required to live as long as `'static` here
49+
| ^ ...is used and required to live as long as `'static` here
5050
|
5151
note: `'static` lifetime requirement introduced by the return type
5252
--> $DIR/region-object-lifetime-in-coercion.rs:16:23

src/test/ui/regions/regions-addr-of-self.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'
44
LL | pub fn chase_cat(&mut self) {
55
| --------- this data with an anonymous lifetime `'_`...
66
LL | let p: &'static mut usize = &mut self.cats_chased;
7-
| ^^^^^^^^^^^^^^^^^^^^^ ...is captured and required to live as long as `'static` here
7+
| ^^^^^^^^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
88

99
error: aborting due to previous error
1010

src/test/ui/regions/regions-close-object-into-object-2.stderr

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

src/test/ui/regions/regions-close-object-into-object-4.stderr

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

src/test/ui/regions/regions-proc-bound-capture.stderr

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

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr

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

src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0759]: `val` has lifetime `'a` but it needs to satisfy a `'static` lifeti
44
LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait<T>) -> impl OtherTrait<'a> + 'a {
55
| ---------------------- this data with lifetime `'a`...
66
LL | val.use_self::<T>()
7-
| ^^^^^^^^ ...is captured and required to live as long as `'static` here
7+
| ^^^^^^^^ ...is used and required to live as long as `'static` here
88
|
99
note: the used `impl` has a `'static` requirement
1010
--> $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
2424
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
2525
| ------------------- this data with lifetime `'a`...
2626
LL | val.use_self()
27-
| ^^^^^^^^ ...is captured and required to live as long as `'static` here because of an implicit lifetime bound on the inherent `impl`
27+
| ^^^^^^^^ ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the inherent `impl`
2828
|
2929
note: the used `impl` has a `'static` requirement
3030
--> $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
4444
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> {
4545
| ------------------- this data with lifetime `'a`...
4646
LL | val.use_self()
47-
| ^^^^^^^^ ...is captured and required to live as long as `'static` here
47+
| ^^^^^^^^ ...is used and required to live as long as `'static` here
4848
|
4949
note: the used `impl` has a `'static` requirement
5050
--> $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
6969
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a {
7070
| ------------------- this data with lifetime `'a`...
7171
LL | MyTrait::use_self(val)
72-
| ^^^ ...is captured here...
72+
| ^^^ ...is used here...
7373
|
7474
note: ...and is required to live as long as `'static` here
7575
--> $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
9595
LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> &'a () {
9696
| ------------------- this data with lifetime `'a`...
9797
LL | val.use_self()
98-
| ^^^^^^^^ ...is captured and required to live as long as `'static` here
98+
| ^^^^^^^^ ...is used and required to live as long as `'static` here
9999
|
100100
note: the used `impl` has a `'static` requirement
101101
--> $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
115115
LL | fn use_it<'a>(val: &'a Box<dyn ObjectTrait + 'a>) -> &'a () {
116116
| ----------------------------- this data with lifetime `'a`...
117117
LL | val.use_self()
118-
| ^^^^^^^^ ...is captured and required to live as long as `'static` here
118+
| ^^^^^^^^ ...is used and required to live as long as `'static` here
119119
|
120120
note: the used `impl` has a `'static` requirement
121121
--> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:48:30

0 commit comments

Comments
 (0)