Rollup merge of #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.
This commit is contained in:
commit
db900d4ef3
7 changed files with 11 additions and 11 deletions
|
@ -1415,7 +1415,7 @@ impl<'a> Parser<'a> {
|
||||||
if self.token != token::Lt {
|
if self.token != token::Lt {
|
||||||
err.span_suggestion(
|
err.span_suggestion(
|
||||||
pat.span,
|
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),
|
format!("{}: TypeName", ident),
|
||||||
Applicability::HasPlaceholders,
|
Applicability::HasPlaceholders,
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
|
||||||
|
|
|
|
||||||
LL | fn foo(self: i32);
|
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);
|
LL | fn foo(i32: TypeName);
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
@ -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) {}
|
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) {}
|
LL | fn bar_with_default_impl(String: TypeName, String) {}
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
@ -45,7 +45,7 @@ LL | fn bar_with_default_impl(String, String) {}
|
||||||
| ^ expected one of `:`, `@`, or `|`
|
| ^ expected one of `:`, `@`, or `|`
|
||||||
|
|
|
|
||||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
= 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) {}
|
LL | fn bar_with_default_impl(String, String: TypeName) {}
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
@ -61,7 +61,7 @@ LL | fn baz(a:usize, b, c: usize) -> usize {
|
||||||
| ^ expected one of `:`, `@`, or `|`
|
| ^ expected one of `:`, `@`, or `|`
|
||||||
|
|
|
|
||||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
= 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 {
|
LL | fn baz(a:usize, b: TypeName, c: usize) -> usize {
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
@ -20,7 +20,7 @@ fn pattern((i32, i32) (a, b)) {}
|
||||||
|
|
||||||
fn fizz(i32) {}
|
fn fizz(i32) {}
|
||||||
//~^ ERROR expected one of `:`, `@`
|
//~^ 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 `self` type, give it a parameter name
|
||||||
//~| HELP if this is a type, explicitly ignore the parameter name
|
//~| HELP if this is a type, explicitly ignore the parameter name
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ help: if this is a `self` type, give it a parameter name
|
||||||
|
|
|
|
||||||
LL | fn fizz(self: i32) {}
|
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) {}
|
LL | fn fizz(i32: TypeName) {}
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
@ -9,7 +9,7 @@ help: if this is a `self` type, give it a parameter name
|
||||||
|
|
|
|
||||||
LL | fn foo(self: x) {
|
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) {
|
LL | fn foo(x: TypeName) {
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
@ -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); }
|
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); }
|
LL | trait Trait2015 { fn foo(#[allow(C)] i32: TypeName); }
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
@ -21,7 +21,7 @@ LL | fn foo(Option<i32>, String) {}
|
||||||
| ^ expected one of `:`, `@`, or `|`
|
| ^ expected one of `:`, `@`, or `|`
|
||||||
|
|
|
|
||||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
= 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) {}
|
LL | fn foo(Option<i32>, String: TypeName) {}
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
@ -41,7 +41,7 @@ help: if this is a `self` type, give it a parameter name
|
||||||
|
|
|
|
||||||
LL | fn bar(self: x, y: usize) {}
|
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) {}
|
LL | fn bar(x: TypeName, y: usize) {}
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue