Open
Description
Code
struct Foo {
}
impl Foo {
fn invoke(Box<self>) -> i32 {
0
}
}
fn main() {}
Current output
error: expected one of `:`, `@`, or `|`, found `<`
--> main.rs:5:18
|
5 | fn invoke(Box<self>) -> i32 {
| ^ 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
|
5 | fn invoke(self: Box<self>) -> i32 {
| +++++
help: if this is a type, explicitly ignore the parameter name
|
5 | fn invoke(_: Box<self>) -> i32 {
| ++
error: aborting due to 1 previous error
Desired output
error: expected one of `:`, `@`, or `|`, found `<`
--> main.rs:5:18
|
5 | fn invoke(Box<self>) -> i32 {
| ^ 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
|
5 | fn invoke(self: Box<Self>) -> i32 {
| +++++
help: if this is a type, explicitly ignore the parameter name
|
5 | fn invoke(_: Box<Self>) -> i32 {
| ++
error: aborting due to 1 previous error
Rationale and extra context
The type of the parameter in the error message should be uppercase, Box<Self>
. However, a lowercase Box<self>
is present.
Other cases
No response
Rust Version
$ rustc --version --verbose
rustc 1.80.0-nightly (79734f1db 2024-05-02)
binary: rustc
commit-hash: 79734f1db8dbe322192dea32c0f6b80ab14c4c1d
commit-date: 2024-05-02
host: aarch64-apple-darwin
release: 1.80.0-nightly
LLVM version: 18.1.4
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: A structured suggestion resulting in incorrect code.Diagnostics: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.