Ruta graveolens  ·  notes from a language experiment  ·  cultivated since 2025

E0411: Undefined method

CodeCategoryStability
E0411Struct and enumPermanent

Explanation

A method call names no method available for the receiver's type. Rue resolves user-defined methods on the receiver's struct and supported built-in receiver methods, including operations on strings and slices.

Likely cause

The method name is misspelled, belongs to another receiver type, or is unavailable for this built-in receiver kind; an associated function may also have been intended. Check the receiver expression's type and the callable members that type provides.

Examples

Unknown method name

struct Point { x: i32 }
fn main() -> i32 {
    let point = Point { x: 42 };
    point.value()
}

Declare the method on the receiver type

struct Point {
    x: i32,

    fn value(self) -> i32 { self.x }
}
fn main() -> i32 {
    let point = Point { x: 42 };
    point.value()
}

References