-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
In edition 2015, the following is supposed to be legal (playground):
pub fn foo(&str) {}
It is essentially semantically equivalent to
pub fn foo(_: &str) {}
Unfortunately, even though edition 2015 is enabled, the following error is generated:
error: expected one of `:`, `@`, or `|`, found `)`
--> src/lib.rs:1:16
|
1 | pub fn foo(&str) {}
| ^ 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
|
1 | pub fn foo(self: &str) {}
| +++++
help: if this is a parameter name, give it a type
|
1 | pub fn foo(str: &TypeName) {}
| ~~~~~~~~~~~~~~
help: if this is a type, explicitly ignore the parameter name
|
1 | pub fn foo(_: &str) {}
| ++
which explains that it was "removed in the 2018 edition". This should be irrelevant, as neither that edition, nor any later edition, is enabled.
RFC 1685 does not appear to describe breaking this in edition 2015, so I believe this to be a bug.
It causes a good amount of (quite old) crates to be impossible to build for no reason, which is unfortunate.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.