E0262
An impl method whose signature differs from the trait's, once Self and the trait's arguments are replaced. Receiver, parameter types, and return type must all match. Spans the method name.
Machine-applicable fix: none.
Example
This program fails with E0262.
trait Shape {
fn area(self) -> Int
}
struct Square { side: Int }
impl Shape for Square {
fn area(self) -> String {
"big"
}
}
Fixed
The same program, fixed.
trait Shape {
fn area(self) -> Int
}
struct Square { side: Int }
impl Shape for Square {
fn area(self) -> Int {
self.side * self.side
}
}
Listed in the checker notes. oskac explain E0262 prints this entry offline.