Skip to content

Commit e7b8e73

Browse files
committed
Use lowercase letters for the lifetime elision mismatch suggestion
1 parent a8ebdbe commit e7b8e73

8 files changed

+24
-24
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
220220
};
221221

222222
e.multipart_suggestion(
223-
"Explicitly declare a lifetime and assign it to both",
223+
"explicitly declare a lifetime and assign it to both",
224224
vec![
225225
add_lifetime_param,
226226
if let hir::LifetimeName::Underscore = lifetime_sub.name {
@@ -237,7 +237,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
237237
Applicability::MaybeIncorrect,
238238
);
239239
e.note(
240-
"Each elided lifetime in input position becomes a distinct lifetime.",
240+
"each elided lifetime in input position becomes a distinct lifetime",
241241
);
242242
}
243243
}

src/test/ui/lifetimes/issue-90170-elision-mismatch.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | fn foo(slice_a: &mut [u8], slice_b: &mut [u8]) {
66
LL | core::mem::swap(&mut slice_a, &mut slice_b);
77
| ^^^^^^^^^^^^ ...but data from `slice_b` flows into `slice_a` here
88
|
9-
= note: Each elided lifetime in input position becomes a distinct lifetime.
10-
help: Explicitly declare a lifetime and assign it to both
9+
= note: each elided lifetime in input position becomes a distinct lifetime
10+
help: explicitly declare a lifetime and assign it to both
1111
|
1212
LL | fn foo<'a>(slice_a: &'a mut [u8], slice_b: &'a mut [u8]) {
1313
| ++++ ++ ++
@@ -22,8 +22,8 @@ LL | fn foo(slice_a: &mut [u8], slice_b: &mut [u8]) {
2222
LL | core::mem::swap(&mut slice_a, &mut slice_b);
2323
| ^^^^^^^^^^^^ ...but data from `slice_a` flows into `slice_b` here
2424
|
25-
= note: Each elided lifetime in input position becomes a distinct lifetime.
26-
help: Explicitly declare a lifetime and assign it to both
25+
= note: each elided lifetime in input position becomes a distinct lifetime
26+
help: explicitly declare a lifetime and assign it to both
2727
|
2828
LL | fn foo<'a>(slice_a: &'a mut [u8], slice_b: &'a mut [u8]) {
2929
| ++++ ++ ++
@@ -36,8 +36,8 @@ LL | fn foo2<U, W, O>(slice_a: &mut [u8], slice_b: &mut [u8], _: U, _: W, _: O)
3636
LL | core::mem::swap(&mut slice_a, &mut slice_b);
3737
| ^^^^^^^^^^^^ ...but data from `slice_b` flows into `slice_a` here
3838
|
39-
= note: Each elided lifetime in input position becomes a distinct lifetime.
40-
help: Explicitly declare a lifetime and assign it to both
39+
= note: each elided lifetime in input position becomes a distinct lifetime
40+
help: explicitly declare a lifetime and assign it to both
4141
|
4242
LL | fn foo2<'a, U, W, O>(slice_a: &'a mut [u8], slice_b: &'a mut [u8], _: U, _: W, _: O) {
4343
| +++ ++ ++
@@ -52,8 +52,8 @@ LL | fn foo2<U, W, O>(slice_a: &mut [u8], slice_b: &mut [u8], _: U, _: W, _: O)
5252
LL | core::mem::swap(&mut slice_a, &mut slice_b);
5353
| ^^^^^^^^^^^^ ...but data from `slice_a` flows into `slice_b` here
5454
|
55-
= note: Each elided lifetime in input position becomes a distinct lifetime.
56-
help: Explicitly declare a lifetime and assign it to both
55+
= note: each elided lifetime in input position becomes a distinct lifetime
56+
help: explicitly declare a lifetime and assign it to both
5757
|
5858
LL | fn foo2<'a, U, W, O>(slice_a: &'a mut [u8], slice_b: &'a mut [u8], _: U, _: W, _: O) {
5959
| +++ ++ ++

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
66
LL | *v = x;
77
| ^ ...but data from `x` flows here
88
|
9-
= note: Each elided lifetime in input position becomes a distinct lifetime.
10-
help: Explicitly declare a lifetime and assign it to both
9+
= note: each elided lifetime in input position becomes a distinct lifetime
10+
help: explicitly declare a lifetime and assign it to both
1111
|
1212
LL | fn foo<'a>(&mut (ref mut v, w): &mut (&'a u8, &u8), x: &'a u8) {
1313
| ++++ ++ ++

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
66
LL | z.push((x,y));
77
| ^ ...but data flows into `z` here
88
|
9-
= note: Each elided lifetime in input position becomes a distinct lifetime.
10-
help: Explicitly declare a lifetime and assign it to both
9+
= note: each elided lifetime in input position becomes a distinct lifetime
10+
help: explicitly declare a lifetime and assign it to both
1111
|
1212
LL | fn foo<'a>(z: &mut Vec<(&'a u8,&u8)>, (x, y): (&'a u8, &u8)) {
1313
| ++++ ++ ++
@@ -20,8 +20,8 @@ LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) {
2020
LL | z.push((x,y));
2121
| ^ ...but data flows into `z` here
2222
|
23-
= note: Each elided lifetime in input position becomes a distinct lifetime.
24-
help: Explicitly declare a lifetime and assign it to both
23+
= note: each elided lifetime in input position becomes a distinct lifetime
24+
help: explicitly declare a lifetime and assign it to both
2525
|
2626
LL | fn foo<'a>(z: &mut Vec<(&u8,&'a u8)>, (x, y): (&u8, &'a u8)) {
2727
| ++++ ++ ++

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
66
LL | y.push(z);
77
| ^ ...but data from `z` flows into `y` here
88
|
9-
= note: Each elided lifetime in input position becomes a distinct lifetime.
10-
help: Explicitly declare a lifetime and assign it to both
9+
= note: each elided lifetime in input position becomes a distinct lifetime
10+
help: explicitly declare a lifetime and assign it to both
1111
|
1212
LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) {
1313
| ++++ ++ ++

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&u8>, z: &u8) {
66
LL | y.push(z);
77
| ^ ...but data from `z` flows into `y` here
88
|
9-
= note: Each elided lifetime in input position becomes a distinct lifetime.
10-
help: Explicitly declare a lifetime and assign it to both
9+
= note: each elided lifetime in input position becomes a distinct lifetime
10+
help: explicitly declare a lifetime and assign it to both
1111
|
1212
LL | fn foo<'a>(x:Box<dyn Fn(&'a u8, &'a u8)> , y: Vec<&u8>, z: &u8) {
1313
| ++++ ++ ++

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | fn foo(x: &mut Vec<&u8>, y: &u8) {
66
LL | x.push(y);
77
| ^ ...but data from `y` flows into `x` here
88
|
9-
= note: Each elided lifetime in input position becomes a distinct lifetime.
10-
help: Explicitly declare a lifetime and assign it to both
9+
= note: each elided lifetime in input position becomes a distinct lifetime
10+
help: explicitly declare a lifetime and assign it to both
1111
|
1212
LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) {
1313
| ++++ ++ ++

src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); }
66
| |
77
| these two types are declared with different lifetimes...
88
|
9-
= note: Each elided lifetime in input position becomes a distinct lifetime.
10-
help: Explicitly declare a lifetime and assign it to both
9+
= note: each elided lifetime in input position becomes a distinct lifetime
10+
help: explicitly declare a lifetime and assign it to both
1111
|
1212
LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); }
1313
| ++++ ~~ ~~

0 commit comments

Comments
 (0)