Closed
Description
struct A;
impl A {
fn foo(self: Box<Self>) {}
}
fn main() {
A.foo()
}
gives
error[E0599]: no method named `foo` found for type `A` in the current scope
--> src/main.rs:8:7
|
1 | struct A;
| --------- method `foo` not found for this
...
8 | A.foo()
| ^^^
When having a trait in scope, it looks like this:
trait B { fn foo(self: Box<Self>); }
struct A;
impl B for A {
fn foo(self: Box<Self>) {}
}
fn main() {
A.foo()
}
Standard Error
Compiling playground v0.0.1 (/playground)
error[E0599]: no method named `foo` found for type `A` in the current scope
--> src/main.rs:9:7
|
2 | struct A;
| --------- method `foo` not found for this
...
9 | A.foo()
| ^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `foo`, perhaps you need to implement it:
candidate #1: `B`
Both are not ideal. Improvements are welcomed :)