Skip to content

Commit fedb525

Browse files
authored
Rollup merge of #92018 - estebank:missing-ticks, r=oli-obk
Fix typo in "new region bound" suggestion The lifetime name shoud always appear in text surrounded by `.
2 parents 8bb238b + 0b8bbac commit fedb525

13 files changed

+21
-21
lines changed

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub fn unexpected_hidden_region_diagnostic(
275275
fn_returns,
276276
hidden_region.to_string(),
277277
None,
278-
format!("captures {}", hidden_region),
278+
format!("captures `{}`", hidden_region),
279279
None,
280280
)
281281
}

src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<
2121
| |
2222
| hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
2323
|
24-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
24+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
2525
|
2626
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
2727
| ++++

src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<
1616
| |
1717
| hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
1818
|
19-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
19+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
2020
|
2121
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
2222
| ++++

src/test/ui/impl-trait/hidden-lifetimes.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a {
66
| |
77
| hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here
88
|
9-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
9+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
1010
|
1111
LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + 'b {
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl S
1919
| |
2020
| hidden type `Rc<RefCell<&'b T>>` captures the lifetime `'b` as defined here
2121
|
22-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
22+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
2323
|
2424
LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b {
2525
| ++++

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> im
66
| |
77
| hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
88
|
9-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
9+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
1010
|
1111
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> + 'b
1212
| ++++

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a,
66
| |
77
| hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
88
|
9-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
9+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
1010
|
1111
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> + 'b
1212
| ++++

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn elided(x: &i32) -> impl Copy { x }
66
| |
77
| hidden type `&i32` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919
| |
2020
| hidden type `&'a i32` captures the lifetime `'a` as defined here
2121
|
22-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
22+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
2323
|
2424
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
2525
| ++++
@@ -74,7 +74,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32
7474
| |
7575
| hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:35:5: 35:31]` captures the lifetime `'b` as defined here
7676
|
77-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
77+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
7878
|
7979
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b {
8080
| ++++

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn elided(x: &i32) -> impl Copy { x }
66
| |
77
| hidden type `&i32` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919
| |
2020
| hidden type `&'a i32` captures the lifetime `'a` as defined here
2121
|
22-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
22+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
2323
|
2424
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
2525
| ++++
@@ -119,7 +119,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32
119119
| |
120120
| hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:35:5: 35:31]` captures the lifetime `'b` as defined here
121121
|
122-
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
122+
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
123123
|
124124
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b {
125125
| ++++

src/test/ui/impl-trait/region-escape-via-bound.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL |
77
LL | where 'x: 'y
88
| -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here
99
|
10-
help: to declare that the `impl Trait` captures 'x, you can add an explicit `'x` lifetime bound
10+
help: to declare that the `impl Trait` captures `'x`, you can add an explicit `'x` lifetime bound
1111
|
1212
LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> + 'x
1313
| ++++

src/test/ui/impl-trait/static-return-lifetime-infered.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
66
| |
77
| hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:9:27: 9:34]>` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
1212
| ++++
@@ -19,7 +19,7 @@ LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
1919
| |
2020
| hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:9:27: 9:34]>` captures the anonymous lifetime defined here
2121
|
22-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
22+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
2323
|
2424
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
2525
| ++++
@@ -32,7 +32,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
3232
| |
3333
| hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:14:27: 14:34]>` captures the lifetime `'a` as defined here
3434
|
35-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
35+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
3636
|
3737
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
3838
| ++++
@@ -45,7 +45,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
4545
| |
4646
| hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:14:27: 14:34]>` captures the lifetime `'a` as defined here
4747
|
48-
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
48+
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
4949
|
5050
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
5151
| ++++

src/test/ui/nll/ty-outlives/impl-trait-captures.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
66
| |
77
| hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) T` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)), you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))` lifetime bound
9+
help: to declare that the `impl Trait` captures `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0))` lifetime bound
1010
|
1111
LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) {
1212
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | async fn f(self: Pin<&Self>) -> impl Clone { self }
66
| |
77
| hidden type `Pin<&Foo>` captures the lifetime `'_` as defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | async fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
1212
| ++++

src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn f(self: Pin<&Self>) -> impl Clone { self }
66
| |
77
| hidden type `Pin<&Foo>` captures the anonymous lifetime defined here
88
|
9-
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
9+
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
1010
|
1111
LL | fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
1212
| ++++

0 commit comments

Comments
 (0)