Closed
Description
Forgetting to include the left-hand side of an arbitrary self type can give some confusing errors. This was reported by someone trying to implement a future manually, and the diagnostics threw them off.
I realize diagnostics for arbitrary self types are an open issue, but figured I'd include this variant as to not overlook it. Thanks!
Code
pub fn hello(Box<Self>) {}
Expected
error: expected one of `:` or `@`, found `<`
--> src/lib.rs:1:17
|
1 | pub fn hello(Box<Self>) {}
| ^ expected one of `:` or `@` here
|
help: if this is a `self` type, give it a parameter name
|
1 | pub fn hello(self: Box<Self>) {}
| ^^^^^^^^^^^^^^^
error: aborting due to previous error
Current
error: expected one of `:` or `@`, found `<`
--> src/lib.rs:1:17
|
1 | pub fn hello(Box<Self>) {}
| ^ expected one of `:` or `@` here
error: aborting due to previous error