Closed
Description
Code
struct S;
impl S {
fn f(&self: Self) {}
}
Current output
Compiling playground v0.0.1 (/playground)
error: expected parameter name, found `:`
--> src/lib.rs:4:15
|
4 | fn f(&self: Self) {}
| ^ expected parameter name
error: expected one of `)` or `,`, found `:`
--> src/lib.rs:4:15
|
4 | fn f(&self: Self) {}
| ^
| |
| expected one of `)` or `,`
| help: missing `,`
error: could not compile `playground` (lib) due to 2 previous errors
Desired output
Compiling playground v0.0.1 (/playground)
error: explicit self parameter type cannot be declared with `&`
--> src/lib.rs:4:15
|
4 | fn f(&self: Self) {}
| ^ use `self: &Self` instead
error: could not compile `playground` (lib) due to 1 previous errors
Rationale and extra context
No response
Other cases
No response
Rust Version
rustc 1.78.0-nightly (0ecbd0605 2024-02-25)
binary: rustc
commit-hash: 0ecbd0605770f45c9151715e66ba2b3cae367fcb
commit-date: 2024-02-25
host: x86_64-pc-windows-msvc
release: 1.78.0-nightly
LLVM version: 18.1.0
Anything else?
Desired output is rough, but something along those lines would probably be better.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: Confusing error or lint that should be reworked.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.