Skip to content

Commit 689ab25

Browse files
authored
Rollup merge of rust-lang#73828 - nop:fix/parameter-name-help, r=estebank
Fix wording for anonymous parameter name help ``` --> exercises/functions/functions2.rs:8:15 | 8 | fn call_me(num) { | ^ expected one of `:`, `@`, or `|` | = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) help: if this is a `self` type, give it a parameter name | 8 | fn call_me(self: num) { | ^^^^^^^^^ help: if this was a parameter name, give it a type | 8 | fn call_me(num: TypeName) { | ^^^^^^^^^^^^^ help: if this is a type, explicitly ignore the parameter name | 8 | fn call_me(_: num) { | ``` This commit changes "if this was a parameter name" to "if this is a parameter name" to match the wording of similar errors.
2 parents 0c6cc45 + 7231e57 commit 689ab25

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/librustc_parse/parser/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ impl<'a> Parser<'a> {
14241424
if self.token != token::Lt {
14251425
err.span_suggestion(
14261426
pat.span,
1427-
"if this was a parameter name, give it a type",
1427+
"if this is a parameter name, give it a type",
14281428
format!("{}: TypeName", ident),
14291429
Applicability::HasPlaceholders,
14301430
);

src/test/ui/anon-params/anon-params-denied-2018.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
99
|
1010
LL | fn foo(self: i32);
1111
| ^^^^^^^^^
12-
help: if this was a parameter name, give it a type
12+
help: if this is a parameter name, give it a type
1313
|
1414
LL | fn foo(i32: TypeName);
1515
| ^^^^^^^^^^^^^
@@ -29,7 +29,7 @@ help: if this is a `self` type, give it a parameter name
2929
|
3030
LL | fn bar_with_default_impl(self: String, String) {}
3131
| ^^^^^^^^^^^^
32-
help: if this was a parameter name, give it a type
32+
help: if this is a parameter name, give it a type
3333
|
3434
LL | fn bar_with_default_impl(String: TypeName, String) {}
3535
| ^^^^^^^^^^^^^^^^
@@ -45,7 +45,7 @@ LL | fn bar_with_default_impl(String, String) {}
4545
| ^ expected one of `:`, `@`, or `|`
4646
|
4747
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
48-
help: if this was a parameter name, give it a type
48+
help: if this is a parameter name, give it a type
4949
|
5050
LL | fn bar_with_default_impl(String, String: TypeName) {}
5151
| ^^^^^^^^^^^^^^^^
@@ -61,7 +61,7 @@ LL | fn baz(a:usize, b, c: usize) -> usize {
6161
| ^ expected one of `:`, `@`, or `|`
6262
|
6363
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
64-
help: if this was a parameter name, give it a type
64+
help: if this is a parameter name, give it a type
6565
|
6666
LL | fn baz(a:usize, b: TypeName, c: usize) -> usize {
6767
| ^^^^^^^^^^^

src/test/ui/parser/inverted-parameters.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn pattern((i32, i32) (a, b)) {}
2020

2121
fn fizz(i32) {}
2222
//~^ ERROR expected one of `:`, `@`
23-
//~| HELP if this was a parameter name, give it a type
23+
//~| HELP if this is a parameter name, give it a type
2424
//~| HELP if this is a `self` type, give it a parameter name
2525
//~| HELP if this is a type, explicitly ignore the parameter name
2626

src/test/ui/parser/inverted-parameters.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ help: if this is a `self` type, give it a parameter name
3939
|
4040
LL | fn fizz(self: i32) {}
4141
| ^^^^^^^^^
42-
help: if this was a parameter name, give it a type
42+
help: if this is a parameter name, give it a type
4343
|
4444
LL | fn fizz(i32: TypeName) {}
4545
| ^^^^^^^^^^^^^

src/test/ui/parser/omitted-arg-in-item-fn.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
99
|
1010
LL | fn foo(self: x) {
1111
| ^^^^^^^
12-
help: if this was a parameter name, give it a type
12+
help: if this is a parameter name, give it a type
1313
|
1414
LL | fn foo(x: TypeName) {
1515
| ^^^^^^^^^^^

src/test/ui/rfc-2565-param-attrs/param-attrs-2018.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
99
|
1010
LL | trait Trait2015 { fn foo(#[allow(C)] self: i32); }
1111
| ^^^^^^^^^
12-
help: if this was a parameter name, give it a type
12+
help: if this is a parameter name, give it a type
1313
|
1414
LL | trait Trait2015 { fn foo(#[allow(C)] i32: TypeName); }
1515
| ^^^^^^^^^^^^^

src/test/ui/span/issue-34264.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LL | fn foo(Option<i32>, String) {}
2121
| ^ expected one of `:`, `@`, or `|`
2222
|
2323
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
24-
help: if this was a parameter name, give it a type
24+
help: if this is a parameter name, give it a type
2525
|
2626
LL | fn foo(Option<i32>, String: TypeName) {}
2727
| ^^^^^^^^^^^^^^^^
@@ -41,7 +41,7 @@ help: if this is a `self` type, give it a parameter name
4141
|
4242
LL | fn bar(self: x, y: usize) {}
4343
| ^^^^^^^
44-
help: if this was a parameter name, give it a type
44+
help: if this is a parameter name, give it a type
4545
|
4646
LL | fn bar(x: TypeName, y: usize) {}
4747
| ^^^^^^^^^^^

0 commit comments

Comments
 (0)