Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wording for anonymous parameter name help #73828

Merged
merged 1 commit into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_parse/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,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