E0261
An impl Trait for Type that leaves out a required method (one without a default body). Spans the trait in the impl.
Machine-applicable fix: Insert a stub for each missing method before the impl's closing brace, with the trait's signature (Self replaced) and todo() as its body. None when a missing method has generic parameters of its own.
Example
This program fails with E0261.
trait Shape {
fn area(self) -> Int
fn name(self) -> String
}
struct Square { side: Int }
impl Shape for Square {
fn area(self) -> Int {
self.side * self.side
}
}
Fixed
The same program, fixed.
trait Shape {
fn area(self) -> Int
fn name(self) -> String
}
struct Square { side: Int }
impl Shape for Square {
fn area(self) -> Int {
self.side * self.side
}
fn name(self) -> String {
"square"
}
}
Listed in the checker notes. oskac explain E0261 prints this entry offline.