Skip to content

Commit

Permalink
Rollup merge of #73828 - nop:fix/parameter-name-help, r=estebank
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Manishearth authored Jul 1, 2020
2 parents 82bddc6 + 7231e57 commit 4abd5fc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/librustc_parse/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ impl<'a> Parser<'a> {
if self.token != token::Lt {
err.span_suggestion(
pat.span,
"if this was a parameter name, give it a type",
"if this is a parameter name, give it a type",
format!("{}: TypeName", ident),
Applicability::HasPlaceholders,
);
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/anon-params/anon-params-denied-2018.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: i32);
| ^^^^^^^^^
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn foo(i32: TypeName);
| ^^^^^^^^^^^^^
Expand All @@ -29,7 +29,7 @@ help: if this is a `self` type, give it a parameter name
|
LL | fn bar_with_default_impl(self: String, String) {}
| ^^^^^^^^^^^^
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn bar_with_default_impl(String: TypeName, String) {}
| ^^^^^^^^^^^^^^^^
Expand All @@ -45,7 +45,7 @@ LL | fn bar_with_default_impl(String, String) {}
| ^ expected one of `:`, `@`, or `|`
|
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn bar_with_default_impl(String, String: TypeName) {}
| ^^^^^^^^^^^^^^^^
Expand All @@ -61,7 +61,7 @@ LL | fn baz(a:usize, b, c: usize) -> usize {
| ^ expected one of `:`, `@`, or `|`
|
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn baz(a:usize, b: TypeName, c: usize) -> usize {
| ^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/inverted-parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn pattern((i32, i32) (a, b)) {}

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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/inverted-parameters.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ help: if this is a `self` type, give it a parameter name
|
LL | fn fizz(self: i32) {}
| ^^^^^^^^^
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn fizz(i32: TypeName) {}
| ^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/omitted-arg-in-item-fn.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: x) {
| ^^^^^^^
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn foo(x: TypeName) {
| ^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/rfc-2565-param-attrs/param-attrs-2018.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
|
LL | trait Trait2015 { fn foo(#[allow(C)] self: i32); }
| ^^^^^^^^^
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | trait Trait2015 { fn foo(#[allow(C)] i32: TypeName); }
| ^^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/span/issue-34264.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LL | fn foo(Option<i32>, String) {}
| ^ expected one of `:`, `@`, or `|`
|
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn foo(Option<i32>, String: TypeName) {}
| ^^^^^^^^^^^^^^^^
Expand All @@ -41,7 +41,7 @@ help: if this is a `self` type, give it a parameter name
|
LL | fn bar(self: x, y: usize) {}
| ^^^^^^^
help: if this was a parameter name, give it a type
help: if this is a parameter name, give it a type
|
LL | fn bar(x: TypeName, y: usize) {}
| ^^^^^^^^^^^
Expand Down

0 comments on commit 4abd5fc

Please sign in to comment.