Open
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.