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

E0302: Interface member missing

CodeCategoryStability
E0302SemanticPermanent

Explanation

A type asserts conformance to an interface but has no inherent member with a required name. A bodiless conformance assertion verifies existing members; it does not supply an implementation.

Likely cause

A required method or receiverless function is missing or misspelled. Add an inherent member with the required signature, or remove the unsupported assertion.

Examples

Missing method

Requires --preview interfaces.

interface Show { fn show(borrow self) -> i64; }
struct Value is Show {}
fn read(comptime T: Show, borrow x: T) -> i64 { x.show() }
fn main() -> i32 { @intCast(read(Value, borrow Value {})) }

Supply the inherent method

Requires --preview interfaces.

interface Show { fn show(borrow self) -> i64; }
struct Value is Show { fn show(borrow self) -> i64 { 42 } }
fn read(comptime T: Show, borrow x: T) -> i64 { x.show() }
fn main() -> i32 { @intCast(read(Value, borrow Value {})) }

References