E0263

An impl Trait method that the trait does not declare. Spans the method name.

Machine-applicable fix: none.

Example

This program fails with E0263.

trait Shape {
    fn area(self) -> Int
}

struct Square { side: Int }

impl Shape for Square {
    fn area(self) -> Int {
        self.side * self.side
    }
    fn name(self) -> String {
        "square"
    }
}

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
    }
}

impl Square {
    fn name(self) -> String {
        "square"
    }
}

Listed in the checker notes. oskac explain E0263 prints this entry offline.

All error codes