Code
struct Foo;
impl Foo {
fn do_something(self: Box<self>) -> Box<self> {
self
}
}
Current output
Compiling playground v0.0.1 (/playground)
error[E0435]: attempt to use a non-constant value in a constant
--> src/lib.rs:4:31
|
4 | fn do_something(self: Box<self>) -> Box<self> {
| ---- ^^^^
| |
| this would need to be a `const`
error[E0435]: attempt to use a non-constant value in a constant
--> src/lib.rs:4:45
|
4 | fn do_something(self: Box<self>) -> Box<self> {
| ---- ^^^^
| |
| this would need to be a `const`
For more information about this error, try `rustc --explain E0435`.
error: could not compile `playground` due to 2 previous errors
Desired output
Instead, rustc should suggest a change from `self` to `Self`, I think there is no case where `self` can appear like that in arguments or return type as it isn’t a type, but the current error message is definitely not clear to a newbie.
Rationale and extra context
No response
Other cases
No response
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
No response
Other cases
No response
Anything else?
No response