Skip to content

Commit

Permalink
Rollup merge of #92018 - estebank:missing-ticks, r=oli-obk
Browse files Browse the repository at this point in the history
Fix typo in "new region bound" suggestion

The lifetime name shoud always appear in text surrounded by `.
  • Loading branch information
matthiaskrgr authored Dec 18, 2021
2 parents 8bb238b + 0b8bbac commit fedb525
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ pub fn unexpected_hidden_region_diagnostic(
fn_returns,
hidden_region.to_string(),
None,
format!("captures {}", hidden_region),
format!("captures `{}`", hidden_region),
None,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<
| |
| hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
| ++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<
| |
| hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
| ++++
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/impl-trait/hidden-lifetimes.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a {
| |
| hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + 'b {
| ++++
Expand All @@ -19,7 +19,7 @@ LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl S
| |
| hidden type `Rc<RefCell<&'b T>>` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b {
| ++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> im
| |
| hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> + 'b
| ++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a,
| |
| hidden type `Ordinary<'b>` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> + 'b
| ++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn elided(x: &i32) -> impl Copy { x }
| |
| hidden type `&i32` captures the anonymous lifetime defined here
|
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
|
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
| ++++
Expand All @@ -19,7 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
| |
| hidden type `&'a i32` captures the lifetime `'a` as defined here
|
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
| ++++
Expand Down Expand Up @@ -74,7 +74,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32
| |
| hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:35:5: 35:31]` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b {
| ++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn elided(x: &i32) -> impl Copy { x }
| |
| hidden type `&i32` captures the anonymous lifetime defined here
|
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
|
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
| ++++
Expand All @@ -19,7 +19,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
| |
| hidden type `&'a i32` captures the lifetime `'a` as defined here
|
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
| ++++
Expand Down Expand Up @@ -119,7 +119,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32
| |
| hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:35:5: 35:31]` captures the lifetime `'b` as defined here
|
help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b {
| ++++
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/region-escape-via-bound.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL |
LL | where 'x: 'y
| -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here
|
help: to declare that the `impl Trait` captures 'x, you can add an explicit `'x` lifetime bound
help: to declare that the `impl Trait` captures `'x`, you can add an explicit `'x` lifetime bound
|
LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> + 'x
| ++++
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/impl-trait/static-return-lifetime-infered.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| |
| 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
|
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
| ++++
Expand All @@ -19,7 +19,7 @@ LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| |
| 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
|
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
| ++++
Expand All @@ -32,7 +32,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| |
| 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
|
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
| ++++
Expand All @@ -45,7 +45,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| |
| 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
|
help: to declare that the `impl Trait` captures 'a, you can add an explicit `'a` lifetime bound
help: to declare that the `impl Trait` captures `'a`, you can add an explicit `'a` lifetime bound
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
| ++++
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
| |
| hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) T` captures the anonymous lifetime defined here
|
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
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
|
LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[HASH]::foo), BrAnon(0)) {
| ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | async fn f(self: Pin<&Self>) -> impl Clone { self }
| |
| hidden type `Pin<&Foo>` captures the lifetime `'_` as defined here
|
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
|
LL | async fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
| ++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | fn f(self: Pin<&Self>) -> impl Clone { self }
| |
| hidden type `Pin<&Foo>` captures the anonymous lifetime defined here
|
help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
|
LL | fn f(self: Pin<&Self>) -> impl Clone + '_ { self }
| ++++
Expand Down

0 comments on commit fedb525

Please sign in to comment.